我刚刚更新,以开玩笑24,它好像transformIgnorePatterns
不起作用。
这是我收到的错误:
/Users/lemoustachiste/work/frontend/node_modules/my-untranspiled-package/build/bundle.js:7948
export default Package$1;
^^^^^^
SyntaxError: Unexpected token export
配置是:
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
}
}
};
该项目还配置为巴贝尔6.做工精致用玩笑23。
于是我开始通过更新通天7,但仍然遇到的问题。后来我发现此评论:https://github.com/facebook/jest/issues/7578#issuecomment-451671656
这指出了文档的这一部分:https://jestjs.io/docs/en/getting-started#using-babel
果然,提取巴贝尔配置到自己的文件出来的package.json的固定的问题。