private scope in node_modules for transformIgnorePatterns whitelist not working.
export const theme = {
fonts: {
name: 'Sans Regular',
}
}
import { theme } from '@company/library-name/src/assets/theme/default-theme';
error:
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export const theme = {
module.export = {
testMatch: ['<rootDir>/src/**/>(*.)test.{js, jsx}'], // finds test
"moduleFileExtensions": [
"js",
"jsx"
],
"moduleDirectories": [
"node_modules",
"testing"
],
"coverageThreshold": {
"global": {
"branches": 0,
"functions": 0,
"lines": 0,
"statements": 0
}
},
"coverageReporters": [
"json-summary",
"cobertura",
"html"
],
"reporters": [
"default",
"jest-junit"
],
"testPathIgnorePatterns": [
"<rootDir>/src/common/assets/",
"/public/"
],
"transformIgnorePatterns": [
"<rootDir>/node_modules/(?!@company/)"
],
"collectCoverageFrom": [
"<rootDir>/src/**/*.js",
"!**/index.js",
"!**/App.js",
"!**/node_modules/**",
"!**/specs/**",
"!<rootDir>/src/store/**",
"!<rootDir>/src/reducer/**",
"!<rootDir>/src/common/assets/**"
],
"coverageDirectory": "test/reports/coverage",
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/testing/__mocks__/fileMock.js",
"\\.(css|less)$": "<rootDir>/testing/__mocks__/styleMock.js"
},
setupFilesAfterEnv: [
'@testing-library/jest-dom/extend-expect',
'@testing-library/react/cleanup-after-each'
] // setupFiles before the tests are ran
};
System:
OS: Windows 10 10.0.17763
CPU: (4) x64 Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz
Binaries:
Node: 12.13.1 - ~\SoftwaresInstalled\node-v12.13.1-win-x64\node.EXE
Yarn: 1.9.4 - ~\AppData\Roaming\npm\yarn.CMD
npm: 6.12.1 - ~\SoftwaresInstalled\node-v12.13.1-win-x64\npm.CMD
npmPackages:
jest: ^25.3.0 => 25.3.0
Not an issue. Jest config issue on exporting.
hi could you please explain why this is not an issue? jest does not seem to be transpiling any of the packages under our private scope using the definition below, which i believe should work?
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$",
"^.+\\.module\\.(css|sass|scss)$",
"<rootDir>/node_modules/(?!@my-company/)"
],
@mng12689 if you are currently using .babelrc try changing it to a babel.config.js instead. I discovered that the transformIgnorePatterns setting seems to be completely ignored when using a .babelrc: #10256
Most helpful comment
@mng12689 if you are currently using
.babelrctry changing it to ababel.config.jsinstead. I discovered that thetransformIgnorePatternssetting seems to be completely ignored when using a.babelrc: #10256