繁体   English   中英

babel-jest:Babel 忽略 app/utils/myfile.js - 确保在 Jest 的 transformIgnorePatterns 中也包含该文件

[英]babel-jest: Babel ignores app/utils/myfile.js - make sure to include the file in Jest's transformIgnorePatterns as well

当我忽略带有 babel 的文件时,我无法运行我的笑话测试:

babel.config.js:

module.exports = {
  ignore: ['./app/utils/myfile.js'],
  presets: [
    [
      '@babel/preset-env',
      {
        targets: {
          node: '14',
        },
        useBuiltIns: 'entry',
        corejs: '3.8',
      },
    ],
  ],
};

jest.config.js:

module.exports = {
  coverageDirectory: 'coverage',
  setupFiles: ['./jest.init.js'],
  testEnvironment: 'node',
  testMatch: ['**/?(*.)+(spec|test).js'],
  transform: {
    '^.+\\.(js|jsx)$': 'babel-jest',
  },
  transformIgnorePatterns: ['myfile'],
  testPathIgnorePatterns: ['/node_modules/'],
};

我已将 myfile.js 添加到 babel 忽略和开玩笑的 transformIgnorePatterns。 会是什么呢?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM