-
Notifications
You must be signed in to change notification settings - Fork 65
Cannot read property 'fileCoverage' of undefined - Babel 7 #90
Comments
I'm also getting these error messages. |
@mkapiczy was babel 7 the only thing you upgraded? |
Encountered this error today and couldn't configure my way out of it for the life of me. I later discovered Webpack had been misconfigured to run the instrumenter task twice. Configuring it to run once eliminated the error. So, check your webpack test runner configuration. Even if you configured the instrumenter yourself, you may have obscure code that does the same thing automatically! |
Hi @mkapiczy , can you try to remove the Both babel-plugin and webpack-loader will run the instrumenter task. As you can see, the output will be ee.exit(path); // undefined once program exit (actually, I don't know what program is it) For me, I choose remove the Update |
This seems almost always caused by an already instrumented code -- the only way the |
@iamahuman @woram-nyansa you say the cause but not the solution, can you please help me finding the solution? Here is my configs:
module.exports = {
devServer: {
port: process.env.VUE_APP_PORT,
allowedHosts: [process.env.VUE_APP_HOST]
},
chainWebpack: config => {
const svgRule = config.module.rule('svg')
svgRule.uses.clear()
svgRule.use('vue-svg-loader').loader('vue-svg-loader')
config.output.globalObject('this')
if (process.env.NODE_ENV === 'test') {
// To debug using vscode
config.devtool = '#inline-cheap-module-source-map'
const path = require('path')
config.module
.rule('istanbul')
.test(/\.(ts|vue)$/)
.enforce('post')
.include.add(path.resolve(__dirname, 'src'))
.end()
.use('istanbul-instrumenter-loader')
.loader('istanbul-instrumenter-loader')
.options({ esModules: true })
}
}
}
module.exports = {
presets: [
[
'@vue/app',
{
useBuiltIns: 'entry'
}
]
],
plugins: [
[
'transform-imports',
{
vuetify: {
transform: 'vuetify/es5/components/${member}', // eslint-disable-line no-template-curly-in-string
preventFullImport: true
}
}
]
],
env: {
test: {
presets: ['@babel/preset-env'],
plugins: ['istanbul']
}
}
}
...
"dependencies": {
"@babel/polyfill": "^7.0.0-rc.1",
"@casl/ability": "^3.0.1",
"@casl/vue": "^0.5.1",
"@fullcalendar/core": "^4.2.0",
"@fullcalendar/daygrid": "^4.1.0",
"@fullcalendar/list": "^4.1.0",
"@fullcalendar/timegrid": "^4.1.0",
"@fullcalendar/vue": "^4.1.0",
"@tinymce/tinymce-vue": "^1.1.0",
"@types/lodash": "^4.14.120",
"@types/moment-timezone": "^0.5.10",
"@types/rosie": "0.0.36",
"@types/sinon": "^7.0.5",
"actioncable-vue": "^1.2.4",
"aws-sdk": "^2.336.0",
"dotenv": "^6.1.0",
"element-ui": "2.9.2",
"filesize": "^4.0.0",
"flush-promises": "^1.0.2",
"jwt-decode": "^2.2.0",
"material-design-icons-iconfont": "^3.0.3",
"moment": "^2.22.2",
"moment-timezone": "^0.5.23",
"roboto-fontface": "*",
"rosie": "^2.0.1",
"rut-helpers": "^0.1.1",
"s3-easy-deploy": "^1.1.0",
"tinycolor2": "^1.4.1",
"v-calendar": "^1.0.0-beta.14",
"v-click-outside": "^2.1.1",
"v-money": "^0.8.1",
"vue": "^2.5.21",
"vue-class-component": "^6.3.2",
"vue-clickaway": "^2.2.2",
"vue-full-loading": "^1.2.1",
"vue-i18n": "^8.7.0",
"vue-lodash": "^2.0.0",
"vue-mixin-decorator": "^1.1.0",
"vue-moment": "^4.0.0",
"vue-pdf": "arioth/vue-pdf#253f6186ff0676abf9277786087dda8d95dd8ea7",
"vue-property-decorator": "^7.3.0",
"vue-resource": "^1.5.1",
"vue-router": "^3.0.1",
"vue-svgicon": "^3.2.2",
"vue-tel-input": "^2.0.13",
"vue-wait": "arioth/vue-wait#b6cabe208f3d552fb62bc69621d60dda755bb643",
"vuedraggable": "^2.20.0",
"vuex": "^3.0.1",
"vuex-class": "^0.3.1",
"vuex-persistedstate": "^2.5.4"
},
"devDependencies": {
"@babel/core": "^7.3.3",
"@babel/preset-env": "^7.0.0",
"@types/chai": "^4.1.7",
"@types/mocha": "^5.2.4",
"@vue/cli-plugin-babel": "^3.4.1",
"@vue/cli-plugin-e2e-nightwatch": "^3.8.0",
"@vue/cli-plugin-eslint": "^3.0.1",
"@vue/cli-plugin-typescript": "^3.6.0",
"@vue/cli-plugin-unit-mocha": "^3.0.1",
"@vue/cli-service": "^3.6.0",
"@vue/eslint-config-typescript": "^3.0.1",
"babel-loader": "^8.0.2",
"babel-plugin-istanbul": "^5.1.4",
"babel-plugin-transform-imports": "^1.5.0",
"chai": "^4.2.0",
"electron": "^4.0.2",
"eslint": "^5.10.0",
"eslint-plugin-vue": "^5.0.0",
"istanbul-instrumenter-loader": "^3.0.1",
"jsdom": "^13.2.0",
"jsdom-global": "^3.0.2",
"node-sass": "^4.11.0",
"nyc": "^14.1.1",
"pug": "^2.0.3",
"pug-plain-loader": "^1.0.0",
"sass-loader": "^7.0.1",
"sinon": "^7.2.3",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"typescript": "~3.1.1",
"vue-svg-loader": "^0.11.0",
"vue-template-compiler": "^2.5.21",
"webpack": "^4.17.2"
},
"nyc": {
"check-coverage": true,
"per-file": true,
"lines": 90,
"statements": 90,
"functions": 90,
"branches": 90,
"include": [
"src/**/*.{ts,vue}"
],
"reporter": [
"lcov",
"text-summary"
],
"extension": [
".ts",
".vue"
],
"cache": true,
"all": true
} |
@silva96 This is not necessarily istanbul-instrumenter-loader's fault, and in my case it was due to an issue in vue-loader pitcher's loader request injection which managed to come to the surface via an edge case introduced by throwing both TypeScript loader and Vue SFC loader into the mix, but it wasn't pretty easy to come up with a clean solution and then soon after a while I forgot about it. |
@silva96 In your case, you might have some luck by taking out either one of the following lines in your .use('istanbul-instrumenter-loader')
.loader('istanbul-instrumenter-loader') |
Back to on-topic discussion, a solution for this issue would be to notify user of the duplicated instrumentation instead of the unhelpful message, since ignoring it would highly likely introduce yet another obscure bug which might be even harder to trace. |
Since it is clear that this issue is solely caused by instrumenting already instrumented code I'd like to suggest |
That didn't work
Taking
Taking both out:
|
@silva96 Oops, my apologizes. Can you do a |
After upgrading to babel 7 I started receiving the error, and none of the related issues I have found helped to solve it. Removing the istambul-instrumenter-loader rule from the webpack configuration the error disappears, bot the coverage does not work.
babel-plugin-istanbul: 5.1.0
node: 9.11.2
npm: 5.6.0
package.json
webpack.base.conf.js
webpack.test.conf.js
karma.conf.js
.babelrc
The text was updated successfully, but these errors were encountered: