Import Babel polyfill when running Jest tests (#14508) (#14641)

This commit is contained in:
Kim Joar Bekkelund 2017-11-16 10:34:05 +01:00 committed by GitHub
parent 2836d73021
commit 7c52b5a32a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -15,6 +15,9 @@
"moduleNameMapper": {
"^ui_framework/components": "<rootDir>/ui_framework/components"
},
"setupFiles": [
"<rootDir>/src/jest/setup/babel_polyfill.js"
],
"coverageDirectory": "<rootDir>/target/jest-coverage",
"coverageReporters": [
"html"
@ -38,4 +41,4 @@
"snapshotSerializers": [
"<rootDir>/node_modules/enzyme-to-json/serializer"
]
}
}

View file

@ -0,0 +1,4 @@
// Note: In theory importing the polyfill should not be needed, as Babel should
// include the necessary polyfills when using `babel-preset-env`, but for some
// reason it did not work. See https://github.com/elastic/kibana/issues/14506
import '../../babel-register/polyfill';