We're using Babel to convert to ES5. We have folders, mostly tests, that are excluded from this because we do not want them in the final bundle. However, the all the contents of __test__ are not being excluded, while __tests__, __mocks__, __fixtures__ are correctly excluded including their contents. I tried moving contents of __test__ to __tests__ but no difference is made.
The only thing I can think of is that the type of the remaining files, myTest.spec.js.snap is not being read by Babel at all.
Our NPM Script Command to run (after reviewing this open issue):
"build:es2015": "NODE_ENV=production babel ./src --out-dir ./build --copy-files --no-copy-ignored",
babel.config.js file:
module.exports = function babelConfig(api) {
api.cache(true);
return {
presets: ['@babel/react', ['@babel/preset-env', { modules: false }]],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-optional-chaining',
],
ignore: [
'node_modules',
'build',
'**/__test__', <-- NOT Excluding all files
'**/__tests__',
'**/__mocks__',
'**/__fixtures__',
'index.js',
'**/devMode',
'**/test-utils',
'**/**/*.js.snap', <-- specifically including the "snap" file which is not JS
'src/setupTests.js',
],
};
};
package.json#devDependencies:
"@babel/cli": "^7.10.1",
"@babel/core": "^7.10.2",
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.10.2",
"@babel/preset-react": "^7.10.1",
So my output build excludes the "test.js" file correctly, but not the snapshot. What's the correct "ignore" or "exclude" on this so that __test__ is also included for ignore?