@rstest/core 0.8.4 → 0.9.0
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/{0~9348.js → 0~1240.js} +41 -41
- package/dist/0~1472.js +2 -2
- package/dist/0~2173.js +84 -71
- package/dist/{0~3919.js → 0~262.js} +31 -30
- package/dist/0~3062.js +1 -1
- package/dist/0~3346.js +1 -1
- package/dist/0~6923.js +1 -1
- package/dist/0~7882.js +23 -22
- package/dist/0~89.js +32 -29
- package/dist/0~9634.js +5 -5
- package/dist/1294.js +2 -1
- package/dist/3160.js +3 -48
- package/dist/{9869.js → 4597.js} +33 -44
- package/dist/6151.js +108 -31
- package/dist/9131.js +30 -15
- package/dist/browser-runtime/389.js +144 -92
- package/dist/browser-runtime/index.d.ts +40 -10
- package/dist/browser.d.ts +53 -10
- package/dist/index.d.ts +41 -79
- package/dist/mockRuntimeCode.js +15 -4
- package/dist/worker.d.ts +13 -1521
- package/dist/worker.js +14 -34
- package/package.json +14 -13
package/dist/worker.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
|
-
import { basename, isAbsolute,
|
|
3
|
+
import { basename, isAbsolute, color, dirname, resolve as pathe_M_eThtNZ_resolve, join } from "./3160.js";
|
|
4
4
|
import "./487.js";
|
|
5
|
-
import {
|
|
5
|
+
import { createWorkerMetaMessage, createBirpc } from "./4597.js";
|
|
6
6
|
import { createCoverageProvider } from "./5734.js";
|
|
7
7
|
import { formatTestError, setRealTimers, getRealTimers } from "./1294.js";
|
|
8
8
|
import { globalApis } from "./1157.js";
|
|
9
9
|
const processSend = process.send.bind(process);
|
|
10
10
|
const processOn = process.on.bind(process);
|
|
11
11
|
const processOff = process.off.bind(process);
|
|
12
|
-
function createForksRpcOptions({
|
|
12
|
+
function createForksRpcOptions({ dispose = [] }) {
|
|
13
13
|
return {
|
|
14
|
-
serialize: nodeV8.serialize,
|
|
15
|
-
deserialize: (v)=>nodeV8.deserialize(Buffer.from(v)),
|
|
16
14
|
post (v) {
|
|
17
15
|
processSend(v);
|
|
18
16
|
},
|
|
@@ -26,30 +24,10 @@ function createForksRpcOptions({ nodeV8 = node_v8, dispose = [] }) {
|
|
|
26
24
|
}
|
|
27
25
|
};
|
|
28
26
|
}
|
|
29
|
-
function createRuntimeRpc(options,
|
|
30
|
-
const rpc =
|
|
27
|
+
function createRuntimeRpc(options, createBirpcImpl = createBirpc) {
|
|
28
|
+
const rpc = createBirpcImpl({}, {
|
|
31
29
|
...options,
|
|
32
|
-
|
|
33
|
-
switch(functionName){
|
|
34
|
-
case 'onTestCaseStart':
|
|
35
|
-
{
|
|
36
|
-
const caseTest = error[0];
|
|
37
|
-
console.error(`[Rstest] timeout on calling "onTestCaseStart" rpc method (Case: "${caseTest.name}")`);
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
case 'onTestCaseResult':
|
|
41
|
-
{
|
|
42
|
-
const caseResult = error[0];
|
|
43
|
-
console.error(`[Rstest] timeout on calling "onTestCaseResult" rpc method (Case: "${caseResult.name}", Result: "${caseResult.status}")`);
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
case 'onConsoleLog':
|
|
47
|
-
originalConsole.error(`[Rstest] timeout on calling "onConsoleLog" rpc method (Original log: ${error[0].content})`);
|
|
48
|
-
return true;
|
|
49
|
-
default:
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
30
|
+
timeout: -1
|
|
53
31
|
});
|
|
54
32
|
return {
|
|
55
33
|
rpc
|
|
@@ -132,16 +110,12 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, updateSnapshot,
|
|
|
132
110
|
});
|
|
133
111
|
globalCleanups.length = 0;
|
|
134
112
|
setRealTimers();
|
|
135
|
-
context.runtimeConfig = undoSerializableConfig(context.runtimeConfig);
|
|
136
113
|
process.env.RSTEST_WORKER_ID = String(process.__tinypool_state__.workerId || context.taskId);
|
|
137
114
|
const cleanupFns = [];
|
|
138
|
-
const originalConsole = global.console;
|
|
139
115
|
const disposeFns = [];
|
|
140
116
|
const { rpc } = createRuntimeRpc(createForksRpcOptions({
|
|
141
117
|
dispose: disposeFns
|
|
142
|
-
})
|
|
143
|
-
originalConsole
|
|
144
|
-
});
|
|
118
|
+
}));
|
|
145
119
|
globalCleanups.push(()=>{
|
|
146
120
|
disposeFns.forEach((fn)=>{
|
|
147
121
|
fn();
|
|
@@ -403,7 +377,13 @@ const runInPool = async (options)=>{
|
|
|
403
377
|
}
|
|
404
378
|
if (coverageProvider) {
|
|
405
379
|
const coverageMap = coverageProvider.collect();
|
|
406
|
-
if (coverageMap)
|
|
380
|
+
if (coverageMap) {
|
|
381
|
+
results.coverage = {};
|
|
382
|
+
Object.entries(coverageMap.toJSON()).forEach(([key, value])=>{
|
|
383
|
+
if ('toJSON' in value) results.coverage[key] = value.toJSON();
|
|
384
|
+
else results.coverage[key] = value;
|
|
385
|
+
});
|
|
386
|
+
}
|
|
407
387
|
coverageProvider.cleanup();
|
|
408
388
|
}
|
|
409
389
|
return results;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rstest/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "The Rsbuild-based test tool.",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rstest/issues"
|
|
@@ -54,19 +54,19 @@
|
|
|
54
54
|
"importMeta.d.ts"
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@rsbuild/core": "^
|
|
57
|
+
"@rsbuild/core": "^2.0.0-beta.6",
|
|
58
58
|
"@types/chai": "^5.2.3",
|
|
59
|
-
"tinypool": "^
|
|
59
|
+
"tinypool": "^2.1.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@babel/code-frame": "^7.
|
|
63
|
-
"@clack/prompts": "^0.
|
|
62
|
+
"@babel/code-frame": "^7.29.0",
|
|
63
|
+
"@clack/prompts": "^0.11.0",
|
|
64
64
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
65
|
-
"@microsoft/api-extractor": "^7.
|
|
66
|
-
"@rsbuild/plugin-node-polyfill": "^1.
|
|
67
|
-
"@rslib/core": "^0.19.
|
|
65
|
+
"@microsoft/api-extractor": "^7.57.6",
|
|
66
|
+
"@rsbuild/plugin-node-polyfill": "^1.4.4",
|
|
67
|
+
"@rslib/core": "^0.19.6",
|
|
68
68
|
"@sinonjs/fake-timers": "^15.1.0",
|
|
69
|
-
"@types/babel__code-frame": "^7.0
|
|
69
|
+
"@types/babel__code-frame": "^7.27.0",
|
|
70
70
|
"@types/istanbul-lib-coverage": "^2.0.6",
|
|
71
71
|
"@types/istanbul-lib-report": "^3.0.3",
|
|
72
72
|
"@types/istanbul-reports": "^3.0.4",
|
|
@@ -76,14 +76,14 @@
|
|
|
76
76
|
"@types/source-map-support": "^0.5.10",
|
|
77
77
|
"@vitest/expect": "^3.2.4",
|
|
78
78
|
"@vitest/snapshot": "^3.2.4",
|
|
79
|
-
"birpc": "
|
|
79
|
+
"birpc": "^4.0.0",
|
|
80
80
|
"cac": "^6.7.14",
|
|
81
81
|
"chai": "^5.3.3",
|
|
82
82
|
"chokidar": "^4.0.3",
|
|
83
|
-
"happy-dom": "^20.0
|
|
83
|
+
"happy-dom": "^20.7.0",
|
|
84
84
|
"jest-diff": "^30.2.0",
|
|
85
85
|
"jsdom": "^26.1.0",
|
|
86
|
-
"memfs": "^4.
|
|
86
|
+
"memfs": "^4.56.10",
|
|
87
87
|
"package-manager-detector": "^1.6.0",
|
|
88
88
|
"pathe": "^2.0.3",
|
|
89
89
|
"picocolors": "^1.1.1",
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
"tinyspy": "^4.0.4",
|
|
99
99
|
"url-extras": "^0.1.0",
|
|
100
100
|
"webpack-license-plugin": "^4.5.1",
|
|
101
|
+
"webpack": "^5.105.2",
|
|
101
102
|
"@rstest/browser-ui": "0.0.0",
|
|
102
103
|
"@rstest/tsconfig": "0.0.1"
|
|
103
104
|
},
|
|
@@ -114,7 +115,7 @@
|
|
|
114
115
|
}
|
|
115
116
|
},
|
|
116
117
|
"engines": {
|
|
117
|
-
"node": ">=
|
|
118
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
118
119
|
},
|
|
119
120
|
"publishConfig": {
|
|
120
121
|
"access": "public",
|