Skip to content

Commit

Permalink
fix(test): enable babel-jest to transform JSX (#2)
Browse files Browse the repository at this point in the history
babel-jest requires babel config to be stored in .js file
to transform JSX expressions via @babel/preset-react.
See jestjs/jest#6229 (comment)
  • Loading branch information
artkravchenko committed Aug 19, 2018
1 parent 05d5450 commit 67b87c0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
10 changes: 0 additions & 10 deletions packages/web-ssr-server/.babelrc

This file was deleted.

12 changes: 12 additions & 0 deletions packages/web-ssr-server/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Putting babel's configuration to 'babel.config.js' instead of '.babelrc'
// enables babel-jest to transform JSX via @babel/preset-react:
// https://github.com/facebook/jest/issues/6229#issuecomment-403539460
module.exports = {
ignore: ['/node_modules/(?!(shared|web-client))'],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread',
'babel-plugin-transform-es2015-modules-commonjs',
],
presets: ['@babel/preset-react'],
};
1 change: 1 addition & 0 deletions packages/web-ssr-server/resources/jest/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ module.exports = {
transform: {
'^.+\\.jsx?$': 'babel-jest',
},
transformIgnorePatterns: ['/node_modules/(?!(shared|web-client))'],
};

0 comments on commit 67b87c0

Please sign in to comment.