@vitest/browser 4.0.0-beta.2 → 4.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/.vite/manifest.json +6 -6
- package/dist/client/__vitest__/assets/{index-Cil7RPEC.js → index-DYFYwZ2-.js} +28 -29
- package/dist/client/__vitest__/index.html +1 -1
- package/dist/client/__vitest_browser__/{orchestrator-CQgVbcQq.js → orchestrator-BXzaDpYw.js} +244 -253
- package/dist/client/__vitest_browser__/{tester-BScMoGFI.js → tester-DabNvcOf.js} +200 -493
- package/dist/client/__vitest_browser__/{utils-Owv5OOOf.js → utils-BNwnRrZR.js} +8 -4
- package/dist/client/orchestrator.html +2 -2
- package/dist/client/tester/tester.html +2 -2
- package/dist/expect-element.js +3 -2
- package/dist/index.d.ts +7 -7
- package/dist/index.js +5 -5
- package/dist/locators/index.d.ts +3 -3
- package/dist/types.d.ts +5 -5
- package/jest-dom.d.ts +46 -0
- package/package.json +14 -14
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import {
|
|
4
|
+
import { g as getDefaultExportFromCjs$1, c as resolve, e as executor, d as getWorkerState, b as getConfig, a as getBrowserState } from "./utils-BNwnRrZR.js";
|
|
5
5
|
import { onCancel, globalChannel, channel, client } from "@vitest/browser/client";
|
|
6
6
|
import { userEvent, page, server } from "@vitest/browser/context";
|
|
7
|
-
import { getSafeTimers, TraceMap, originalPositionFor, loadDiffConfig, loadSnapshotSerializers, takeCoverageInsideWorker, stringify, format, setupCommonEnv, startCoverageInsideWorker, stopCoverageInsideWorker, startTests, collectTests, SpyModule } from "vitest/internal/browser";
|
|
7
|
+
import { getSafeTimers, TraceMap as TraceMap$1, originalPositionFor as originalPositionFor$1, loadDiffConfig, loadSnapshotSerializers, takeCoverageInsideWorker, stringify, format, setupCommonEnv, startCoverageInsideWorker, stopCoverageInsideWorker, startTests, collectTests, SpyModule } from "vitest/internal/browser";
|
|
8
8
|
import { VitestTestRunner, NodeBenchmarkRunner } from "vitest/runners";
|
|
9
9
|
const scriptRel = "modulepreload";
|
|
10
10
|
const assetsURL = function(dep) {
|
|
@@ -111,7 +111,7 @@ const revive = (input, parsed, output, $) => {
|
|
|
111
111
|
}
|
|
112
112
|
return output;
|
|
113
113
|
};
|
|
114
|
-
const parse = (text, reviver) => {
|
|
114
|
+
const parse$1 = (text, reviver) => {
|
|
115
115
|
const input = $parse(text, Primitives).map(primitives);
|
|
116
116
|
const value = input[0];
|
|
117
117
|
const $ = noop;
|
|
@@ -179,7 +179,6 @@ function createSafeRpc(client2) {
|
|
|
179
179
|
function rpc$2() {
|
|
180
180
|
return globalThis.__vitest_worker__.rpc;
|
|
181
181
|
}
|
|
182
|
-
var traceMapping_umd$1 = { exports: {} };
|
|
183
182
|
var sourcemapCodec_umd$1 = { exports: {} };
|
|
184
183
|
var sourcemapCodec_umd = sourcemapCodec_umd$1.exports;
|
|
185
184
|
var hasRequiredSourcemapCodec_umd;
|
|
@@ -561,9 +560,9 @@ function requireSourcemapCodec_umd() {
|
|
|
561
560
|
return decoded;
|
|
562
561
|
}
|
|
563
562
|
function sort(line) {
|
|
564
|
-
line.sort(
|
|
563
|
+
line.sort(sortComparator2);
|
|
565
564
|
}
|
|
566
|
-
function
|
|
565
|
+
function sortComparator2(a2, b) {
|
|
567
566
|
return a2[0] - b[0];
|
|
568
567
|
}
|
|
569
568
|
function encode(decoded) {
|
|
@@ -607,6 +606,7 @@ function requireSourcemapCodec_umd() {
|
|
|
607
606
|
})(sourcemapCodec_umd$1, sourcemapCodec_umd$1.exports);
|
|
608
607
|
return sourcemapCodec_umd$1.exports;
|
|
609
608
|
}
|
|
609
|
+
var sourcemapCodec_umdExports = requireSourcemapCodec_umd();
|
|
610
610
|
var resolveUri_umd$1 = { exports: {} };
|
|
611
611
|
var resolveUri_umd = resolveUri_umd$1.exports;
|
|
612
612
|
var hasRequiredResolveUri_umd;
|
|
@@ -799,485 +799,192 @@ function requireResolveUri_umd() {
|
|
|
799
799
|
})(resolveUri_umd$1);
|
|
800
800
|
return resolveUri_umd$1.exports;
|
|
801
801
|
}
|
|
802
|
-
var
|
|
803
|
-
|
|
804
|
-
function
|
|
805
|
-
if (
|
|
806
|
-
|
|
807
|
-
(
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
} else if (sl < stopLine) {
|
|
988
|
-
sc = columnOffset + nextOffset.column;
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
addSection(map, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset + offset.line, columnOffset + offset.column, sl, sc);
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
function addSection(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
|
|
995
|
-
const parsed = parse2(input);
|
|
996
|
-
if ("sections" in parsed)
|
|
997
|
-
return recurse(...arguments);
|
|
998
|
-
const map = new TraceMap2(parsed, mapUrl);
|
|
999
|
-
const sourcesOffset = sources.length;
|
|
1000
|
-
const namesOffset = names.length;
|
|
1001
|
-
const decoded = decodedMappings(map);
|
|
1002
|
-
const { resolvedSources, sourcesContent: contents, ignoreList: ignores } = map;
|
|
1003
|
-
append(sources, resolvedSources);
|
|
1004
|
-
append(names, map.names);
|
|
1005
|
-
if (contents)
|
|
1006
|
-
append(sourcesContent, contents);
|
|
1007
|
-
else
|
|
1008
|
-
for (let i = 0; i < resolvedSources.length; i++)
|
|
1009
|
-
sourcesContent.push(null);
|
|
1010
|
-
if (ignores)
|
|
1011
|
-
for (let i = 0; i < ignores.length; i++)
|
|
1012
|
-
ignoreList.push(ignores[i] + sourcesOffset);
|
|
1013
|
-
for (let i = 0; i < decoded.length; i++) {
|
|
1014
|
-
const lineI = lineOffset + i;
|
|
1015
|
-
if (lineI > stopLine)
|
|
1016
|
-
return;
|
|
1017
|
-
const out = getLine(mappings, lineI);
|
|
1018
|
-
const cOffset = i === 0 ? columnOffset : 0;
|
|
1019
|
-
const line = decoded[i];
|
|
1020
|
-
for (let j = 0; j < line.length; j++) {
|
|
1021
|
-
const seg = line[j];
|
|
1022
|
-
const column = cOffset + seg[COLUMN];
|
|
1023
|
-
if (lineI === stopLine && column >= stopColumn)
|
|
1024
|
-
return;
|
|
1025
|
-
if (seg.length === 1) {
|
|
1026
|
-
out.push([column]);
|
|
1027
|
-
continue;
|
|
1028
|
-
}
|
|
1029
|
-
const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX];
|
|
1030
|
-
const sourceLine = seg[SOURCE_LINE];
|
|
1031
|
-
const sourceColumn = seg[SOURCE_COLUMN];
|
|
1032
|
-
out.push(seg.length === 4 ? [column, sourcesIndex, sourceLine, sourceColumn] : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]);
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
function append(arr, other) {
|
|
1037
|
-
for (let i = 0; i < other.length; i++)
|
|
1038
|
-
arr.push(other[i]);
|
|
1039
|
-
}
|
|
1040
|
-
function getLine(arr, index2) {
|
|
1041
|
-
for (let i = arr.length; i <= index2; i++)
|
|
1042
|
-
arr[i] = [];
|
|
1043
|
-
return arr[index2];
|
|
1044
|
-
}
|
|
1045
|
-
const LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
|
|
1046
|
-
const COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
|
|
1047
|
-
const LEAST_UPPER_BOUND = -1;
|
|
1048
|
-
const GREATEST_LOWER_BOUND = 1;
|
|
1049
|
-
class TraceMap2 {
|
|
1050
|
-
constructor(map, mapUrl) {
|
|
1051
|
-
const isString = typeof map === "string";
|
|
1052
|
-
if (!isString && map._decodedMemo)
|
|
1053
|
-
return map;
|
|
1054
|
-
const parsed = isString ? JSON.parse(map) : map;
|
|
1055
|
-
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
|
|
1056
|
-
this.version = version;
|
|
1057
|
-
this.file = file;
|
|
1058
|
-
this.names = names || [];
|
|
1059
|
-
this.sourceRoot = sourceRoot;
|
|
1060
|
-
this.sources = sources;
|
|
1061
|
-
this.sourcesContent = sourcesContent;
|
|
1062
|
-
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
|
|
1063
|
-
const from = resolve2(sourceRoot || "", stripFilename(mapUrl));
|
|
1064
|
-
this.resolvedSources = sources.map((s) => resolve2(s || "", from));
|
|
1065
|
-
const { mappings } = parsed;
|
|
1066
|
-
if (typeof mappings === "string") {
|
|
1067
|
-
this._encoded = mappings;
|
|
1068
|
-
this._decoded = void 0;
|
|
1069
|
-
} else {
|
|
1070
|
-
this._encoded = void 0;
|
|
1071
|
-
this._decoded = maybeSort(mappings, isString);
|
|
1072
|
-
}
|
|
1073
|
-
this._decodedMemo = memoizedState();
|
|
1074
|
-
this._bySources = void 0;
|
|
1075
|
-
this._bySourceMemos = void 0;
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
function cast(map) {
|
|
1079
|
-
return map;
|
|
1080
|
-
}
|
|
1081
|
-
function encodedMappings(map) {
|
|
1082
|
-
var _a;
|
|
1083
|
-
var _b;
|
|
1084
|
-
return (_a = (_b = cast(map))._encoded) !== null && _a !== void 0 ? _a : _b._encoded = sourcemapCodec.encode(cast(map)._decoded);
|
|
1085
|
-
}
|
|
1086
|
-
function decodedMappings(map) {
|
|
1087
|
-
var _a;
|
|
1088
|
-
return (_a = cast(map))._decoded || (_a._decoded = sourcemapCodec.decode(cast(map)._encoded));
|
|
1089
|
-
}
|
|
1090
|
-
function traceSegment(map, line, column) {
|
|
1091
|
-
const decoded = decodedMappings(map);
|
|
1092
|
-
if (line >= decoded.length)
|
|
1093
|
-
return null;
|
|
1094
|
-
const segments = decoded[line];
|
|
1095
|
-
const index2 = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, GREATEST_LOWER_BOUND);
|
|
1096
|
-
return index2 === -1 ? null : segments[index2];
|
|
1097
|
-
}
|
|
1098
|
-
function originalPositionFor2(map, needle) {
|
|
1099
|
-
let { line, column, bias } = needle;
|
|
1100
|
-
line--;
|
|
1101
|
-
if (line < 0)
|
|
1102
|
-
throw new Error(LINE_GTR_ZERO);
|
|
1103
|
-
if (column < 0)
|
|
1104
|
-
throw new Error(COL_GTR_EQ_ZERO);
|
|
1105
|
-
const decoded = decodedMappings(map);
|
|
1106
|
-
if (line >= decoded.length)
|
|
1107
|
-
return OMapping(null, null, null, null);
|
|
1108
|
-
const segments = decoded[line];
|
|
1109
|
-
const index2 = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
|
|
1110
|
-
if (index2 === -1)
|
|
1111
|
-
return OMapping(null, null, null, null);
|
|
1112
|
-
const segment = segments[index2];
|
|
1113
|
-
if (segment.length === 1)
|
|
1114
|
-
return OMapping(null, null, null, null);
|
|
1115
|
-
const { names, resolvedSources } = map;
|
|
1116
|
-
return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
|
|
1117
|
-
}
|
|
1118
|
-
function generatedPositionFor(map, needle) {
|
|
1119
|
-
const { source, line, column, bias } = needle;
|
|
1120
|
-
return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false);
|
|
1121
|
-
}
|
|
1122
|
-
function allGeneratedPositionsFor(map, needle) {
|
|
1123
|
-
const { source, line, column, bias } = needle;
|
|
1124
|
-
return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true);
|
|
1125
|
-
}
|
|
1126
|
-
function eachMapping(map, cb) {
|
|
1127
|
-
const decoded = decodedMappings(map);
|
|
1128
|
-
const { names, resolvedSources } = map;
|
|
1129
|
-
for (let i = 0; i < decoded.length; i++) {
|
|
1130
|
-
const line = decoded[i];
|
|
1131
|
-
for (let j = 0; j < line.length; j++) {
|
|
1132
|
-
const seg = line[j];
|
|
1133
|
-
const generatedLine = i + 1;
|
|
1134
|
-
const generatedColumn = seg[0];
|
|
1135
|
-
let source = null;
|
|
1136
|
-
let originalLine = null;
|
|
1137
|
-
let originalColumn = null;
|
|
1138
|
-
let name = null;
|
|
1139
|
-
if (seg.length !== 1) {
|
|
1140
|
-
source = resolvedSources[seg[1]];
|
|
1141
|
-
originalLine = seg[2] + 1;
|
|
1142
|
-
originalColumn = seg[3];
|
|
1143
|
-
}
|
|
1144
|
-
if (seg.length === 5)
|
|
1145
|
-
name = names[seg[4]];
|
|
1146
|
-
cb({
|
|
1147
|
-
generatedLine,
|
|
1148
|
-
generatedColumn,
|
|
1149
|
-
source,
|
|
1150
|
-
originalLine,
|
|
1151
|
-
originalColumn,
|
|
1152
|
-
name
|
|
1153
|
-
});
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
function sourceIndex(map, source) {
|
|
1158
|
-
const { sources, resolvedSources } = map;
|
|
1159
|
-
let index2 = sources.indexOf(source);
|
|
1160
|
-
if (index2 === -1)
|
|
1161
|
-
index2 = resolvedSources.indexOf(source);
|
|
1162
|
-
return index2;
|
|
1163
|
-
}
|
|
1164
|
-
function sourceContentFor(map, source) {
|
|
1165
|
-
const { sourcesContent } = map;
|
|
1166
|
-
if (sourcesContent == null)
|
|
1167
|
-
return null;
|
|
1168
|
-
const index2 = sourceIndex(map, source);
|
|
1169
|
-
return index2 === -1 ? null : sourcesContent[index2];
|
|
1170
|
-
}
|
|
1171
|
-
function isIgnored(map, source) {
|
|
1172
|
-
const { ignoreList } = map;
|
|
1173
|
-
if (ignoreList == null)
|
|
1174
|
-
return false;
|
|
1175
|
-
const index2 = sourceIndex(map, source);
|
|
1176
|
-
return index2 === -1 ? false : ignoreList.includes(index2);
|
|
1177
|
-
}
|
|
1178
|
-
function presortedDecodedMap(map, mapUrl) {
|
|
1179
|
-
const tracer = new TraceMap2(clone(map, []), mapUrl);
|
|
1180
|
-
cast(tracer)._decoded = map.mappings;
|
|
1181
|
-
return tracer;
|
|
1182
|
-
}
|
|
1183
|
-
function decodedMap(map) {
|
|
1184
|
-
return clone(map, decodedMappings(map));
|
|
1185
|
-
}
|
|
1186
|
-
function encodedMap(map) {
|
|
1187
|
-
return clone(map, encodedMappings(map));
|
|
1188
|
-
}
|
|
1189
|
-
function clone(map, mappings) {
|
|
1190
|
-
return {
|
|
1191
|
-
version: map.version,
|
|
1192
|
-
file: map.file,
|
|
1193
|
-
names: map.names,
|
|
1194
|
-
sourceRoot: map.sourceRoot,
|
|
1195
|
-
sources: map.sources,
|
|
1196
|
-
sourcesContent: map.sourcesContent,
|
|
1197
|
-
mappings,
|
|
1198
|
-
ignoreList: map.ignoreList || map.x_google_ignoreList
|
|
1199
|
-
};
|
|
1200
|
-
}
|
|
1201
|
-
function OMapping(source, line, column, name) {
|
|
1202
|
-
return { source, line, column, name };
|
|
1203
|
-
}
|
|
1204
|
-
function GMapping(line, column) {
|
|
1205
|
-
return { line, column };
|
|
1206
|
-
}
|
|
1207
|
-
function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
1208
|
-
let index2 = memoizedBinarySearch(segments, column, memo, line);
|
|
1209
|
-
if (found) {
|
|
1210
|
-
index2 = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index2);
|
|
1211
|
-
} else if (bias === LEAST_UPPER_BOUND)
|
|
1212
|
-
index2++;
|
|
1213
|
-
if (index2 === -1 || index2 === segments.length)
|
|
1214
|
-
return -1;
|
|
1215
|
-
return index2;
|
|
1216
|
-
}
|
|
1217
|
-
function sliceGeneratedPositions(segments, memo, line, column, bias) {
|
|
1218
|
-
let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND);
|
|
1219
|
-
if (!found && bias === LEAST_UPPER_BOUND)
|
|
1220
|
-
min++;
|
|
1221
|
-
if (min === -1 || min === segments.length)
|
|
1222
|
-
return [];
|
|
1223
|
-
const matchedColumn = found ? column : segments[min][COLUMN];
|
|
1224
|
-
if (!found)
|
|
1225
|
-
min = lowerBound(segments, matchedColumn, min);
|
|
1226
|
-
const max = upperBound(segments, matchedColumn, min);
|
|
1227
|
-
const result = [];
|
|
1228
|
-
for (; min <= max; min++) {
|
|
1229
|
-
const segment = segments[min];
|
|
1230
|
-
result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]));
|
|
1231
|
-
}
|
|
1232
|
-
return result;
|
|
1233
|
-
}
|
|
1234
|
-
function generatedPosition(map, source, line, column, bias, all) {
|
|
1235
|
-
var _a;
|
|
1236
|
-
line--;
|
|
1237
|
-
if (line < 0)
|
|
1238
|
-
throw new Error(LINE_GTR_ZERO);
|
|
1239
|
-
if (column < 0)
|
|
1240
|
-
throw new Error(COL_GTR_EQ_ZERO);
|
|
1241
|
-
const { sources, resolvedSources } = map;
|
|
1242
|
-
let sourceIndex2 = sources.indexOf(source);
|
|
1243
|
-
if (sourceIndex2 === -1)
|
|
1244
|
-
sourceIndex2 = resolvedSources.indexOf(source);
|
|
1245
|
-
if (sourceIndex2 === -1)
|
|
1246
|
-
return all ? [] : GMapping(null, null);
|
|
1247
|
-
const generated = (_a = cast(map))._bySources || (_a._bySources = buildBySources(decodedMappings(map), cast(map)._bySourceMemos = sources.map(memoizedState)));
|
|
1248
|
-
const segments = generated[sourceIndex2][line];
|
|
1249
|
-
if (segments == null)
|
|
1250
|
-
return all ? [] : GMapping(null, null);
|
|
1251
|
-
const memo = cast(map)._bySourceMemos[sourceIndex2];
|
|
1252
|
-
if (all)
|
|
1253
|
-
return sliceGeneratedPositions(segments, memo, line, column, bias);
|
|
1254
|
-
const index2 = traceSegmentInternal(segments, memo, line, column, bias);
|
|
1255
|
-
if (index2 === -1)
|
|
1256
|
-
return GMapping(null, null);
|
|
1257
|
-
const segment = segments[index2];
|
|
1258
|
-
return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]);
|
|
1259
|
-
}
|
|
1260
|
-
exports2.AnyMap = AnyMap;
|
|
1261
|
-
exports2.GREATEST_LOWER_BOUND = GREATEST_LOWER_BOUND;
|
|
1262
|
-
exports2.LEAST_UPPER_BOUND = LEAST_UPPER_BOUND;
|
|
1263
|
-
exports2.TraceMap = TraceMap2;
|
|
1264
|
-
exports2.allGeneratedPositionsFor = allGeneratedPositionsFor;
|
|
1265
|
-
exports2.decodedMap = decodedMap;
|
|
1266
|
-
exports2.decodedMappings = decodedMappings;
|
|
1267
|
-
exports2.eachMapping = eachMapping;
|
|
1268
|
-
exports2.encodedMap = encodedMap;
|
|
1269
|
-
exports2.encodedMappings = encodedMappings;
|
|
1270
|
-
exports2.generatedPositionFor = generatedPositionFor;
|
|
1271
|
-
exports2.isIgnored = isIgnored;
|
|
1272
|
-
exports2.originalPositionFor = originalPositionFor2;
|
|
1273
|
-
exports2.presortedDecodedMap = presortedDecodedMap;
|
|
1274
|
-
exports2.sourceContentFor = sourceContentFor;
|
|
1275
|
-
exports2.traceSegment = traceSegment;
|
|
1276
|
-
});
|
|
1277
|
-
})(traceMapping_umd$1, traceMapping_umd$1.exports);
|
|
1278
|
-
return traceMapping_umd$1.exports;
|
|
802
|
+
var resolveUri_umdExports = requireResolveUri_umd();
|
|
803
|
+
const resolveUri = /* @__PURE__ */ getDefaultExportFromCjs$1(resolveUri_umdExports);
|
|
804
|
+
function stripFilename(path) {
|
|
805
|
+
if (!path) return "";
|
|
806
|
+
const index2 = path.lastIndexOf("/");
|
|
807
|
+
return path.slice(0, index2 + 1);
|
|
808
|
+
}
|
|
809
|
+
function resolver(mapUrl, sourceRoot) {
|
|
810
|
+
const from = stripFilename(mapUrl);
|
|
811
|
+
const prefix = sourceRoot ? sourceRoot + "/" : "";
|
|
812
|
+
return (source) => resolveUri(prefix + (source || ""), from);
|
|
813
|
+
}
|
|
814
|
+
var COLUMN = 0;
|
|
815
|
+
var SOURCES_INDEX = 1;
|
|
816
|
+
var SOURCE_LINE = 2;
|
|
817
|
+
var SOURCE_COLUMN = 3;
|
|
818
|
+
var NAMES_INDEX = 4;
|
|
819
|
+
function maybeSort(mappings, owned) {
|
|
820
|
+
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
|
|
821
|
+
if (unsortedIndex === mappings.length) return mappings;
|
|
822
|
+
if (!owned) mappings = mappings.slice();
|
|
823
|
+
for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {
|
|
824
|
+
mappings[i] = sortSegments(mappings[i], owned);
|
|
825
|
+
}
|
|
826
|
+
return mappings;
|
|
827
|
+
}
|
|
828
|
+
function nextUnsortedSegmentLine(mappings, start) {
|
|
829
|
+
for (let i = start; i < mappings.length; i++) {
|
|
830
|
+
if (!isSorted(mappings[i])) return i;
|
|
831
|
+
}
|
|
832
|
+
return mappings.length;
|
|
833
|
+
}
|
|
834
|
+
function isSorted(line) {
|
|
835
|
+
for (let j = 1; j < line.length; j++) {
|
|
836
|
+
if (line[j][COLUMN] < line[j - 1][COLUMN]) {
|
|
837
|
+
return false;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
return true;
|
|
841
|
+
}
|
|
842
|
+
function sortSegments(line, owned) {
|
|
843
|
+
if (!owned) line = line.slice();
|
|
844
|
+
return line.sort(sortComparator);
|
|
845
|
+
}
|
|
846
|
+
function sortComparator(a2, b) {
|
|
847
|
+
return a2[COLUMN] - b[COLUMN];
|
|
848
|
+
}
|
|
849
|
+
var found = false;
|
|
850
|
+
function binarySearch(haystack, needle, low, high) {
|
|
851
|
+
while (low <= high) {
|
|
852
|
+
const mid = low + (high - low >> 1);
|
|
853
|
+
const cmp = haystack[mid][COLUMN] - needle;
|
|
854
|
+
if (cmp === 0) {
|
|
855
|
+
found = true;
|
|
856
|
+
return mid;
|
|
857
|
+
}
|
|
858
|
+
if (cmp < 0) {
|
|
859
|
+
low = mid + 1;
|
|
860
|
+
} else {
|
|
861
|
+
high = mid - 1;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
found = false;
|
|
865
|
+
return low - 1;
|
|
866
|
+
}
|
|
867
|
+
function upperBound(haystack, needle, index2) {
|
|
868
|
+
for (let i = index2 + 1; i < haystack.length; index2 = i++) {
|
|
869
|
+
if (haystack[i][COLUMN] !== needle) break;
|
|
870
|
+
}
|
|
871
|
+
return index2;
|
|
872
|
+
}
|
|
873
|
+
function lowerBound(haystack, needle, index2) {
|
|
874
|
+
for (let i = index2 - 1; i >= 0; index2 = i--) {
|
|
875
|
+
if (haystack[i][COLUMN] !== needle) break;
|
|
876
|
+
}
|
|
877
|
+
return index2;
|
|
878
|
+
}
|
|
879
|
+
function memoizedState() {
|
|
880
|
+
return {
|
|
881
|
+
lastKey: -1,
|
|
882
|
+
lastNeedle: -1,
|
|
883
|
+
lastIndex: -1
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
function memoizedBinarySearch(haystack, needle, state, key) {
|
|
887
|
+
const { lastKey, lastNeedle, lastIndex } = state;
|
|
888
|
+
let low = 0;
|
|
889
|
+
let high = haystack.length - 1;
|
|
890
|
+
if (key === lastKey) {
|
|
891
|
+
if (needle === lastNeedle) {
|
|
892
|
+
found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
|
|
893
|
+
return lastIndex;
|
|
894
|
+
}
|
|
895
|
+
if (needle >= lastNeedle) {
|
|
896
|
+
low = lastIndex === -1 ? 0 : lastIndex;
|
|
897
|
+
} else {
|
|
898
|
+
high = lastIndex;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
state.lastKey = key;
|
|
902
|
+
state.lastNeedle = needle;
|
|
903
|
+
return state.lastIndex = binarySearch(haystack, needle, low, high);
|
|
904
|
+
}
|
|
905
|
+
function parse(map) {
|
|
906
|
+
return typeof map === "string" ? JSON.parse(map) : map;
|
|
907
|
+
}
|
|
908
|
+
var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
|
|
909
|
+
var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
|
|
910
|
+
var LEAST_UPPER_BOUND = -1;
|
|
911
|
+
var GREATEST_LOWER_BOUND = 1;
|
|
912
|
+
var TraceMap = class {
|
|
913
|
+
constructor(map, mapUrl) {
|
|
914
|
+
const isString = typeof map === "string";
|
|
915
|
+
if (!isString && map._decodedMemo) return map;
|
|
916
|
+
const parsed = parse(map);
|
|
917
|
+
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
|
|
918
|
+
this.version = version;
|
|
919
|
+
this.file = file;
|
|
920
|
+
this.names = names || [];
|
|
921
|
+
this.sourceRoot = sourceRoot;
|
|
922
|
+
this.sources = sources;
|
|
923
|
+
this.sourcesContent = sourcesContent;
|
|
924
|
+
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
|
|
925
|
+
const resolve2 = resolver(mapUrl, sourceRoot);
|
|
926
|
+
this.resolvedSources = sources.map(resolve2);
|
|
927
|
+
const { mappings } = parsed;
|
|
928
|
+
if (typeof mappings === "string") {
|
|
929
|
+
this._encoded = mappings;
|
|
930
|
+
this._decoded = void 0;
|
|
931
|
+
} else if (Array.isArray(mappings)) {
|
|
932
|
+
this._encoded = void 0;
|
|
933
|
+
this._decoded = maybeSort(mappings, isString);
|
|
934
|
+
} else if (parsed.sections) {
|
|
935
|
+
throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
|
|
936
|
+
} else {
|
|
937
|
+
throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
|
|
938
|
+
}
|
|
939
|
+
this._decodedMemo = memoizedState();
|
|
940
|
+
this._bySources = void 0;
|
|
941
|
+
this._bySourceMemos = void 0;
|
|
942
|
+
}
|
|
943
|
+
};
|
|
944
|
+
function cast(map) {
|
|
945
|
+
return map;
|
|
946
|
+
}
|
|
947
|
+
function decodedMappings(map) {
|
|
948
|
+
var _a;
|
|
949
|
+
return (_a = cast(map))._decoded || (_a._decoded = sourcemapCodec_umdExports.decode(cast(map)._encoded));
|
|
950
|
+
}
|
|
951
|
+
function originalPositionFor(map, needle) {
|
|
952
|
+
let { line, column, bias } = needle;
|
|
953
|
+
line--;
|
|
954
|
+
if (line < 0) throw new Error(LINE_GTR_ZERO);
|
|
955
|
+
if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
|
|
956
|
+
const decoded = decodedMappings(map);
|
|
957
|
+
if (line >= decoded.length) return OMapping(null, null, null, null);
|
|
958
|
+
const segments = decoded[line];
|
|
959
|
+
const index2 = traceSegmentInternal(
|
|
960
|
+
segments,
|
|
961
|
+
cast(map)._decodedMemo,
|
|
962
|
+
line,
|
|
963
|
+
column,
|
|
964
|
+
bias || GREATEST_LOWER_BOUND
|
|
965
|
+
);
|
|
966
|
+
if (index2 === -1) return OMapping(null, null, null, null);
|
|
967
|
+
const segment = segments[index2];
|
|
968
|
+
if (segment.length === 1) return OMapping(null, null, null, null);
|
|
969
|
+
const { names, resolvedSources } = map;
|
|
970
|
+
return OMapping(
|
|
971
|
+
resolvedSources[segment[SOURCES_INDEX]],
|
|
972
|
+
segment[SOURCE_LINE] + 1,
|
|
973
|
+
segment[SOURCE_COLUMN],
|
|
974
|
+
segment.length === 5 ? names[segment[NAMES_INDEX]] : null
|
|
975
|
+
);
|
|
976
|
+
}
|
|
977
|
+
function OMapping(source, line, column, name) {
|
|
978
|
+
return { source, line, column, name };
|
|
979
|
+
}
|
|
980
|
+
function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
981
|
+
let index2 = memoizedBinarySearch(segments, column, memo, line);
|
|
982
|
+
if (found) {
|
|
983
|
+
index2 = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index2);
|
|
984
|
+
} else if (bias === LEAST_UPPER_BOUND) index2++;
|
|
985
|
+
if (index2 === -1 || index2 === segments.length) return -1;
|
|
986
|
+
return index2;
|
|
1279
987
|
}
|
|
1280
|
-
var traceMapping_umdExports = requireTraceMapping_umd();
|
|
1281
988
|
function notNullish(v) {
|
|
1282
989
|
return v != null;
|
|
1283
990
|
}
|
|
@@ -1416,8 +1123,8 @@ function parseStacktrace(stack, options = {}) {
|
|
|
1416
1123
|
if (!map || typeof map !== "object" || !map.version) {
|
|
1417
1124
|
return shouldFilter(ignoreStackEntries, stack2.file) ? null : stack2;
|
|
1418
1125
|
}
|
|
1419
|
-
const traceMap = new
|
|
1420
|
-
const { line, column, source, name } =
|
|
1126
|
+
const traceMap = new TraceMap(map);
|
|
1127
|
+
const { line, column, source, name } = originalPositionFor(traceMap, stack2);
|
|
1421
1128
|
let file = stack2.file;
|
|
1422
1129
|
if (source) {
|
|
1423
1130
|
const fileUrl = stack2.file.startsWith("file://") ? stack2.file : `file://${stack2.file}`;
|
|
@@ -1486,10 +1193,10 @@ class VitestBrowserSnapshotEnvironment {
|
|
|
1486
1193
|
}
|
|
1487
1194
|
let traceMap = this.traceMaps.get(stack.file);
|
|
1488
1195
|
if (!traceMap) {
|
|
1489
|
-
traceMap = new TraceMap(map);
|
|
1196
|
+
traceMap = new TraceMap$1(map);
|
|
1490
1197
|
this.traceMaps.set(stack.file, traceMap);
|
|
1491
1198
|
}
|
|
1492
|
-
const { line, column } = originalPositionFor(traceMap, stack);
|
|
1199
|
+
const { line, column } = originalPositionFor$1(traceMap, stack);
|
|
1493
1200
|
if (line != null && column != null) {
|
|
1494
1201
|
return { ...stack, line, column };
|
|
1495
1202
|
}
|
|
@@ -1602,8 +1309,8 @@ function createBrowserRunner(runnerClass, mocker, state, coverageModule) {
|
|
|
1602
1309
|
if (!map) {
|
|
1603
1310
|
return rpc$2().onTaskAnnotate(test.id, annotation);
|
|
1604
1311
|
}
|
|
1605
|
-
const traceMap = new TraceMap(map);
|
|
1606
|
-
const { line, column, source } = originalPositionFor(traceMap, annotation.location);
|
|
1312
|
+
const traceMap = new TraceMap$1(map);
|
|
1313
|
+
const { line, column, source } = originalPositionFor$1(traceMap, annotation.location);
|
|
1607
1314
|
if (line != null && column != null && source != null) {
|
|
1608
1315
|
let file = annotation.location.file;
|
|
1609
1316
|
if (source) {
|
|
@@ -1695,7 +1402,7 @@ async function getTraceMap(file, sourceMaps) {
|
|
|
1695
1402
|
if (!result) {
|
|
1696
1403
|
return null;
|
|
1697
1404
|
}
|
|
1698
|
-
return new TraceMap(result);
|
|
1405
|
+
return new TraceMap$1(result);
|
|
1699
1406
|
}
|
|
1700
1407
|
async function updateTestFilesLocations(files, sourceMaps) {
|
|
1701
1408
|
const promises2 = files.map(async (file) => {
|
|
@@ -1705,7 +1412,7 @@ async function updateTestFilesLocations(files, sourceMaps) {
|
|
|
1705
1412
|
}
|
|
1706
1413
|
const updateLocation = (task) => {
|
|
1707
1414
|
if (task.location) {
|
|
1708
|
-
const { line, column } = originalPositionFor(traceMap, task.location);
|
|
1415
|
+
const { line, column } = originalPositionFor$1(traceMap, task.location);
|
|
1709
1416
|
if (line != null && column != null) {
|
|
1710
1417
|
task.location = { line, column: task.each ? column : column + 1 };
|
|
1711
1418
|
}
|
|
@@ -3396,7 +3103,7 @@ channel.addEventListener("message", async (e) => {
|
|
|
3396
3103
|
case "execute": {
|
|
3397
3104
|
const { method, files, context } = data;
|
|
3398
3105
|
const state = getWorkerState();
|
|
3399
|
-
const parsedContext = parse(context);
|
|
3106
|
+
const parsedContext = parse$1(context);
|
|
3400
3107
|
state.ctx.providedContext = parsedContext;
|
|
3401
3108
|
state.providedContext = parsedContext;
|
|
3402
3109
|
if (method === "collect") {
|