Skip to content

Commit 00bf759

Browse files
committed
#227: Webpack code coverage support
1 parent d22450c commit 00bf759

File tree

3 files changed

+67
-4
lines changed

3 files changed

+67
-4
lines changed

packages/e2e-cypress/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
},
4545
"devDependencies": {
4646
"@types/lodash": "^4.14.178",
47+
"coverage-istanbul-loader": "^3.0.5",
4748
"rimraf": "^3.0.2"
4849
}
4950
}

packages/e2e-cypress/src/index.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*
55
* API: https://github.com/quasarframework/quasar/blob/master/app/lib/app-extension/IndexAPI.js
66
*/
7+
const path = require('path');
78

89
module.exports = async function (api) {
910
api.compatibleWith('quasar', '^2.0.0');
@@ -40,10 +41,18 @@ module.exports = async function (api) {
4041
);
4142
});
4243
} else {
43-
// TODO: add webpack code coverage support
44-
// See https://www.npmjs.com/package/istanbul-instrumenter-loader
45-
// https://github.com/vuejs/vue-cli/issues/1363#issuecomment-405352542
46-
// https://github.com/akoidan/vue-webpack-typescript
44+
if (api.hasWebpack === true) {
45+
api.extendWebpack((cfg) => {
46+
cfg.module.rules.push({
47+
test: /\.(js|ts|vue)$/,
48+
loader: '@jsdevtools/coverage-istanbul-loader',
49+
options: { esModules: true },
50+
enforce: 'post',
51+
include: path.join(__dirname, '..', '..', '..', '..', 'src'),
52+
exclude: [/\.(e2e|spec)\.(js|ts)$/, /node_modules/],
53+
});
54+
});
55+
}
4756
}
4857
}
4958
};

yarn.lock

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,6 +1586,17 @@
15861586
"@jridgewell/resolve-uri" "^3.0.3"
15871587
"@jridgewell/sourcemap-codec" "^1.4.10"
15881588

1589+
"@jsdevtools/[email protected]":
1590+
version "3.0.5"
1591+
resolved "https://registry.yarnpkg.com/@jsdevtools/coverage-istanbul-loader/-/coverage-istanbul-loader-3.0.5.tgz#2a4bc65d0271df8d4435982db4af35d81754ee26"
1592+
integrity sha512-EUCPEkaRPvmHjWAAZkWMT7JDzpw7FKB00WTISaiXsbNOd5hCHg77XLA8sLYLFDo1zepYLo2w7GstN8YBqRXZfA==
1593+
dependencies:
1594+
convert-source-map "^1.7.0"
1595+
istanbul-lib-instrument "^4.0.3"
1596+
loader-utils "^2.0.0"
1597+
merge-source-map "^1.1.0"
1598+
schema-utils "^2.7.0"
1599+
15891600
15901601
version "4.0.0"
15911602
resolved "https://registry.yarnpkg.com/@lerna/add/-/add-4.0.0.tgz#c36f57d132502a57b9e7058d1548b7a565ef183f"
@@ -2575,6 +2586,11 @@
25752586
dependencies:
25762587
"@types/istanbul-lib-report" "*"
25772588

2589+
"@types/json-schema@^7.0.5":
2590+
version "7.0.11"
2591+
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3"
2592+
integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==
2593+
25782594
"@types/json-schema@^7.0.9":
25792595
version "7.0.9"
25802596
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d"
@@ -3055,6 +3071,11 @@ aggregate-error@^3.0.0:
30553071
clean-stack "^2.0.0"
30563072
indent-string "^4.0.0"
30573073

3074+
ajv-keywords@^3.5.2:
3075+
version "3.5.2"
3076+
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d"
3077+
integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==
3078+
30583079
ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4:
30593080
version "6.12.6"
30603081
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4"
@@ -4589,6 +4610,13 @@ cosmiconfig@^7.0.0:
45894610
path-type "^4.0.0"
45904611
yaml "^1.10.0"
45914612

4613+
coverage-istanbul-loader@^3.0.5:
4614+
version "3.0.5"
4615+
resolved "https://registry.yarnpkg.com/coverage-istanbul-loader/-/coverage-istanbul-loader-3.0.5.tgz#bf942efc0f4e3ac27565203c17dca5008eae6637"
4616+
integrity sha512-xsw2phF0VNqUPk47V/vHXkdcTyl0tkMSmaZfLrTOhoPhPMXFelNju7utl5s7I93KXzipqDEK0YwofQSSflPz8A==
4617+
dependencies:
4618+
"@jsdevtools/coverage-istanbul-loader" "3.0.5"
4619+
45924620
create-ecdh@^4.0.0:
45934621
version "4.0.4"
45944622
resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.4.tgz#d6e7f4bffa66736085a0762fd3a632684dabcc4e"
@@ -8167,6 +8195,15 @@ loader-utils@^1.2.3:
81678195
emojis-list "^3.0.0"
81688196
json5 "^1.0.1"
81698197

8198+
loader-utils@^2.0.0:
8199+
version "2.0.2"
8200+
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.2.tgz#d6e3b4fb81870721ae4e0868ab11dd638368c129"
8201+
integrity sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==
8202+
dependencies:
8203+
big.js "^5.2.2"
8204+
emojis-list "^3.0.0"
8205+
json5 "^2.1.2"
8206+
81708207
local-pkg@^0.4.1:
81718208
version "0.4.1"
81728209
resolved "https://registry.yarnpkg.com/local-pkg/-/local-pkg-0.4.1.tgz#e7b0d7aa0b9c498a1110a5ac5b00ba66ef38cfff"
@@ -8493,6 +8530,13 @@ meow@^8.0.0:
84938530
type-fest "^0.18.0"
84948531
yargs-parser "^20.2.3"
84958532

8533+
merge-source-map@^1.1.0:
8534+
version "1.1.0"
8535+
resolved "https://registry.yarnpkg.com/merge-source-map/-/merge-source-map-1.1.0.tgz#2fdde7e6020939f70906a68f2d7ae685e4c8c646"
8536+
integrity sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw==
8537+
dependencies:
8538+
source-map "^0.6.1"
8539+
84968540
merge-stream@^2.0.0:
84978541
version "2.0.0"
84988542
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
@@ -10533,6 +10577,15 @@ saxes@^5.0.1:
1053310577
dependencies:
1053410578
xmlchars "^2.2.0"
1053510579

10580+
schema-utils@^2.7.0:
10581+
version "2.7.1"
10582+
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.7.1.tgz#1ca4f32d1b24c590c203b8e7a50bf0ea4cd394d7"
10583+
integrity sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==
10584+
dependencies:
10585+
"@types/json-schema" "^7.0.5"
10586+
ajv "^6.12.4"
10587+
ajv-keywords "^3.5.2"
10588+
1053610589
semver-diff@^2.0.0:
1053710590
version "2.1.0"
1053810591
resolved "https://registry.yarnpkg.com/semver-diff/-/semver-diff-2.1.0.tgz#4bbb8437c8d37e4b0cf1a68fd726ec6d645d6d36"

0 commit comments

Comments
 (0)