Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"@babel/register": "7.4.4",
"@elastic/charts": "^4.2.6",
"@elastic/datemath": "5.0.2",
"@elastic/eui": "10.4.1",
"@elastic/eui": "11.0.1",
"@elastic/filesaver": "1.1.2",
"@elastic/good": "8.1.1-kibana2",
"@elastic/numeral": "2.3.3",
Expand Down Expand Up @@ -258,6 +258,7 @@
},
"devDependencies": {
"@babel/parser": "7.4.5",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/types": "7.4.4",
"@elastic/eslint-config-kibana": "0.15.0",
"@elastic/github-checks-reporter": "0.0.15",
Expand Down Expand Up @@ -338,6 +339,7 @@
"archiver": "^3.0.0",
"babel-eslint": "10.0.1",
"babel-jest": "^24.1.0",
"babel-plugin-dynamic-import-node": "^2.2.0",
"backport": "4.5.5",
"chai": "3.5.0",
"chance": "1.0.18",
Expand Down
5 changes: 5 additions & 0 deletions src/dev/jest/babel_transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@ module.exports = babelJest.createTransformer({
presets: [
require.resolve('@kbn/babel-preset/node_preset')
],
plugins: [
// enables jest to parse and execute dynamic import() calls
'@babel/plugin-syntax-dynamic-import',
'dynamic-import-node'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't hate with this, but I would really appreciate not needing to build EUI when running our tests. Ideally EUI can ship with a commonjs version in the future that applies this plugin to rewrite the dynamic imports with static ones, then we can use jest's moduleNameMapper config to rewrite @elastic/eui(/.*)? to <rootDir>/node_modules/@elastic/eui/commonjs$1.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me!

]
});
3 changes: 2 additions & 1 deletion src/dev/jest/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ export default {
'^.+\\.html?$': 'jest-raw-loader',
},
transformIgnorePatterns: [
'[/\\\\]node_modules[/\\\\].+\\.js$',
// ignore all node_modules except @elastic/eui which requires babel transforms to handle dynamic import()
'[/\\\\]node_modules(?![\\/\\\\]@elastic[\\/\\\\]eui)[/\\\\].+\\.js$',
'packages/kbn-pm/dist/index.js'
],
snapshotSerializers: [
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading