mirror of
https://github.com/hanzoai/vitest.git
synced 2026-09-24 17:04:25 +00:00
44 lines
1.7 KiB
Diff
44 lines
1.7 KiB
Diff
diff --git a/CHANGELOG.md b/CHANGELOG.md
|
|
deleted file mode 100644
|
|
index dad8c06aac26cb8cfced31da5f35ac8e95915f15..0000000000000000000000000000000000000000
|
|
diff --git a/lib/get-mapping.js b/lib/get-mapping.js
|
|
index 187a02ed65104d8e3a058d6bfe7dc8bd7c285369..14d21ca5f933f3685e5b0a1be14dad6c9003fd76 100644
|
|
--- a/lib/get-mapping.js
|
|
+++ b/lib/get-mapping.js
|
|
@@ -1,3 +1,5 @@
|
|
+// Contains patch from https://github.com/istanbuljs/istanbuljs/pull/837
|
|
+
|
|
/*
|
|
Copyright 2015, Yahoo Inc.
|
|
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
|
@@ -36,13 +38,27 @@ function originalEndPositionFor(sourceMap, generatedEnd) {
|
|
// generated file end location. Note however that this position on its
|
|
// own is not useful because it is the position of the _start_ of the range
|
|
// on the original file, and we want the _end_ of the range.
|
|
- const beforeEndMapping = originalPositionTryBoth(
|
|
+ let beforeEndMapping = originalPositionTryBoth(
|
|
sourceMap,
|
|
generatedEnd.line,
|
|
generatedEnd.column - 1
|
|
);
|
|
if (beforeEndMapping.source === null) {
|
|
- return null;
|
|
+ // search the previous lines as the mapping was not found on the same line
|
|
+ for (
|
|
+ let line = generatedEnd.line;
|
|
+ line > 0 && beforeEndMapping.source === null;
|
|
+ line--
|
|
+ ) {
|
|
+ beforeEndMapping = originalPositionTryBoth(
|
|
+ sourceMap,
|
|
+ line,
|
|
+ Infinity
|
|
+ );
|
|
+ }
|
|
+ if (beforeEndMapping.source === null) {
|
|
+ return null;
|
|
+ }
|
|
}
|
|
|
|
// Convert that original position back to a generated one, with a bump
|