packages/cli: added jest transform for .esm.js files

This commit is contained in:
Patrik Oldsberg
2020-04-27 12:59:23 +02:00
parent 85452a02b7
commit 2068829f4f
3 changed files with 85 additions and 47 deletions
+7
View File
@@ -29,6 +29,13 @@ if (fs.existsSync('jest.config.js')) {
moduleNameMapper: {
'\\.(css|less|scss|sss|styl)$': require.resolve('jest-css-modules'),
},
// We build .esm.js files with plugin:build, so to be able to load these in tests they need to be transformed
// TODO: jest is working on module support, it's possible that we can remove this in the future
transform: {
'\\.esm\\.js$': require.resolve('jest-esm-transformer'),
},
// Default behaviour is to not apply transforms for node_modules, but we still want to tranform .esm.js files
transformIgnorePatterns: ['/node_modules/(?!.*\\.esm\\.js$)'],
};
// Use src/setupTests.ts as the default location for configuring test env