Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e05cedb

Browse files
fix(coverage): apply patch from istanbuljs/istanbuljs#837 (#9413)
Co-authored-by: sapphi-red
1 parent f1ea6be commit e05cedb

File tree

5 files changed

+56
-6
lines changed
  • packages/coverage-istanbul
    • package.json
    • rollup.config.js
  • patches
    • istanbul-lib-source-maps.patch
  • pnpm-lock.yaml
  • pnpm-workspace.yaml

5 files changed

+56
-6
lines changed

packages/coverage-istanbul/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
"istanbul-lib-coverage": "catalog:",
5151
"istanbul-lib-instrument": "^6.0.3",
5252
"istanbul-lib-report": "catalog:",
53-
"istanbul-lib-source-maps": "catalog:",
5453
"istanbul-reports": "catalog:",
5554
"magicast": "catalog:",
5655
"obug": "catalog:",
@@ -62,6 +61,7 @@
6261
"@types/istanbul-lib-report": "catalog:",
6362
"@types/istanbul-lib-source-maps": "catalog:",
6463
"@types/istanbul-reports": "catalog:",
64+
"istanbul-lib-source-maps": "catalog:",
6565
"pathe": "catalog:",
6666
"vitest": "workspace:*"
6767
}

packages/coverage-istanbul/rollup.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ const plugins = [
2727
...dtsUtils.isolatedDecl(),
2828
nodeResolve(),
2929
json(),
30-
commonjs(),
30+
commonjs({
31+
// "istanbul-lib-source-maps > @jridgewell/trace-mapping" is not CJS
32+
esmExternals: ['@jridgewell/trace-mapping'],
33+
}),
3134
oxc({
3235
transform: { target: 'node18' },
3336
}),

patches/istanbul-lib-source-maps.patch

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
diff --git a/CHANGELOG.md b/CHANGELOG.md
2+
deleted file mode 100644
3+
index dad8c06aac26cb8cfced31da5f35ac8e95915f15..0000000000000000000000000000000000000000
4+
diff --git a/lib/get-mapping.js b/lib/get-mapping.js
5+
index 187a02ed65104d8e3a058d6bfe7dc8bd7c285369..14d21ca5f933f3685e 5b0a1be14dad6c9003fd76 100644
6+
--- a/lib/get-mapping.js
7+
+++ b/lib/get-mapping.js
8+
@@ -1,3 +1,5 @@
9+
+// Contains patch from https://github.com/istanbuljs/istanbuljs/pull/837
10+
+
11+
/*
12+
Copyright 2015, Yahoo Inc.
13+
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
14+
@@ -36,13 +38,27 @@ function originalEndPositionFor(sourceMap, generatedEnd) {
15+
// generated file end location. Note however that this position on its
16+
// own is not useful because it is the position of the _start_ of the range
17+
// on the original file, and we want the _end_ of the range.
18+
- const beforeEndMapping = originalPositionTryBoth(
19+
+ let beforeEndMapping = originalPositionTryBoth(
20+
sourceMap,
21+
generatedEnd.line,
22+
generatedEnd.column - 1
23+
);
24+
if (beforeEndMapping.source === null) {
25+
- return null;
26+
+ // search the previous lines as the mapping was not found on the same line
27+
+ for (
28+
+ let line = generatedEnd.line;
29+
+ line > 0 && beforeEndMapping.source === null;
30+
+ line--
31+
+ ) {
32+
+ beforeEndMapping = originalPositionTryBoth(
33+
+ sourceMap,
34+
+ line,
35+
+ Infinity
36+
+ );
37+
+ }
38+
+ if (beforeEndMapping.source === null) {
39+
+ return null;
40+
+ }
41+
}
42+
43+
// Convert that original position back to a generated one, with a bump

pnpm-lock.yaml

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ patchedDependencies:
4141
'@types/sinonjs__fake-timers@8.1.5': patches/@types__sinonjs__fake-timers@8.1.5.patch
4242
acorn@8.11.3: patches/acorn@8.11.3.patch
4343
cac@6.7.14: patches/cac@6.7.14.patch
44+
istanbul-lib-source-maps: patches/istanbul-lib-source-maps.patch
4445
catalog:
4546
'@iconify-json/carbon': ^1.2.14
4647
'@iconify-json/logos': ^1.2.10

0 commit comments

Comments
(0)