Skip to content

Commit 0295ff6

Browse files
authored
fix(unit-jest): fix .vue coverage report when babel plugin is not enabled (#5499)
1 parent aee9e17 commit 0295ff6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/@vue/cli-plugin-unit-jest/__tests__/jestPlugin.spec.js

+4
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ test('should work without Babel', async () => {
6666
useConfigFiles: true
6767
})
6868
await project.run(`vue-cli-service test:unit`)
69+
70+
await project.run(`vue-cli-service test:unit --coverage --collectCoverageFrom="src/**/*.{js,vue}"`)
71+
const appCoverage = await project.read('coverage/lcov-report/App.vue.html')
72+
expect(appCoverage).toBeTruthy()
6973
})
7074

7175
test('should work with tsx', async () => {

packages/@vue/cli-plugin-unit-jest/presets/no-babel/jest-preset.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = deepmerge(
1313
globals: {
1414
'vue-jest': {
1515
babelConfig: {
16-
plugins: [require('babel-plugin-transform-es2015-modules-commonjs')]
16+
plugins: ['babel-plugin-transform-es2015-modules-commonjs']
1717
}
1818
}
1919
}

0 commit comments

Comments
 (0)