Skip to content

Commit 118d94b

Browse files
author
Rija Menage
committed
Fix coverage report generation
what was required was to add a coverage entry in the preprocessor for spec.js files and make sure @babel/core and @babel/preset-env are installed in addition to babel-* packages. Finally babel-loader needs to be added in webpack config's rules.
1 parent 1b6d430 commit 118d94b

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = function(config) {
1414
// preprocess matching files before serving them to the browser
1515
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
1616
preprocessors: {
17-
'**/*.spec.js': ['webpack', 'sourcemap']
17+
'**/*.spec.js': ['webpack', 'sourcemap','coverage']
1818
},
1919

2020
webpack: webpackConfig,

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@
1010
"vue": "^2.6.11"
1111
},
1212
"devDependencies": {
13+
"@babel/core": "^7.7.5",
14+
"@babel/preset-env": "^7.7.6",
1315
"@vue/test-utils": "^1.0.0-beta.30",
16+
"babel-core": "^6.26.3",
17+
"babel-loader": "^8.0.6",
18+
"babel-plugin-istanbul": "^5.2.0",
1419
"css-loader": "^3.3.2",
15-
"file-loader": "^5.0.2",
1620
"jasmine-core": "^3.5.0",
1721
"karma": "^4.4.1",
1822
"karma-chrome-launcher": "^3.1.0",

webpack.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ module.exports = {
1818
'vue-style-loader',
1919
'css-loader'
2020
]
21+
},
22+
{
23+
test: /\.m?js$/,
24+
exclude: /(node_modules|bower_components)/,
25+
use: {
26+
loader: 'babel-loader',
27+
options: {
28+
presets: ['@babel/preset-env']
29+
}
30+
}
2131
}
2232
]
2333
},

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy