@rstest/core 0.6.1 → 0.6.2
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/LICENSE.md +0 -14
- package/dist/0~171.js +4 -6
- package/dist/0~204.js +67 -77
- package/dist/0~263.js +1423 -0
- package/dist/0~350.js +30 -373
- package/dist/0~365.js +92 -0
- package/dist/0~463.js +331 -0
- package/dist/0~470.js +382 -0
- package/dist/0~535.js +10 -0
- package/dist/0~607.js +119 -0
- package/dist/0~610.js +10 -0
- package/dist/0~673.js +10 -0
- package/dist/0~691.js +74 -82
- package/dist/0~711.js +30 -373
- package/dist/0~763.js +10 -0
- package/dist/0~764.js +13284 -0
- package/dist/0~814.js +900 -0
- package/dist/0~830.js +1130 -0
- package/dist/0~836.js +13 -21
- package/dist/0~971.js +130 -136
- package/dist/597.js +174 -0
- package/dist/603.js +41 -0
- package/dist/808.js +167 -0
- package/dist/857.js +3252 -0
- package/dist/index.js +2394 -5972
- package/dist/runtime.js +60 -0
- package/dist/worker.js +155 -1389
- package/dist-types/index.d.ts +24 -3
- package/dist-types/worker.d.ts +8 -2
- package/package.json +2 -2
- package/dist/0~33.js +0 -425
- package/dist/0~414.js +0 -16
- package/dist/0~493.js +0 -126
- package/dist/0~603.js +0 -50
- package/dist/0~628.js +0 -1090
- package/dist/0~655.js +0 -11533
- package/dist/0~85.js +0 -1819
- package/dist/0~873.js +0 -1220
- package/dist/0~928.js +0 -1432
- package/dist/0~967.js +0 -99
- /package/dist/{0~928.js.LICENSE.txt → 0~263.js.LICENSE.txt} +0 -0
- /package/dist/{0~655.js.LICENSE.txt → 0~764.js.LICENSE.txt} +0 -0
package/dist/0~836.js
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const pluginCoverageCore = (coverageOptions)=>({
|
|
14
|
-
name: 'rstest:coverage-core',
|
|
15
|
-
setup: (api)=>{
|
|
16
|
-
api.onBeforeDevCompile(({ isFirstCompile })=>{
|
|
17
|
-
if (isFirstCompile && coverageOptions.clean) {
|
|
18
|
-
if (node_fs__WEBPACK_IMPORTED_MODULE_0__["default"].existsSync(coverageOptions.reportsDirectory)) node_fs__WEBPACK_IMPORTED_MODULE_0__["default"].rmSync(coverageOptions.reportsDirectory, {
|
|
19
|
-
recursive: true
|
|
20
|
-
});
|
|
21
|
-
}
|
|
3
|
+
import { __webpack_require__ } from "./runtime.js";
|
|
4
|
+
import "./857.js";
|
|
5
|
+
const external_node_fs_ = __webpack_require__("node:fs");
|
|
6
|
+
const pluginCoverageCore = (coverageOptions)=>({
|
|
7
|
+
name: 'rstest:coverage-core',
|
|
8
|
+
setup: (api)=>{
|
|
9
|
+
api.onBeforeDevCompile(({ isFirstCompile })=>{
|
|
10
|
+
if (isFirstCompile && coverageOptions.clean) {
|
|
11
|
+
if (external_node_fs_["default"].existsSync(coverageOptions.reportsDirectory)) external_node_fs_["default"].rmSync(coverageOptions.reportsDirectory, {
|
|
12
|
+
recursive: true
|
|
22
13
|
});
|
|
23
14
|
}
|
|
24
15
|
});
|
|
25
|
-
|
|
26
|
-
};
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
export { pluginCoverageCore };
|
package/dist/0~971.js
CHANGED
|
@@ -1,144 +1,138 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import { __webpack_require__ } from "./runtime.js";
|
|
4
|
+
import { getTestEntries, getSetupFiles, getTaskNameWithPrefix, prettyTestPath, src_logger } from "./857.js";
|
|
5
|
+
import { prepareRsbuild, createPool, createRsbuildServer } from "./0~814.js";
|
|
6
|
+
const external_node_fs_ = __webpack_require__("node:fs");
|
|
7
|
+
const external_node_path_ = __webpack_require__("node:path");
|
|
8
|
+
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
9
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
10
|
+
async function listTests(context, { filesOnly, json }) {
|
|
11
|
+
const { rootPath } = context;
|
|
12
|
+
const testEntries = {};
|
|
13
|
+
const globTestSourceEntries = async (name)=>{
|
|
14
|
+
if (testEntries[name]) return testEntries[name];
|
|
15
|
+
const { include, exclude, includeSource, root } = context.projects.find((p)=>p.environmentName === name).normalizedConfig;
|
|
16
|
+
const entries = await getTestEntries({
|
|
17
|
+
include,
|
|
18
|
+
exclude: exclude.patterns,
|
|
19
|
+
rootPath,
|
|
20
|
+
projectRoot: root,
|
|
21
|
+
fileFilters: context.fileFilters || [],
|
|
22
|
+
includeSource
|
|
11
23
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
testEntries[name] = entries;
|
|
25
|
+
return entries;
|
|
26
|
+
};
|
|
27
|
+
const setupFiles = Object.fromEntries(context.projects.map((project)=>{
|
|
28
|
+
const { environmentName, rootPath, normalizedConfig: { setupFiles } } = project;
|
|
29
|
+
return [
|
|
30
|
+
environmentName,
|
|
31
|
+
getSetupFiles(setupFiles, rootPath)
|
|
32
|
+
];
|
|
33
|
+
}));
|
|
34
|
+
const rsbuildInstance = await prepareRsbuild(context, globTestSourceEntries, setupFiles);
|
|
35
|
+
const { getRsbuildStats, closeServer } = await createRsbuildServer({
|
|
36
|
+
globTestSourceEntries,
|
|
37
|
+
inspectedConfig: {
|
|
38
|
+
...context.normalizedConfig,
|
|
39
|
+
projects: context.projects.map((p)=>p.normalizedConfig)
|
|
40
|
+
},
|
|
41
|
+
setupFiles,
|
|
42
|
+
rsbuildInstance,
|
|
43
|
+
rootPath
|
|
44
|
+
});
|
|
45
|
+
const pool = await createPool({
|
|
46
|
+
context
|
|
47
|
+
});
|
|
48
|
+
const updateSnapshot = context.snapshotManager.options.updateSnapshot;
|
|
49
|
+
const returns = await Promise.all(context.projects.map(async (project)=>{
|
|
50
|
+
const { entries, setupEntries, getSourceMaps, getAssetFiles, assetNames } = await getRsbuildStats({
|
|
51
|
+
environmentName: project.environmentName
|
|
52
|
+
});
|
|
53
|
+
const list = await pool.collectTests({
|
|
54
|
+
entries,
|
|
55
|
+
setupEntries,
|
|
56
|
+
getAssetFiles,
|
|
57
|
+
getSourceMaps,
|
|
58
|
+
project,
|
|
59
|
+
updateSnapshot
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
list,
|
|
63
|
+
getSourceMaps,
|
|
64
|
+
assetNames
|
|
65
|
+
};
|
|
66
|
+
}));
|
|
67
|
+
const list = returns.flatMap((r)=>r.list);
|
|
68
|
+
const tests = [];
|
|
69
|
+
const traverseTests = (test)=>{
|
|
70
|
+
if ([
|
|
71
|
+
'skip',
|
|
72
|
+
'todo'
|
|
73
|
+
].includes(test.runMode)) return;
|
|
74
|
+
if ('case' === test.type) if (showProject) tests.push({
|
|
75
|
+
file: test.testPath,
|
|
76
|
+
name: getTaskNameWithPrefix(test),
|
|
77
|
+
project: test.project
|
|
78
|
+
});
|
|
79
|
+
else tests.push({
|
|
80
|
+
file: test.testPath,
|
|
81
|
+
name: getTaskNameWithPrefix(test)
|
|
82
|
+
});
|
|
83
|
+
else for (const child of test.tests)traverseTests(child);
|
|
84
|
+
};
|
|
85
|
+
const hasError = list.some((file)=>file.errors?.length);
|
|
86
|
+
const showProject = context.projects.length > 1;
|
|
87
|
+
if (hasError) {
|
|
88
|
+
const { printError } = await import("./index.js").then((mod)=>({
|
|
89
|
+
printError: mod.error_printError
|
|
40
90
|
}));
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
91
|
+
process.exitCode = 1;
|
|
92
|
+
for (const file of list){
|
|
93
|
+
const relativePath = (0, external_node_path_.relative)(rootPath, file.testPath);
|
|
94
|
+
if (file.errors?.length) {
|
|
95
|
+
src_logger.log(`${picocolors_default().bgRed(' FAIL ')} ${relativePath}`);
|
|
96
|
+
for (const error of file.errors)await printError(error, async (name)=>{
|
|
97
|
+
const resource = returns.find((r)=>r.assetNames.includes(name));
|
|
98
|
+
const sourceMap = (await resource?.getSourceMaps([
|
|
99
|
+
name
|
|
100
|
+
]))?.[name];
|
|
101
|
+
return sourceMap ? JSON.parse(sourceMap) : null;
|
|
102
|
+
}, rootPath);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
await closeServer();
|
|
106
|
+
await pool.close();
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
for (const file of list){
|
|
110
|
+
if (filesOnly) {
|
|
111
|
+
if (showProject) tests.push({
|
|
112
|
+
file: file.testPath,
|
|
113
|
+
project: file.project
|
|
51
114
|
});
|
|
52
|
-
|
|
53
|
-
|
|
115
|
+
else tests.push({
|
|
116
|
+
file: file.testPath
|
|
54
117
|
});
|
|
55
|
-
|
|
56
|
-
const returns = await Promise.all(context.projects.map(async (project)=>{
|
|
57
|
-
const { entries, setupEntries, getSourceMaps, getAssetFiles, assetNames } = await getRsbuildStats({
|
|
58
|
-
environmentName: project.environmentName
|
|
59
|
-
});
|
|
60
|
-
const list = await pool.collectTests({
|
|
61
|
-
entries,
|
|
62
|
-
setupEntries,
|
|
63
|
-
getAssetFiles,
|
|
64
|
-
getSourceMaps,
|
|
65
|
-
project,
|
|
66
|
-
updateSnapshot
|
|
67
|
-
});
|
|
68
|
-
return {
|
|
69
|
-
list,
|
|
70
|
-
getSourceMaps,
|
|
71
|
-
assetNames
|
|
72
|
-
};
|
|
73
|
-
}));
|
|
74
|
-
const list = returns.flatMap((r)=>r.list);
|
|
75
|
-
const tests = [];
|
|
76
|
-
const traverseTests = (test)=>{
|
|
77
|
-
if ([
|
|
78
|
-
'skip',
|
|
79
|
-
'todo'
|
|
80
|
-
].includes(test.runMode)) return;
|
|
81
|
-
if ('case' === test.type) if (showProject) tests.push({
|
|
82
|
-
file: test.testPath,
|
|
83
|
-
name: (0, _utils__WEBPACK_IMPORTED_MODULE_3__.fN)(test),
|
|
84
|
-
project: test.project
|
|
85
|
-
});
|
|
86
|
-
else tests.push({
|
|
87
|
-
file: test.testPath,
|
|
88
|
-
name: (0, _utils__WEBPACK_IMPORTED_MODULE_3__.fN)(test)
|
|
89
|
-
});
|
|
90
|
-
else for (const child of test.tests)traverseTests(child);
|
|
91
|
-
};
|
|
92
|
-
const hasError = list.some((file)=>file.errors?.length);
|
|
93
|
-
const showProject = context.projects.length > 1;
|
|
94
|
-
if (hasError) {
|
|
95
|
-
const { printError } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./src/utils/error.ts"));
|
|
96
|
-
process.exitCode = 1;
|
|
97
|
-
for (const file of list){
|
|
98
|
-
const relativePath = (0, node_path__WEBPACK_IMPORTED_MODULE_1__.relative)(rootPath, file.testPath);
|
|
99
|
-
if (file.errors?.length) {
|
|
100
|
-
_utils__WEBPACK_IMPORTED_MODULE_3__.vF.log(`${_utils__WEBPACK_IMPORTED_MODULE_3__.yW.bgRed(' FAIL ')} ${relativePath}`);
|
|
101
|
-
for (const error of file.errors)await printError(error, async (name)=>{
|
|
102
|
-
const resource = returns.find((r)=>r.assetNames.includes(name));
|
|
103
|
-
const sourceMap = (await resource?.getSourceMaps([
|
|
104
|
-
name
|
|
105
|
-
]))?.[name];
|
|
106
|
-
return sourceMap ? JSON.parse(sourceMap) : null;
|
|
107
|
-
}, rootPath);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
await closeServer();
|
|
111
|
-
await pool.close();
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
for (const file of list){
|
|
115
|
-
if (filesOnly) {
|
|
116
|
-
if (showProject) tests.push({
|
|
117
|
-
file: file.testPath,
|
|
118
|
-
project: file.project
|
|
119
|
-
});
|
|
120
|
-
else tests.push({
|
|
121
|
-
file: file.testPath
|
|
122
|
-
});
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
for (const test of file.tests)traverseTests(test);
|
|
126
|
-
}
|
|
127
|
-
if (json && 'false' !== json) {
|
|
128
|
-
const content = JSON.stringify(tests, null, 2);
|
|
129
|
-
if (true !== json && 'true' !== json) {
|
|
130
|
-
const jsonPath = (0, node_path__WEBPACK_IMPORTED_MODULE_1__.isAbsolute)(json) ? json : (0, node_path__WEBPACK_IMPORTED_MODULE_1__.join)(rootPath, json);
|
|
131
|
-
(0, node_fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync)((0, node_path__WEBPACK_IMPORTED_MODULE_1__.dirname)(jsonPath), {
|
|
132
|
-
recursive: true
|
|
133
|
-
});
|
|
134
|
-
(0, node_fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync)(jsonPath, content);
|
|
135
|
-
} else _utils__WEBPACK_IMPORTED_MODULE_3__.vF.log(content);
|
|
136
|
-
} else for (const test of tests){
|
|
137
|
-
const shortPath = (0, node_path__WEBPACK_IMPORTED_MODULE_1__.relative)(rootPath, test.file);
|
|
138
|
-
_utils__WEBPACK_IMPORTED_MODULE_3__.vF.log(test.name ? `${_utils__WEBPACK_IMPORTED_MODULE_3__.yW.dim(`${shortPath} > `)}${test.name}` : (0, _utils__WEBPACK_IMPORTED_MODULE_3__.EQ)(shortPath));
|
|
139
|
-
}
|
|
140
|
-
await closeServer();
|
|
141
|
-
await pool.close();
|
|
118
|
+
continue;
|
|
142
119
|
}
|
|
120
|
+
for (const test of file.tests)traverseTests(test);
|
|
121
|
+
}
|
|
122
|
+
if (json && 'false' !== json) {
|
|
123
|
+
const content = JSON.stringify(tests, null, 2);
|
|
124
|
+
if (true !== json && 'true' !== json) {
|
|
125
|
+
const jsonPath = (0, external_node_path_.isAbsolute)(json) ? json : (0, external_node_path_.join)(rootPath, json);
|
|
126
|
+
(0, external_node_fs_.mkdirSync)((0, external_node_path_.dirname)(jsonPath), {
|
|
127
|
+
recursive: true
|
|
128
|
+
});
|
|
129
|
+
(0, external_node_fs_.writeFileSync)(jsonPath, content);
|
|
130
|
+
} else src_logger.log(content);
|
|
131
|
+
} else for (const test of tests){
|
|
132
|
+
const shortPath = (0, external_node_path_.relative)(rootPath, test.file);
|
|
133
|
+
src_logger.log(test.name ? `${picocolors_default().dim(`${shortPath} > `)}${test.name}` : prettyTestPath(shortPath));
|
|
143
134
|
}
|
|
144
|
-
|
|
135
|
+
await closeServer();
|
|
136
|
+
await pool.close();
|
|
137
|
+
}
|
|
138
|
+
export { listTests };
|
package/dist/597.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
var comma = ",".charCodeAt(0);
|
|
4
|
+
var semicolon = ";".charCodeAt(0);
|
|
5
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
6
|
+
var intToChar = new Uint8Array(64);
|
|
7
|
+
var charToInt = new Uint8Array(128);
|
|
8
|
+
for(let i = 0; i < chars.length; i++){
|
|
9
|
+
const c = chars.charCodeAt(i);
|
|
10
|
+
intToChar[i] = c;
|
|
11
|
+
charToInt[c] = i;
|
|
12
|
+
}
|
|
13
|
+
function decodeInteger(reader, relative) {
|
|
14
|
+
let value = 0;
|
|
15
|
+
let shift = 0;
|
|
16
|
+
let integer = 0;
|
|
17
|
+
do {
|
|
18
|
+
const c = reader.next();
|
|
19
|
+
integer = charToInt[c];
|
|
20
|
+
value |= (31 & integer) << shift;
|
|
21
|
+
shift += 5;
|
|
22
|
+
}while (32 & integer);
|
|
23
|
+
const shouldNegate = 1 & value;
|
|
24
|
+
value >>>= 1;
|
|
25
|
+
if (shouldNegate) value = -2147483648 | -value;
|
|
26
|
+
return relative + value;
|
|
27
|
+
}
|
|
28
|
+
function encodeInteger(builder, num, relative) {
|
|
29
|
+
let delta = num - relative;
|
|
30
|
+
delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
|
|
31
|
+
do {
|
|
32
|
+
let clamped = 31 & delta;
|
|
33
|
+
delta >>>= 5;
|
|
34
|
+
if (delta > 0) clamped |= 32;
|
|
35
|
+
builder.write(intToChar[clamped]);
|
|
36
|
+
}while (delta > 0);
|
|
37
|
+
return num;
|
|
38
|
+
}
|
|
39
|
+
function hasMoreVlq(reader, max) {
|
|
40
|
+
if (reader.pos >= max) return false;
|
|
41
|
+
return reader.peek() !== comma;
|
|
42
|
+
}
|
|
43
|
+
var bufLength = 16384;
|
|
44
|
+
var td = "undefined" != typeof TextDecoder ? /* @__PURE__ */ new TextDecoder() : "undefined" != typeof Buffer ? {
|
|
45
|
+
decode (buf) {
|
|
46
|
+
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
47
|
+
return out.toString();
|
|
48
|
+
}
|
|
49
|
+
} : {
|
|
50
|
+
decode (buf) {
|
|
51
|
+
let out = "";
|
|
52
|
+
for(let i = 0; i < buf.length; i++)out += String.fromCharCode(buf[i]);
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var StringWriter = class {
|
|
57
|
+
constructor(){
|
|
58
|
+
this.pos = 0;
|
|
59
|
+
this.out = "";
|
|
60
|
+
this.buffer = new Uint8Array(bufLength);
|
|
61
|
+
}
|
|
62
|
+
write(v) {
|
|
63
|
+
const { buffer } = this;
|
|
64
|
+
buffer[this.pos++] = v;
|
|
65
|
+
if (this.pos === bufLength) {
|
|
66
|
+
this.out += td.decode(buffer);
|
|
67
|
+
this.pos = 0;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
flush() {
|
|
71
|
+
const { buffer, out, pos } = this;
|
|
72
|
+
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
var StringReader = class {
|
|
76
|
+
constructor(buffer){
|
|
77
|
+
this.pos = 0;
|
|
78
|
+
this.buffer = buffer;
|
|
79
|
+
}
|
|
80
|
+
next() {
|
|
81
|
+
return this.buffer.charCodeAt(this.pos++);
|
|
82
|
+
}
|
|
83
|
+
peek() {
|
|
84
|
+
return this.buffer.charCodeAt(this.pos);
|
|
85
|
+
}
|
|
86
|
+
indexOf(char) {
|
|
87
|
+
const { buffer, pos } = this;
|
|
88
|
+
const idx = buffer.indexOf(char, pos);
|
|
89
|
+
return -1 === idx ? buffer.length : idx;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
function decode(mappings) {
|
|
93
|
+
const { length } = mappings;
|
|
94
|
+
const reader = new StringReader(mappings);
|
|
95
|
+
const decoded = [];
|
|
96
|
+
let genColumn = 0;
|
|
97
|
+
let sourcesIndex = 0;
|
|
98
|
+
let sourceLine = 0;
|
|
99
|
+
let sourceColumn = 0;
|
|
100
|
+
let namesIndex = 0;
|
|
101
|
+
do {
|
|
102
|
+
const semi = reader.indexOf(";");
|
|
103
|
+
const line = [];
|
|
104
|
+
let sorted = true;
|
|
105
|
+
let lastCol = 0;
|
|
106
|
+
genColumn = 0;
|
|
107
|
+
while(reader.pos < semi){
|
|
108
|
+
let seg;
|
|
109
|
+
genColumn = decodeInteger(reader, genColumn);
|
|
110
|
+
if (genColumn < lastCol) sorted = false;
|
|
111
|
+
lastCol = genColumn;
|
|
112
|
+
if (hasMoreVlq(reader, semi)) {
|
|
113
|
+
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
|
114
|
+
sourceLine = decodeInteger(reader, sourceLine);
|
|
115
|
+
sourceColumn = decodeInteger(reader, sourceColumn);
|
|
116
|
+
if (hasMoreVlq(reader, semi)) {
|
|
117
|
+
namesIndex = decodeInteger(reader, namesIndex);
|
|
118
|
+
seg = [
|
|
119
|
+
genColumn,
|
|
120
|
+
sourcesIndex,
|
|
121
|
+
sourceLine,
|
|
122
|
+
sourceColumn,
|
|
123
|
+
namesIndex
|
|
124
|
+
];
|
|
125
|
+
} else seg = [
|
|
126
|
+
genColumn,
|
|
127
|
+
sourcesIndex,
|
|
128
|
+
sourceLine,
|
|
129
|
+
sourceColumn
|
|
130
|
+
];
|
|
131
|
+
} else seg = [
|
|
132
|
+
genColumn
|
|
133
|
+
];
|
|
134
|
+
line.push(seg);
|
|
135
|
+
reader.pos++;
|
|
136
|
+
}
|
|
137
|
+
if (!sorted) sort(line);
|
|
138
|
+
decoded.push(line);
|
|
139
|
+
reader.pos = semi + 1;
|
|
140
|
+
}while (reader.pos <= length);
|
|
141
|
+
return decoded;
|
|
142
|
+
}
|
|
143
|
+
function sort(line) {
|
|
144
|
+
line.sort(sortComparator);
|
|
145
|
+
}
|
|
146
|
+
function sortComparator(a, b) {
|
|
147
|
+
return a[0] - b[0];
|
|
148
|
+
}
|
|
149
|
+
function encode(decoded) {
|
|
150
|
+
const writer = new StringWriter();
|
|
151
|
+
let sourcesIndex = 0;
|
|
152
|
+
let sourceLine = 0;
|
|
153
|
+
let sourceColumn = 0;
|
|
154
|
+
let namesIndex = 0;
|
|
155
|
+
for(let i = 0; i < decoded.length; i++){
|
|
156
|
+
const line = decoded[i];
|
|
157
|
+
if (i > 0) writer.write(semicolon);
|
|
158
|
+
if (0 === line.length) continue;
|
|
159
|
+
let genColumn = 0;
|
|
160
|
+
for(let j = 0; j < line.length; j++){
|
|
161
|
+
const segment = line[j];
|
|
162
|
+
if (j > 0) writer.write(comma);
|
|
163
|
+
genColumn = encodeInteger(writer, segment[0], genColumn);
|
|
164
|
+
if (1 !== segment.length) {
|
|
165
|
+
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
|
166
|
+
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
|
167
|
+
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
|
168
|
+
if (4 !== segment.length) namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return writer.flush();
|
|
173
|
+
}
|
|
174
|
+
export { decode, encode };
|
package/dist/603.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import { __webpack_require__ } from "./runtime.js";
|
|
4
|
+
import { external_node_module_createRequire } from "./857.js";
|
|
5
|
+
import { pathToFileURL } from "./808.js";
|
|
6
|
+
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
7
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
8
|
+
const CoverageProviderMap = {
|
|
9
|
+
istanbul: '@rstest/coverage-istanbul'
|
|
10
|
+
};
|
|
11
|
+
const loadCoverageProvider = async (options, root)=>{
|
|
12
|
+
const rootPath = pathToFileURL(root).toString();
|
|
13
|
+
const moduleName = CoverageProviderMap[options.provider || 'istanbul'];
|
|
14
|
+
if (!moduleName) throw new Error(`Unknown coverage provider: ${options.provider}`);
|
|
15
|
+
try {
|
|
16
|
+
const require = external_node_module_createRequire(rootPath);
|
|
17
|
+
const modulePath = require.resolve(moduleName, {
|
|
18
|
+
paths: [
|
|
19
|
+
rootPath
|
|
20
|
+
]
|
|
21
|
+
});
|
|
22
|
+
const { pluginCoverage, CoverageProvider } = await import(pathToFileURL(modulePath).toString());
|
|
23
|
+
return {
|
|
24
|
+
pluginCoverage,
|
|
25
|
+
CoverageProvider
|
|
26
|
+
};
|
|
27
|
+
} catch {
|
|
28
|
+
const error = new Error(`Failed to load coverage provider module: ${picocolors_default().cyan(moduleName)} in ${picocolors_default().underline(root)}, please make sure it is installed.\n`);
|
|
29
|
+
error.stack = '';
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
async function createCoverageProvider(options, root) {
|
|
34
|
+
if (!options.enabled) return null;
|
|
35
|
+
if (!options.provider || CoverageProviderMap[options.provider]) {
|
|
36
|
+
const { CoverageProvider } = await loadCoverageProvider(options, root);
|
|
37
|
+
return new CoverageProvider(options);
|
|
38
|
+
}
|
|
39
|
+
throw new Error(`Unknown coverage provider: ${options.provider}`);
|
|
40
|
+
}
|
|
41
|
+
export { createCoverageProvider, loadCoverageProvider };
|