升级到jest 24后,transformIgnorePatterns无法正常工作

3

我刚刚升级到jest 24,但似乎transformIgnorePatterns不起作用了。

我收到了以下错误信息:

/Users/lemoustachiste/work/frontend/node_modules/my-untranspiled-package/build/bundle.js:7948
    export default Package$1;
    ^^^^^^

    SyntaxError: Unexpected token export

jest配置:

module.exports = {
  'modulePaths': [
    '<rootDir>/src/',
    '<rootDir>/node_modules'
  ],
  'transformIgnorePatterns': [
    'node_modules/(?!(my-untranspiled-package)/)'
  ],
  'transform': {
    '^.+\\.(ts|tsx)$': 'ts-jest',
    '^.+\\.(js|jsx)$': 'babel-jest',
    '^.+\\.(scss|ico)$': '<rootDir>/tests/importStub.js'
  },
  'setupFiles': [
    '<rootDir>/tests/jest-aurelia.config.ts'
  ],
  'setupFilesAfterEnv': ['<rootDir>/tests/jest-framework.config.ts'],
  'testRegex': '\\.(test|spec)\\.(ts|js)x?$',
  'globals': {
    'ts-jest': {
      'diagnostics': false
    }
  }
};

该项目仍然配置了Babel 6。它在Jest 23中运行良好。

1个回答

3

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接