@rstest/core 0.9.1 → 0.9.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/LICENSE.md +1 -1
- package/dist/{0~89.js → 0~8843.js} +24 -28
- package/dist/{0~1472.js → 0~browserLoader.js} +11 -11
- package/dist/{0~7882.js → 0~browser~1.js} +60 -61
- package/dist/{0~8426.js → 0~checkThresholds.js} +6 -6
- package/dist/{0~7583.js → 0~chokidar.js} +113 -72
- package/dist/{0~130.js → 0~console.js} +19 -20
- package/dist/{0~9744.js → 0~dist.js} +57 -57
- package/dist/{0~4403.js → 0~generate.js} +9 -6
- package/dist/{0~4809.js → 0~happyDom.js} +2 -2
- package/dist/{0~3346.js → 0~interop.js} +0 -1
- package/dist/{0~62.js → 0~jsdom.js} +2 -2
- package/dist/{0~262.js → 0~lib.js} +4 -1
- package/dist/{0~9634.js → 0~listTests.js} +15 -24
- package/dist/{0~6923.js → 0~loadEsModule.js} +7 -7
- package/dist/{0~5835.js → 0~loadModule.js} +11 -11
- package/dist/{0~6907.js → 0~magic-string.es.js} +2 -1
- package/dist/0~mergeReports.js +127 -0
- package/dist/{0~2255.js → 0~plugin.js} +2 -4
- package/dist/{0~6588.js → 0~restart.js} +8 -12
- package/dist/{0~2173.js → 0~runTests.js} +51 -60
- package/dist/{487.js → 1255.js} +22 -15
- package/dist/{6151.js → 1949.js} +41 -25
- package/dist/{6973.js → 255.js} +9 -10
- package/dist/{9131.js → 3145.js} +229 -479
- package/dist/{1157.js → 4411.js} +37 -37
- package/dist/{4484.js → 5040.js} +1 -2
- package/dist/{3160.js → 6830.js} +429 -106
- package/dist/7011.js +1 -1
- package/dist/{1294.js → 7552.js} +106 -83
- package/dist/{5734.js → 7704.js} +7 -6
- package/dist/browser-runtime/{2~907.js → 2~magic-string.es.js} +18 -11
- package/dist/browser-runtime/{389.js → 723.js} +178 -134
- package/dist/browser-runtime/{389.js.LICENSE.txt → 723.js.LICENSE.txt} +0 -22
- package/dist/browser-runtime/index.d.ts +40 -5
- package/dist/browser-runtime/index.js +1 -1
- package/dist/browser-runtime/rslib-runtime.js +11 -3
- package/dist/browser.d.ts +40 -5
- package/dist/browser.js +9 -7
- package/dist/globalSetupWorker.js +7 -14
- package/dist/index.d.ts +53 -6
- package/dist/index.js +2 -2
- package/dist/rslib-runtime.js +5 -8
- package/dist/worker.d.ts +30 -3
- package/dist/worker.js +20 -46
- package/package.json +19 -18
- package/dist/3160.js.LICENSE.txt +0 -21
- package/dist/4881.js +0 -2
- package/dist/6198.js +0 -2
- /package/dist/{0~7583.js.LICENSE.txt → 0~chokidar.js.LICENSE.txt} +0 -0
- /package/dist/{0~3062.js → 0~utils.js} +0 -0
- /package/dist/{6151.js.LICENSE.txt → 1949.js.LICENSE.txt} +0 -0
- /package/dist/{4597.js → 1983.js} +0 -0
- /package/dist/{1294.js.LICENSE.txt → 7552.js.LICENSE.txt} +0 -0
package/dist/worker.d.ts
CHANGED
|
@@ -2,6 +2,14 @@ import type { config } from 'chai';
|
|
|
2
2
|
import type { RsbuildConfig } from '@rsbuild/core';
|
|
3
3
|
import type { Writable } from 'node:stream';
|
|
4
4
|
|
|
5
|
+
declare type BlobReporterOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* Directory to store blob report files.
|
|
8
|
+
* @default '.rstest-reports'
|
|
9
|
+
*/
|
|
10
|
+
outputDir?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
5
13
|
declare interface BranchMapping {
|
|
6
14
|
loc: Range_2;
|
|
7
15
|
type: string;
|
|
@@ -52,6 +60,13 @@ declare type BrowserModeConfig = {
|
|
|
52
60
|
* @default false
|
|
53
61
|
*/
|
|
54
62
|
strictPort?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Provider-specific config passed through to the selected browser provider.
|
|
65
|
+
*
|
|
66
|
+
* Use provider-owned types or helpers in user config when you want richer
|
|
67
|
+
* IntelliSense for this field.
|
|
68
|
+
*/
|
|
69
|
+
providerOptions?: Record<string, unknown>;
|
|
55
70
|
};
|
|
56
71
|
|
|
57
72
|
/**
|
|
@@ -68,7 +83,7 @@ declare type BrowserViewport = {
|
|
|
68
83
|
height: number;
|
|
69
84
|
} | DevicePreset;
|
|
70
85
|
|
|
71
|
-
declare type BuiltInReporterNames = 'default' | 'verbose' | 'md' | 'github-actions' | 'junit';
|
|
86
|
+
declare type BuiltInReporterNames = 'default' | 'verbose' | 'md' | 'github-actions' | 'junit' | 'blob';
|
|
72
87
|
|
|
73
88
|
declare type BuiltinReporterOptions = {
|
|
74
89
|
default: DefaultReporterOptions;
|
|
@@ -76,6 +91,7 @@ declare type BuiltinReporterOptions = {
|
|
|
76
91
|
md: MdReporterOptions;
|
|
77
92
|
'github-actions': Record<string, unknown>;
|
|
78
93
|
junit: Record<string, unknown>;
|
|
94
|
+
blob: BlobReporterOptions;
|
|
79
95
|
};
|
|
80
96
|
|
|
81
97
|
declare type ChaiConfig = Partial<Omit<typeof config, 'useProxy' | 'proxyExcludedKeys' | 'deepEqual'>>;
|
|
@@ -253,6 +269,12 @@ declare type CoverageOptions = {
|
|
|
253
269
|
* @default false
|
|
254
270
|
*/
|
|
255
271
|
reportOnFailure?: boolean;
|
|
272
|
+
/**
|
|
273
|
+
* Whether to collect coverage for source files outside the project root directory.
|
|
274
|
+
* This is useful in monorepo setups where tests import modules from sibling packages.
|
|
275
|
+
* @default false
|
|
276
|
+
*/
|
|
277
|
+
allowExternal?: boolean;
|
|
256
278
|
};
|
|
257
279
|
|
|
258
280
|
declare type CoverageThreshold = {
|
|
@@ -567,6 +589,7 @@ declare type NormalizedBrowserModeConfig = {
|
|
|
567
589
|
port?: number;
|
|
568
590
|
strictPort: boolean;
|
|
569
591
|
viewport?: BrowserViewport;
|
|
592
|
+
providerOptions: Record<string, unknown>;
|
|
570
593
|
};
|
|
571
594
|
|
|
572
595
|
declare type NormalizedConfig = Required<Omit<RstestConfig, OptionalKeys | 'pool' | 'projects' | 'coverage' | 'setupFiles' | 'globalSetup' | 'exclude' | 'testEnvironment' | 'browser'>> & Partial<Pick<RstestConfig, OptionalKeys>> & {
|
|
@@ -766,13 +789,13 @@ declare type RoObject<T> = {
|
|
|
766
789
|
[K in keyof T]: T[K] | Ro<T[K]>;
|
|
767
790
|
};
|
|
768
791
|
|
|
769
|
-
declare type RstestCommand = 'watch' | 'run' | 'list';
|
|
792
|
+
declare type RstestCommand = 'watch' | 'run' | 'list' | 'merge-reports';
|
|
770
793
|
|
|
771
794
|
declare interface RstestConfig {
|
|
772
795
|
/**
|
|
773
796
|
* Extend configuration from adapters
|
|
774
797
|
*/
|
|
775
|
-
extends?: ExtendConfigFn | ExtendConfig;
|
|
798
|
+
extends?: ExtendConfigFn | ExtendConfig | (ExtendConfigFn | ExtendConfig)[];
|
|
776
799
|
/**
|
|
777
800
|
* Project root
|
|
778
801
|
*
|
|
@@ -1031,6 +1054,10 @@ declare type RstestContext = {
|
|
|
1031
1054
|
reporters: Reporter[];
|
|
1032
1055
|
snapshotManager: SnapshotManager;
|
|
1033
1056
|
stateManager: TestStateManager;
|
|
1057
|
+
reporterResults: {
|
|
1058
|
+
results: TestFileResult[];
|
|
1059
|
+
testResults: TestResult[];
|
|
1060
|
+
};
|
|
1034
1061
|
};
|
|
1035
1062
|
|
|
1036
1063
|
declare type RstestPoolOptions = {
|
package/dist/worker.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
5
|
-
import { createWorkerMetaMessage, createBirpc } from "./
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { existsSync, promises } from "node:fs";
|
|
4
|
+
import "./1255.js";
|
|
5
|
+
import { createWorkerMetaMessage, createBirpc } from "./1983.js";
|
|
6
|
+
import { basename, isAbsolute, color as logger_color, dirname, resolve as pathe_M_eThtNZ_resolve, join } from "./6830.js";
|
|
7
|
+
import { createCoverageProvider } from "./7704.js";
|
|
8
|
+
import { formatTestError, setRealTimers, getRealTimers } from "./7552.js";
|
|
9
|
+
import { globalApis } from "./4411.js";
|
|
9
10
|
const processSend = process.send.bind(process);
|
|
10
11
|
const processOn = process.on.bind(process);
|
|
11
12
|
const processOff = process.off.bind(process);
|
|
@@ -33,7 +34,6 @@ function createRuntimeRpc(options, createBirpcImpl = createBirpc) {
|
|
|
33
34
|
rpc
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
|
-
const external_node_fs_ = __webpack_require__("node:fs");
|
|
37
37
|
class NodeSnapshotEnvironment {
|
|
38
38
|
constructor(options = {}){
|
|
39
39
|
this.options = options;
|
|
@@ -51,22 +51,22 @@ class NodeSnapshotEnvironment {
|
|
|
51
51
|
return join(join(dirname(filepath), this.options.snapshotsDirName ?? "__snapshots__"), `${basename(filepath)}.snap`);
|
|
52
52
|
}
|
|
53
53
|
async prepareDirectory(dirPath) {
|
|
54
|
-
await
|
|
54
|
+
await promises.mkdir(dirPath, {
|
|
55
55
|
recursive: true
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
async saveSnapshotFile(filepath, snapshot) {
|
|
59
|
-
await
|
|
59
|
+
await promises.mkdir(dirname(filepath), {
|
|
60
60
|
recursive: true
|
|
61
61
|
});
|
|
62
|
-
await
|
|
62
|
+
await promises.writeFile(filepath, snapshot, "utf-8");
|
|
63
63
|
}
|
|
64
64
|
async readSnapshotFile(filepath) {
|
|
65
|
-
if (!
|
|
66
|
-
return
|
|
65
|
+
if (!existsSync(filepath)) return null;
|
|
66
|
+
return promises.readFile(filepath, "utf-8");
|
|
67
67
|
}
|
|
68
68
|
async removeSnapshotFile(filepath) {
|
|
69
|
-
if (
|
|
69
|
+
if (existsSync(filepath)) await promises.unlink(filepath);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
class RstestSnapshotEnvironment extends NodeSnapshotEnvironment {
|
|
@@ -128,9 +128,7 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, updateSnapshot,
|
|
|
128
128
|
const { runtimeConfig: { globals, printConsoleTrace, disableConsoleIntercept, testEnvironment, snapshotFormat, env } } = context;
|
|
129
129
|
setupEnv(env);
|
|
130
130
|
if (!disableConsoleIntercept) {
|
|
131
|
-
const { createCustomConsole } = await import("./0~
|
|
132
|
-
createCustomConsole: mod.createCustomConsole
|
|
133
|
-
}));
|
|
131
|
+
const { createCustomConsole } = await import("./0~console.js");
|
|
134
132
|
global.console = createCustomConsole({
|
|
135
133
|
rpc,
|
|
136
134
|
testPath,
|
|
@@ -151,15 +149,13 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, updateSnapshot,
|
|
|
151
149
|
testPath,
|
|
152
150
|
environment: 'node'
|
|
153
151
|
};
|
|
154
|
-
const { createRstestRuntime } = await import("./
|
|
155
|
-
createRstestRuntime: mod.createRstestRuntime
|
|
156
|
-
}));
|
|
152
|
+
const { createRstestRuntime } = await import("./1949.js");
|
|
157
153
|
const unhandledErrors = [];
|
|
158
154
|
const handleError = (e, type)=>{
|
|
159
155
|
const error = 'string' == typeof e ? new Error(e) : e;
|
|
160
156
|
error.name = type;
|
|
161
157
|
if (isTeardown) {
|
|
162
|
-
error.stack = `${
|
|
158
|
+
error.stack = `${logger_color.yellow('Caught error after test environment was torn down:')}\n\n${error.stack}`;
|
|
163
159
|
console.error(error);
|
|
164
160
|
} else {
|
|
165
161
|
console.error(error);
|
|
@@ -180,18 +176,14 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, updateSnapshot,
|
|
|
180
176
|
break;
|
|
181
177
|
case 'jsdom':
|
|
182
178
|
{
|
|
183
|
-
const { environment } = await import("./0~
|
|
184
|
-
environment: mod.environment
|
|
185
|
-
}));
|
|
179
|
+
const { environment } = await import("./0~jsdom.js");
|
|
186
180
|
const { teardown } = await environment.setup(global, testEnvironment.options || {});
|
|
187
181
|
cleanupFns.push(()=>teardown(global));
|
|
188
182
|
break;
|
|
189
183
|
}
|
|
190
184
|
case 'happy-dom':
|
|
191
185
|
{
|
|
192
|
-
const { environment } = await import("./0~
|
|
193
|
-
environment: mod.environment
|
|
194
|
-
}));
|
|
186
|
+
const { environment } = await import("./0~happyDom.js");
|
|
195
187
|
const { teardown } = await environment.setup(global, testEnvironment.options || {});
|
|
196
188
|
cleanupFns.push(async ()=>teardown(global));
|
|
197
189
|
break;
|
|
@@ -219,16 +211,7 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, updateSnapshot,
|
|
|
219
211
|
};
|
|
220
212
|
};
|
|
221
213
|
const loadFiles = async ({ setupEntries, assetFiles, rstestContext, distPath, testPath, interopDefault, isolate, outputModule })=>{
|
|
222
|
-
const { loadModule } = outputModule ? await import("./0~
|
|
223
|
-
EsmMode: mod.loadEsModule_EsmMode,
|
|
224
|
-
asModule: mod.asModule,
|
|
225
|
-
clearModuleCache: mod.clearModuleCache,
|
|
226
|
-
loadModule: mod.loadModule
|
|
227
|
-
})) : await import("./0~5835.js").then((mod)=>({
|
|
228
|
-
cacheableLoadModule: mod.cacheableLoadModule,
|
|
229
|
-
clearModuleCache: mod.clearModuleCache,
|
|
230
|
-
loadModule: mod.loadModule
|
|
231
|
-
}));
|
|
214
|
+
const { loadModule } = outputModule ? await import("./0~loadEsModule.js") : await import("./0~loadModule.js");
|
|
232
215
|
if (!isolate) await loadModule({
|
|
233
216
|
codeContent: `if (global && typeof global.__rstest_clean_core_cache__ === 'function') {
|
|
234
217
|
global.__rstest_clean_core_cache__();
|
|
@@ -281,16 +264,7 @@ const runInPool = async (options)=>{
|
|
|
281
264
|
await new Promise((resolve)=>getRealTimers().setTimeout(resolve));
|
|
282
265
|
await Promise.all(cleanups.map((fn)=>fn()));
|
|
283
266
|
if (!isolate) {
|
|
284
|
-
const { clearModuleCache } = options.context.outputModule ? await import("./0~
|
|
285
|
-
EsmMode: mod.loadEsModule_EsmMode,
|
|
286
|
-
asModule: mod.asModule,
|
|
287
|
-
clearModuleCache: mod.clearModuleCache,
|
|
288
|
-
loadModule: mod.loadModule
|
|
289
|
-
})) : await import("./0~5835.js").then((mod)=>({
|
|
290
|
-
cacheableLoadModule: mod.cacheableLoadModule,
|
|
291
|
-
clearModuleCache: mod.clearModuleCache,
|
|
292
|
-
loadModule: mod.loadModule
|
|
293
|
-
}));
|
|
267
|
+
const { clearModuleCache } = options.context.outputModule ? await import("./0~loadEsModule.js") : await import("./0~loadModule.js");
|
|
294
268
|
clearModuleCache();
|
|
295
269
|
}
|
|
296
270
|
isTeardown = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rstest/core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"description": "The Rsbuild-based test tool.",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rstest/issues"
|
|
@@ -54,20 +54,20 @@
|
|
|
54
54
|
"importMeta.d.ts"
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@rsbuild/core": "
|
|
57
|
+
"@rsbuild/core": "2.0.0-beta.9",
|
|
58
58
|
"@types/chai": "^5.2.3",
|
|
59
59
|
"tinypool": "^2.1.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@rsbuild/plugin-less": "^1.6.0",
|
|
63
|
-
"@rsbuild/plugin-sass": "^1.5.0",
|
|
64
62
|
"@babel/code-frame": "^7.29.0",
|
|
65
63
|
"@clack/prompts": "^1.1.0",
|
|
66
64
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
67
|
-
"@microsoft/api-extractor": "^7.57.
|
|
65
|
+
"@microsoft/api-extractor": "^7.57.7",
|
|
66
|
+
"@rsbuild/plugin-less": "^1.6.2",
|
|
68
67
|
"@rsbuild/plugin-node-polyfill": "^1.4.4",
|
|
69
|
-
"@
|
|
70
|
-
"@
|
|
68
|
+
"@rsbuild/plugin-sass": "^1.5.1",
|
|
69
|
+
"@rslib/core": "0.20.0",
|
|
70
|
+
"@sinonjs/fake-timers": "^15.1.1",
|
|
71
71
|
"@types/babel__code-frame": "^7.27.0",
|
|
72
72
|
"@types/istanbul-lib-coverage": "^2.0.6",
|
|
73
73
|
"@types/istanbul-lib-report": "^3.0.3",
|
|
@@ -76,36 +76,37 @@
|
|
|
76
76
|
"@types/picomatch": "^4.0.2",
|
|
77
77
|
"@types/sinonjs__fake-timers": "^8.1.5",
|
|
78
78
|
"@types/source-map-support": "^0.5.10",
|
|
79
|
+
"@typescript/native-preview": "7.0.0-dev.20260317.1",
|
|
79
80
|
"@vitest/expect": "^3.2.4",
|
|
80
81
|
"@vitest/snapshot": "^3.2.4",
|
|
81
82
|
"birpc": "^4.0.0",
|
|
82
83
|
"cac": "^7.0.0",
|
|
83
84
|
"chai": "^6.2.2",
|
|
84
|
-
"chokidar": "^
|
|
85
|
-
"happy-dom": "^20.
|
|
86
|
-
"jest-diff": "^30.
|
|
87
|
-
"jsdom": "^
|
|
88
|
-
"memfs": "^4.56.
|
|
85
|
+
"chokidar": "^5.0.0",
|
|
86
|
+
"happy-dom": "^20.8.4",
|
|
87
|
+
"jest-diff": "^30.3.0",
|
|
88
|
+
"jsdom": "^28.1.0",
|
|
89
|
+
"memfs": "^4.56.11",
|
|
89
90
|
"package-manager-detector": "^1.6.0",
|
|
90
91
|
"pathe": "^2.0.3",
|
|
91
92
|
"picocolors": "^1.1.1",
|
|
92
93
|
"picomatch": "^4.0.3",
|
|
93
|
-
"pretty-format": "^30.
|
|
94
|
-
"rslog": "^2.0.
|
|
94
|
+
"pretty-format": "^30.3.0",
|
|
95
|
+
"rslog": "^2.0.1",
|
|
95
96
|
"source-map-support": "^0.5.21",
|
|
96
97
|
"stacktrace-parser": "0.1.11",
|
|
97
|
-
"std-env": "^
|
|
98
|
-
"strip-ansi": "^7.
|
|
98
|
+
"std-env": "^4.0.0",
|
|
99
|
+
"strip-ansi": "^7.2.0",
|
|
99
100
|
"tinyglobby": "^0.2.15",
|
|
100
101
|
"tinyspy": "^4.0.4",
|
|
101
102
|
"url-extras": "^0.1.0",
|
|
103
|
+
"webpack": "^5.105.4",
|
|
102
104
|
"webpack-license-plugin": "^4.5.1",
|
|
103
|
-
"webpack": "^5.105.2",
|
|
104
105
|
"@rstest/browser-ui": "0.0.0",
|
|
105
106
|
"@rstest/tsconfig": "0.0.1"
|
|
106
107
|
},
|
|
107
108
|
"peerDependencies": {
|
|
108
|
-
"happy-dom": "
|
|
109
|
+
"happy-dom": "^20.8.3",
|
|
109
110
|
"jsdom": "*"
|
|
110
111
|
},
|
|
111
112
|
"peerDependenciesMeta": {
|
package/dist/3160.js.LICENSE.txt
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright 2017 Vercel, Inc.
|
|
3
|
-
*
|
|
4
|
-
* This file is derived from Vercel's detect-agent:
|
|
5
|
-
* https://github.com/vercel/vercel/tree/main/packages/detect-agent
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
* you may not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*
|
|
19
|
-
* Modifications in this derived work:
|
|
20
|
-
* - Removed async determine logic, kept only env detection.
|
|
21
|
-
*/
|
package/dist/4881.js
DELETED
package/dist/6198.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|