@rstest/core 0.8.1 → 0.8.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/0~130.js +1 -2
- package/dist/0~1472.js +2 -3
- package/dist/0~1981.js +1 -2
- package/dist/0~2173.js +65 -27
- package/dist/0~2255.js +1 -2
- package/dist/0~3062.js +1 -2
- package/dist/0~3346.js +1 -2
- package/dist/0~3919.js +1 -2
- package/dist/0~4403.js +4 -4
- package/dist/0~4809.js +1 -2
- package/dist/0~5835.js +1 -2
- package/dist/0~62.js +1 -2
- package/dist/0~6588.js +4 -4
- package/dist/0~6907.js +1 -2
- package/dist/0~6923.js +1 -2
- package/dist/0~7583.js +1 -2
- package/dist/0~7882.js +7 -579
- package/dist/0~8426.js +1 -2
- package/dist/0~89.js +16 -12
- package/dist/0~9348.js +1 -2
- package/dist/0~9634.js +21 -8
- package/dist/1157.js +48 -97
- package/dist/1294.js +1 -2
- package/dist/1672.js +1 -2
- package/dist/3160.js +111 -8
- package/dist/3216.js +1 -2
- package/dist/4397.js +1 -2
- package/dist/4484.js +1 -2
- package/dist/487.js +1 -2
- package/dist/4881.js +1 -2
- package/dist/4899.js +2 -2
- package/dist/5734.js +1 -2
- package/dist/6151.js +13 -10
- package/dist/6198.js +1 -2
- package/dist/6973.js +1 -2
- package/dist/7011.js +1 -2
- package/dist/721.js +1 -2
- package/dist/9131.js +1329 -27
- package/dist/browser-runtime/2~907.js +0 -2
- package/dist/browser-runtime/389.js +14 -11
- package/dist/browser-runtime/389.js.LICENSE.txt +22 -0
- package/dist/browser-runtime/index.d.ts +100 -111
- package/dist/browser-runtime/rslib-runtime.js +0 -2
- package/dist/browser.d.ts +156 -110
- package/dist/browser.js +2 -2
- package/dist/globalSetupWorker.js +1 -2
- package/dist/index.d.ts +100 -110
- package/dist/index.js +1 -2
- package/dist/mockRuntimeCode.js +63 -174
- package/dist/rslib-runtime.js +1 -2
- package/dist/worker.d.ts +99 -110
- package/dist/worker.js +1 -2
- package/package.json +4 -4
- package/dist/browser-runtime/2~907.js.map +0 -1
- package/dist/browser-runtime/389.js.map +0 -1
- package/dist/browser-runtime/rslib-runtime.js.map +0 -1
- /package/dist/{1157.js.LICENSE.txt → 3160.js.LICENSE.txt} +0 -0
package/dist/mockRuntimeCode.js
CHANGED
|
@@ -28,187 +28,76 @@ __webpack_require__.rstest_unmock = (id)=>{
|
|
|
28
28
|
__webpack_require__.rstest_do_unmock = __webpack_require__.rstest_unmock;
|
|
29
29
|
__webpack_require__.rstest_require_actual = __webpack_require__.rstest_import_actual = (id)=>{
|
|
30
30
|
const originalModule = __webpack_require__.rstest_original_modules[id];
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
requiredModule = __webpack_require__(id);
|
|
38
|
-
} catch {} finally{
|
|
39
|
-
__webpack_require__.rstest_original_modules[id] = requiredModule;
|
|
40
|
-
__webpack_require__.rstest_original_module_factories[id] = __webpack_modules__[id];
|
|
41
|
-
}
|
|
42
|
-
if (modFactory && 'object' == typeof modFactory) {
|
|
43
|
-
const isSpy = true === modFactory.spy;
|
|
44
|
-
const isMock = true === modFactory.mock;
|
|
45
|
-
if (!isSpy && !isMock) throw new Error('[Rstest] rs.mock() options must be { spy: true } or { mock: true }');
|
|
46
|
-
if (!requiredModule) {
|
|
47
|
-
const optionName = isSpy ? 'spy' : 'mock';
|
|
48
|
-
throw new Error(`[Rstest] rs.mock('${id}', { ${optionName}: true }) failed: cannot load original module`);
|
|
49
|
-
}
|
|
50
|
-
const originalModule = requiredModule;
|
|
51
|
-
const isEsModule = true === originalModule.__esModule;
|
|
52
|
-
const mockedModule = globalThis.RSTEST_API?.rstest?.mockObject(originalModule, {
|
|
53
|
-
spy: isSpy
|
|
54
|
-
}) || originalModule;
|
|
55
|
-
const finalModFactory = function(__unused_webpack_module, __webpack_exports__, __webpack_require__1) {
|
|
56
|
-
__webpack_require__1.r(__webpack_exports__);
|
|
57
|
-
for(const key in mockedModule)__webpack_require__1.d(__webpack_exports__, {
|
|
58
|
-
[key]: ()=>mockedModule[key]
|
|
59
|
-
});
|
|
60
|
-
if (!isEsModule && !('default' in mockedModule)) __webpack_require__1.d(__webpack_exports__, {
|
|
61
|
-
default: ()=>mockedModule
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
__webpack_modules__[id] = finalModFactory;
|
|
65
|
-
delete __webpack_module_cache__[id];
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if ('string' == typeof modFactory || 'number' == typeof modFactory) __webpack_module_cache__[id] = {
|
|
69
|
-
exports: __webpack_require__(modFactory)
|
|
70
|
-
};
|
|
71
|
-
else if ('function' == typeof modFactory) {
|
|
72
|
-
const finalModFactory = function(__unused_webpack_module, __webpack_exports__, __webpack_require__1) {
|
|
73
|
-
__webpack_require__1.r(__webpack_exports__);
|
|
74
|
-
const res = modFactory();
|
|
75
|
-
for(const key in res)__webpack_require__1.d(__webpack_exports__, {
|
|
76
|
-
[key]: ()=>res[key]
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
__webpack_modules__[id] = finalModFactory;
|
|
80
|
-
delete __webpack_module_cache__[id];
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
__webpack_require__.rstest_mock_require = (id, modFactory)=>{
|
|
84
|
-
let requiredModule;
|
|
85
|
-
try {
|
|
86
|
-
requiredModule = __webpack_require__(id);
|
|
87
|
-
} catch {} finally{
|
|
88
|
-
__webpack_require__.rstest_original_modules[id] = requiredModule;
|
|
89
|
-
__webpack_require__.rstest_original_module_factories[id] = __webpack_modules__[id];
|
|
90
|
-
}
|
|
91
|
-
if (modFactory && 'object' == typeof modFactory) {
|
|
92
|
-
const isSpy = true === modFactory.spy;
|
|
93
|
-
const isMock = true === modFactory.mock;
|
|
94
|
-
if (!isSpy && !isMock) throw new Error('[Rstest] rs.mockRequire() options must be { spy: true } or { mock: true }');
|
|
95
|
-
if (!requiredModule) {
|
|
96
|
-
const optionName = isSpy ? 'spy' : 'mock';
|
|
97
|
-
throw new Error(`[Rstest] rs.mockRequire('${id}', { ${optionName}: true }) failed: cannot load original module`);
|
|
98
|
-
}
|
|
99
|
-
const originalModule = requiredModule;
|
|
100
|
-
const isEsModule = true === originalModule.__esModule;
|
|
101
|
-
const mockedModule = globalThis.RSTEST_API?.rstest?.mockObject(originalModule, {
|
|
102
|
-
spy: isSpy
|
|
103
|
-
}) || originalModule;
|
|
104
|
-
if (isEsModule) __webpack_require__.r(mockedModule);
|
|
105
|
-
else if (!('default' in mockedModule)) mockedModule.default = mockedModule;
|
|
106
|
-
__webpack_module_cache__[id] = {
|
|
107
|
-
exports: mockedModule,
|
|
108
|
-
id,
|
|
109
|
-
loaded: true
|
|
110
|
-
};
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
if ('string' == typeof modFactory || 'number' == typeof modFactory) __webpack_module_cache__[id] = {
|
|
114
|
-
exports: __webpack_require__(modFactory)
|
|
115
|
-
};
|
|
116
|
-
else if ('function' == typeof modFactory) {
|
|
117
|
-
const exports = modFactory();
|
|
118
|
-
__webpack_require__.r(exports);
|
|
119
|
-
__webpack_module_cache__[id] = {
|
|
120
|
-
exports,
|
|
121
|
-
id,
|
|
122
|
-
loaded: true
|
|
31
|
+
if (originalModule) return originalModule;
|
|
32
|
+
if (id in __webpack_require__.rstest_original_module_factories) {
|
|
33
|
+
const mod = __webpack_require__.rstest_original_module_factories[id];
|
|
34
|
+
const moduleInstance = {
|
|
35
|
+
exports: {}
|
|
123
36
|
};
|
|
37
|
+
mod(moduleInstance, moduleInstance.exports, __webpack_require__);
|
|
38
|
+
__webpack_require__.rstest_original_modules[id] = moduleInstance.exports;
|
|
39
|
+
return moduleInstance.exports;
|
|
124
40
|
}
|
|
41
|
+
return __webpack_require__(id);
|
|
125
42
|
};
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
__webpack_require__.rstest_original_module_factories[id] = __webpack_modules__[id];
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
43
|
+
const getMockImplementation = (mockType = 'mock')=>(id, modFactory)=>{
|
|
44
|
+
let requiredModule = __webpack_module_cache__[id]?.exports;
|
|
45
|
+
const wasAlreadyLoaded = !!requiredModule;
|
|
46
|
+
if (requiredModule) {
|
|
47
|
+
__webpack_require__.rstest_original_modules[id] = requiredModule;
|
|
48
|
+
__webpack_require__.rstest_original_module_factories[id] = __webpack_modules__[id];
|
|
49
|
+
} else __webpack_require__.rstest_original_module_factories[id] = __webpack_modules__[id];
|
|
50
|
+
if (modFactory && 'object' == typeof modFactory) {
|
|
51
|
+
const isSpy = true === modFactory.spy;
|
|
52
|
+
const isMock = true === modFactory.mock;
|
|
53
|
+
if (!isSpy && !isMock) throw new Error(`[Rstest] rs.${mockType}() options must be { spy: true } or { mock: true }`);
|
|
54
|
+
if (!wasAlreadyLoaded) try {
|
|
55
|
+
requiredModule = __webpack_require__(id);
|
|
56
|
+
} catch {
|
|
57
|
+
const optionName = isSpy ? 'spy' : 'mock';
|
|
58
|
+
throw new Error(`[Rstest] rs.${mockType}('${id}', { ${optionName}: true }) failed: cannot load original module`);
|
|
59
|
+
}
|
|
60
|
+
if (!requiredModule) {
|
|
61
|
+
const optionName = isSpy ? 'spy' : 'mock';
|
|
62
|
+
throw new Error(`[Rstest] rs.${mockType}('${id}', { ${optionName}: true }) failed: cannot load original module`);
|
|
63
|
+
}
|
|
64
|
+
const originalModule = requiredModule;
|
|
65
|
+
const isEsModule = true === originalModule.__esModule;
|
|
66
|
+
const mockedModule = globalThis.RSTEST_API?.rstest?.mockObject(originalModule, {
|
|
67
|
+
spy: isSpy
|
|
68
|
+
}) || originalModule;
|
|
69
|
+
const finalModFactory = function(__unused_webpack_module, __webpack_exports__, __webpack_require__1) {
|
|
70
|
+
__webpack_require__1.r(__webpack_exports__);
|
|
71
|
+
for(const key in mockedModule)__webpack_require__1.d(__webpack_exports__, {
|
|
72
|
+
[key]: ()=>mockedModule[key]
|
|
73
|
+
});
|
|
74
|
+
if (!isEsModule && !('default' in mockedModule)) __webpack_require__1.d(__webpack_exports__, {
|
|
75
|
+
default: ()=>mockedModule
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
__webpack_modules__[id] = finalModFactory;
|
|
79
|
+
delete __webpack_module_cache__[id];
|
|
80
|
+
return;
|
|
141
81
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const mockedModule = globalThis.RSTEST_API?.rstest?.mockObject(originalModule, {
|
|
145
|
-
spy: isSpy
|
|
146
|
-
}) || originalModule;
|
|
147
|
-
if (isEsModule) __webpack_require__.r(mockedModule);
|
|
148
|
-
else if (!('default' in mockedModule)) mockedModule.default = mockedModule;
|
|
149
|
-
__webpack_module_cache__[id] = {
|
|
150
|
-
exports: mockedModule,
|
|
151
|
-
id,
|
|
152
|
-
loaded: true
|
|
153
|
-
};
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
if ('string' == typeof modFactory || 'number' == typeof modFactory) __webpack_module_cache__[id] = {
|
|
157
|
-
exports: __webpack_require__(modFactory)
|
|
158
|
-
};
|
|
159
|
-
else if ('function' == typeof modFactory) {
|
|
160
|
-
const exports = modFactory();
|
|
161
|
-
__webpack_require__.r(exports);
|
|
162
|
-
__webpack_module_cache__[id] = {
|
|
163
|
-
exports,
|
|
164
|
-
id,
|
|
165
|
-
loaded: true
|
|
82
|
+
if ('string' == typeof modFactory || 'number' == typeof modFactory) __webpack_module_cache__[id] = {
|
|
83
|
+
exports: __webpack_require__(modFactory)
|
|
166
84
|
};
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if (modFactory && 'object' == typeof modFactory) {
|
|
178
|
-
const isSpy = true === modFactory.spy;
|
|
179
|
-
const isMock = true === modFactory.mock;
|
|
180
|
-
if (!isSpy && !isMock) throw new Error('[Rstest] rs.doMockRequire() options must be { spy: true } or { mock: true }');
|
|
181
|
-
if (!requiredModule) {
|
|
182
|
-
const optionName = isSpy ? 'spy' : 'mock';
|
|
183
|
-
throw new Error(`[Rstest] rs.doMockRequire('${id}', { ${optionName}: true }) failed: cannot load original module`);
|
|
85
|
+
else if ('function' == typeof modFactory) {
|
|
86
|
+
const finalModFactory = function(__unused_webpack_module, __webpack_exports__, __webpack_require__1) {
|
|
87
|
+
__webpack_require__1.r(__webpack_exports__);
|
|
88
|
+
const res = modFactory();
|
|
89
|
+
for(const key in res)__webpack_require__1.d(__webpack_exports__, {
|
|
90
|
+
[key]: ()=>res[key]
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
__webpack_modules__[id] = finalModFactory;
|
|
94
|
+
delete __webpack_module_cache__[id];
|
|
184
95
|
}
|
|
185
|
-
const originalModule = requiredModule;
|
|
186
|
-
const isEsModule = true === originalModule.__esModule;
|
|
187
|
-
const mockedModule = globalThis.RSTEST_API?.rstest?.mockObject(originalModule, {
|
|
188
|
-
spy: isSpy
|
|
189
|
-
}) || originalModule;
|
|
190
|
-
if (isEsModule) __webpack_require__.r(mockedModule);
|
|
191
|
-
else if (!('default' in mockedModule)) mockedModule.default = mockedModule;
|
|
192
|
-
__webpack_module_cache__[id] = {
|
|
193
|
-
exports: mockedModule,
|
|
194
|
-
id,
|
|
195
|
-
loaded: true
|
|
196
|
-
};
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
if ('string' == typeof modFactory || 'number' == typeof modFactory) __webpack_module_cache__[id] = {
|
|
200
|
-
exports: __webpack_require__(modFactory)
|
|
201
96
|
};
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
exports,
|
|
207
|
-
id,
|
|
208
|
-
loaded: true
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
};
|
|
97
|
+
__webpack_require__.rstest_mock = getMockImplementation('mock');
|
|
98
|
+
__webpack_require__.rstest_mock_require = getMockImplementation('mockRequire');
|
|
99
|
+
__webpack_require__.rstest_do_mock = getMockImplementation('doMock');
|
|
100
|
+
__webpack_require__.rstest_do_mock_require = getMockImplementation('doMockRequire');
|
|
212
101
|
__webpack_require__.rstest_reset_modules = ()=>{
|
|
213
102
|
const mockedIds = Object.keys(__webpack_require__.rstest_original_modules);
|
|
214
103
|
Object.keys(__webpack_module_cache__).forEach((id)=>{
|
package/dist/rslib-runtime.js
CHANGED
package/dist/worker.d.ts
CHANGED
|
@@ -299,11 +299,14 @@ declare type BrowserModeConfig = {
|
|
|
299
299
|
*/
|
|
300
300
|
declare type BrowserName = 'chromium' | 'firefox' | 'webkit';
|
|
301
301
|
|
|
302
|
-
declare type BuiltInReporterNames =
|
|
302
|
+
declare type BuiltInReporterNames = 'default' | 'verbose' | 'md' | 'github-actions' | 'junit';
|
|
303
303
|
|
|
304
304
|
declare type BuiltinReporterOptions = {
|
|
305
305
|
default: DefaultReporterOptions;
|
|
306
306
|
verbose: VerboseReporterOptions;
|
|
307
|
+
md: MdReporterOptions;
|
|
308
|
+
'github-actions': Record<string, unknown>;
|
|
309
|
+
junit: Record<string, unknown>;
|
|
307
310
|
};
|
|
308
311
|
|
|
309
312
|
declare type ChaiConfig = Partial<Omit<typeof config, 'useProxy' | 'proxyExcludedKeys' | 'deepEqual'>>;
|
|
@@ -592,40 +595,6 @@ declare class DefaultMap<
|
|
|
592
595
|
get(key: K): V;
|
|
593
596
|
}
|
|
594
597
|
|
|
595
|
-
declare class DefaultReporter implements Reporter {
|
|
596
|
-
protected rootPath: string;
|
|
597
|
-
protected config: NormalizedConfig;
|
|
598
|
-
private options;
|
|
599
|
-
protected statusRenderer: StatusRenderer | undefined;
|
|
600
|
-
private testState;
|
|
601
|
-
constructor({ rootPath, options, config, testState, }: {
|
|
602
|
-
rootPath: string;
|
|
603
|
-
config: NormalizedConfig;
|
|
604
|
-
options: DefaultReporterOptions;
|
|
605
|
-
testState: RstestTestState;
|
|
606
|
-
});
|
|
607
|
-
/**
|
|
608
|
-
* Lazily create StatusRenderer on first test file start.
|
|
609
|
-
* This avoids intercepting stdout/stderr before tests actually begin,
|
|
610
|
-
* ensuring early errors (like missing Playwright browsers) remain visible.
|
|
611
|
-
*/
|
|
612
|
-
private ensureStatusRenderer;
|
|
613
|
-
onTestFileStart(): void;
|
|
614
|
-
onTestFileResult(test: TestFileResult): void;
|
|
615
|
-
onTestCaseResult(): void;
|
|
616
|
-
onUserConsoleLog(log: UserConsoleLog): void;
|
|
617
|
-
onExit(): Promise<void>;
|
|
618
|
-
onTestRunEnd({ results, testResults, duration, getSourcemap, snapshotSummary, filterRerunTestPaths, unhandledErrors, }: {
|
|
619
|
-
results: TestFileResult[];
|
|
620
|
-
testResults: TestResult[];
|
|
621
|
-
duration: Duration;
|
|
622
|
-
snapshotSummary: SnapshotSummary;
|
|
623
|
-
getSourcemap: GetSourcemap;
|
|
624
|
-
unhandledErrors?: Error[];
|
|
625
|
-
filterRerunTestPaths?: string[];
|
|
626
|
-
}): Promise<void>;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
598
|
declare type DefaultReporterOptions = {
|
|
630
599
|
/**
|
|
631
600
|
* prints out summary of all tests
|
|
@@ -894,26 +863,6 @@ declare function getMatcherUtils(): {
|
|
|
894
863
|
|
|
895
864
|
declare type GetSourcemap = (sourcePath: string) => Promise<SourceMapInput | null>;
|
|
896
865
|
|
|
897
|
-
declare class GithubActionsReporter {
|
|
898
|
-
private onWritePath;
|
|
899
|
-
private rootPath;
|
|
900
|
-
constructor({ options, rootPath, }: {
|
|
901
|
-
rootPath: string;
|
|
902
|
-
options: {
|
|
903
|
-
onWritePath: (path: string) => string;
|
|
904
|
-
};
|
|
905
|
-
});
|
|
906
|
-
private log;
|
|
907
|
-
onTestRunEnd({ results, testResults, getSourcemap, }: {
|
|
908
|
-
results: TestFileResult[];
|
|
909
|
-
testResults: TestResult[];
|
|
910
|
-
duration: Duration;
|
|
911
|
-
snapshotSummary: SnapshotSummary;
|
|
912
|
-
getSourcemap: GetSourcemap;
|
|
913
|
-
filterRerunTestPaths?: string[];
|
|
914
|
-
}): Promise<void>;
|
|
915
|
-
}
|
|
916
|
-
|
|
917
866
|
declare interface HtmlOptions {
|
|
918
867
|
verbose: boolean;
|
|
919
868
|
skipEmpty: boolean;
|
|
@@ -1339,28 +1288,6 @@ declare type JsonOptions = FileOptions;
|
|
|
1339
1288
|
|
|
1340
1289
|
declare type JsonSummaryOptions = FileOptions;
|
|
1341
1290
|
|
|
1342
|
-
declare class JUnitReporter implements Reporter {
|
|
1343
|
-
private rootPath;
|
|
1344
|
-
private outputPath?;
|
|
1345
|
-
constructor({ rootPath, options: { outputPath }, }: {
|
|
1346
|
-
rootPath: string;
|
|
1347
|
-
options?: {
|
|
1348
|
-
outputPath?: string;
|
|
1349
|
-
};
|
|
1350
|
-
});
|
|
1351
|
-
private sanitizeXml;
|
|
1352
|
-
private escapeXml;
|
|
1353
|
-
private createJUnitTestCase;
|
|
1354
|
-
private createJUnitTestSuite;
|
|
1355
|
-
private generateJUnitXml;
|
|
1356
|
-
onTestRunEnd({ results, testResults, duration, getSourcemap, }: {
|
|
1357
|
-
getSourcemap: GetSourcemap;
|
|
1358
|
-
results: TestFileResult[];
|
|
1359
|
-
testResults: TestResult[];
|
|
1360
|
-
duration: Duration;
|
|
1361
|
-
}): Promise<void>;
|
|
1362
|
-
}
|
|
1363
|
-
|
|
1364
1291
|
declare interface LcovOnlyOptions extends FileOptions, ProjectOptions {}
|
|
1365
1292
|
|
|
1366
1293
|
declare interface LcovOptions extends FileOptions, ProjectOptions {}
|
|
@@ -1437,6 +1364,91 @@ declare interface MatcherState_2 extends MatcherState {
|
|
|
1437
1364
|
|
|
1438
1365
|
declare type MaybePromise<T> = T | Promise<T>;
|
|
1439
1366
|
|
|
1367
|
+
declare type MdReporterOptions = {
|
|
1368
|
+
/**
|
|
1369
|
+
* Output detail level preset.
|
|
1370
|
+
* - `'normal'`: balanced output with code frames, repro commands, and candidate files
|
|
1371
|
+
* - `'compact'`: minimal output without code frames, candidate files, or full stack traces
|
|
1372
|
+
* - `'full'`: verbose output including console logs and environment info
|
|
1373
|
+
* @default 'normal'
|
|
1374
|
+
*/
|
|
1375
|
+
preset?: 'normal' | 'compact' | 'full';
|
|
1376
|
+
/**
|
|
1377
|
+
* Header section controls.
|
|
1378
|
+
* - `false`: omit all header extras (runtime/env)
|
|
1379
|
+
* - `true`: include all default header extras
|
|
1380
|
+
* - object form: toggle individual parts
|
|
1381
|
+
* @default { env: true }
|
|
1382
|
+
*/
|
|
1383
|
+
header?: boolean | {
|
|
1384
|
+
env?: boolean;
|
|
1385
|
+
};
|
|
1386
|
+
/**
|
|
1387
|
+
* Reproduction command controls.
|
|
1388
|
+
* - `false`: omit reproduction commands
|
|
1389
|
+
* - `'file'`: only include the test file path
|
|
1390
|
+
* - `'file+name'`: include both file path and `--testNamePattern`
|
|
1391
|
+
* - `true`: same as `'file+name'`
|
|
1392
|
+
* @default 'file+name'
|
|
1393
|
+
*/
|
|
1394
|
+
reproduction?: boolean | 'file' | 'file+name';
|
|
1395
|
+
/**
|
|
1396
|
+
* Failure output controls.
|
|
1397
|
+
* @default { max: 50 }
|
|
1398
|
+
*/
|
|
1399
|
+
failures?: {
|
|
1400
|
+
max?: number;
|
|
1401
|
+
};
|
|
1402
|
+
/**
|
|
1403
|
+
* Code frame controls.
|
|
1404
|
+
* - `false`: disable code frames
|
|
1405
|
+
* - `true`: enable with default line window
|
|
1406
|
+
* - object form: customize line window
|
|
1407
|
+
* @default { linesAbove: 2, linesBelow: 2 }
|
|
1408
|
+
*/
|
|
1409
|
+
codeFrame?: boolean | {
|
|
1410
|
+
linesAbove?: number;
|
|
1411
|
+
linesBelow?: number;
|
|
1412
|
+
};
|
|
1413
|
+
/**
|
|
1414
|
+
* Stack output controls.
|
|
1415
|
+
* - `false`: omit stack info
|
|
1416
|
+
* - `'top'`: include only the top frame
|
|
1417
|
+
* - `number`: include up to N stack frames
|
|
1418
|
+
* - `'full'`: include a large default number of stack frames
|
|
1419
|
+
* @default 'top'
|
|
1420
|
+
*/
|
|
1421
|
+
stack?: number | false | 'full' | 'top';
|
|
1422
|
+
/**
|
|
1423
|
+
* Candidate files controls (best-effort files extracted from stack traces).
|
|
1424
|
+
* - `false`: omit candidate files
|
|
1425
|
+
* - `true`: enable with defaults
|
|
1426
|
+
* - object form: customize max items
|
|
1427
|
+
* @default { max: 5 }
|
|
1428
|
+
*/
|
|
1429
|
+
candidateFiles?: boolean | {
|
|
1430
|
+
max?: number;
|
|
1431
|
+
};
|
|
1432
|
+
/**
|
|
1433
|
+
* Console output controls.
|
|
1434
|
+
* - `false`: omit console logs
|
|
1435
|
+
* - `true`: include console logs with defaults
|
|
1436
|
+
* - object form: customize limits
|
|
1437
|
+
* @default { maxLogsPerTestPath: 10, maxCharsPerEntry: 500 }
|
|
1438
|
+
*/
|
|
1439
|
+
console?: boolean | {
|
|
1440
|
+
maxLogsPerTestPath?: number;
|
|
1441
|
+
maxCharsPerEntry?: number;
|
|
1442
|
+
};
|
|
1443
|
+
/**
|
|
1444
|
+
* Error section controls.
|
|
1445
|
+
* @default { unhandled: true }
|
|
1446
|
+
*/
|
|
1447
|
+
errors?: boolean | {
|
|
1448
|
+
unhandled?: boolean;
|
|
1449
|
+
};
|
|
1450
|
+
};
|
|
1451
|
+
|
|
1440
1452
|
declare interface MockContext<T extends Procedure> {
|
|
1441
1453
|
/**
|
|
1442
1454
|
* This is an array containing all arguments for each call. One item of the array is the arguments of that call.
|
|
@@ -1798,7 +1810,7 @@ declare type OnTestFailedHandler = (ctx: TestContext) => MaybePromise<void>;
|
|
|
1798
1810
|
|
|
1799
1811
|
declare type OnTestFinishedHandler = (ctx: TestContext) => MaybePromise<void>;
|
|
1800
1812
|
|
|
1801
|
-
declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'hideSkippedTestFiles' | 'resolveSnapshotPath' | 'extends';
|
|
1813
|
+
declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'hideSkippedTestFiles' | 'resolveSnapshotPath' | 'extends' | 'shard';
|
|
1802
1814
|
|
|
1803
1815
|
declare interface Options {
|
|
1804
1816
|
logger: {
|
|
@@ -1858,7 +1870,7 @@ declare function printWithType<T>(name: string, value: T, print: (value: T) => s
|
|
|
1858
1870
|
|
|
1859
1871
|
declare type Procedure = (...args: any[]) => any;
|
|
1860
1872
|
|
|
1861
|
-
declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | '
|
|
1873
|
+
declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | 'bail' | 'shard'>;
|
|
1862
1874
|
|
|
1863
1875
|
declare type ProjectContext = {
|
|
1864
1876
|
name: string;
|
|
@@ -1972,13 +1984,6 @@ declare interface Reporter {
|
|
|
1972
1984
|
onExit?: () => void;
|
|
1973
1985
|
}
|
|
1974
1986
|
|
|
1975
|
-
declare const reportersMap: {
|
|
1976
|
-
default: typeof DefaultReporter;
|
|
1977
|
-
verbose: typeof VerboseReporter;
|
|
1978
|
-
'github-actions': typeof GithubActionsReporter;
|
|
1979
|
-
junit: typeof JUnitReporter;
|
|
1980
|
-
};
|
|
1981
|
-
|
|
1982
1987
|
declare type ReporterWithOptions<Name extends BuiltInReporterNames = BuiltInReporterNames> = Name extends keyof BuiltinReporterOptions ? [Name, Partial<BuiltinReporterOptions[Name]>] : [Name, Record<string, unknown>];
|
|
1983
1988
|
|
|
1984
1989
|
declare interface ReportOptions {
|
|
@@ -2105,6 +2110,14 @@ declare interface RstestConfig {
|
|
|
2105
2110
|
* @default 0
|
|
2106
2111
|
*/
|
|
2107
2112
|
bail?: number;
|
|
2113
|
+
/**
|
|
2114
|
+
* Split tests into several shards.
|
|
2115
|
+
* This is useful for running tests in parallel on multiple machines.
|
|
2116
|
+
*/
|
|
2117
|
+
shard?: {
|
|
2118
|
+
count: number;
|
|
2119
|
+
index: number;
|
|
2120
|
+
};
|
|
2108
2121
|
/**
|
|
2109
2122
|
* print console traces when calling any console method.
|
|
2110
2123
|
*
|
|
@@ -2517,19 +2530,6 @@ declare interface SourceMapV3 {
|
|
|
2517
2530
|
|
|
2518
2531
|
declare type SourcesIndex = number;
|
|
2519
2532
|
|
|
2520
|
-
declare class StatusRenderer {
|
|
2521
|
-
private rootPath;
|
|
2522
|
-
private renderer;
|
|
2523
|
-
private startTime;
|
|
2524
|
-
private testState;
|
|
2525
|
-
constructor(rootPath: string, state: RstestTestState, logger?: Options['logger']);
|
|
2526
|
-
getContent(): string[];
|
|
2527
|
-
onTestFileStart(): void;
|
|
2528
|
-
onTestCaseResult(): void;
|
|
2529
|
-
onTestFileResult(): void;
|
|
2530
|
-
clear(): void;
|
|
2531
|
-
}
|
|
2532
|
-
|
|
2533
2533
|
declare function stringify(object: unknown, maxDepth?: number, { maxLength,...options }?: StringifyOptions): string;
|
|
2534
2534
|
|
|
2535
2535
|
declare interface StringifyOptions extends PrettyFormatOptions {
|
|
@@ -2810,17 +2810,6 @@ declare interface UserConsoleLog {
|
|
|
2810
2810
|
type: 'stdout' | 'stderr';
|
|
2811
2811
|
}
|
|
2812
2812
|
|
|
2813
|
-
declare class VerboseReporter extends DefaultReporter {
|
|
2814
|
-
private verboseOptions;
|
|
2815
|
-
constructor({ rootPath, options, config, testState, }: {
|
|
2816
|
-
rootPath: string;
|
|
2817
|
-
config: NormalizedConfig;
|
|
2818
|
-
options: VerboseReporterOptions;
|
|
2819
|
-
testState: RstestTestState;
|
|
2820
|
-
});
|
|
2821
|
-
onTestFileResult(test: TestFileResult): void;
|
|
2822
|
-
}
|
|
2823
|
-
|
|
2824
2813
|
declare type VerboseReporterOptions = Omit<DefaultReporterOptions, 'summary'>;
|
|
2825
2814
|
|
|
2826
2815
|
declare interface Visitor<N extends Node_2 = Node_2> {
|
package/dist/worker.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
1
|
+
import "node:module";
|
|
3
2
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
3
|
import { basename, isAbsolute, undoSerializableConfig, dirname, color, resolve as pathe_M_eThtNZ_resolve, join } from "./3160.js";
|
|
5
4
|
import "./487.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rstest/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "The Rsbuild-based test tool.",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rstest/issues"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"importMeta.d.ts"
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@rsbuild/core": "1.7.
|
|
57
|
+
"@rsbuild/core": "^1.7.3",
|
|
58
58
|
"@types/chai": "^5.2.3",
|
|
59
59
|
"tinypool": "^1.1.1"
|
|
60
60
|
},
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"tinyspy": "^4.0.4",
|
|
99
99
|
"url-extras": "^0.1.0",
|
|
100
100
|
"webpack-license-plugin": "^4.5.1",
|
|
101
|
-
"@rstest/
|
|
102
|
-
"@rstest/
|
|
101
|
+
"@rstest/tsconfig": "0.0.1",
|
|
102
|
+
"@rstest/browser-ui": "0.0.0"
|
|
103
103
|
},
|
|
104
104
|
"peerDependencies": {
|
|
105
105
|
"happy-dom": "*",
|