@rstest/core 0.2.0 → 0.2.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/dist/{72.js → 171.js} +2 -1
- package/dist/{920.js → 33.js} +36 -33
- package/dist/{44.js → 350.js} +6 -5
- package/dist/{813.js → 607.js} +16 -15
- package/dist/{208.js → 655.js} +61 -60
- package/dist/{359.js → 698.js} +74 -66
- package/dist/{355.js → 704.js} +17 -16
- package/dist/{965.js → 711.js} +6 -5
- package/dist/{443.js → 755.js} +2 -1
- package/dist/{723.js → 829.js} +5 -4
- package/dist/{867.js → 85.js} +56 -55
- package/dist/{668.js → 928.js} +3 -2
- package/dist/{25.js → 967.js} +8 -7
- package/dist/{64.js → 969.js} +2 -1
- package/dist/{285.js → 971.js} +12 -11
- package/dist/{854.js → 985.js} +14 -13
- package/dist/index.js +85 -85
- package/dist/worker.js +41 -39
- package/dist-types/index.d.ts +1 -0
- package/dist-types/worker.d.ts +1 -0
- package/package.json +4 -4
- /package/dist/{208.js.LICENSE.txt → 655.js.LICENSE.txt} +0 -0
- /package/dist/{668.js.LICENSE.txt → 928.js.LICENSE.txt} +0 -0
package/dist/{72.js → 171.js}
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
export const __webpack_id__ = "171";
|
|
3
4
|
export const __webpack_ids__ = [
|
|
4
|
-
"
|
|
5
|
+
"171"
|
|
5
6
|
];
|
|
6
7
|
export const __webpack_modules__ = {
|
|
7
8
|
"../../node_modules/.pnpm/js-tokens@4.0.0/node_modules/js-tokens/index.js": function(__unused_webpack_module, exports) {
|
package/dist/{920.js → 33.js}
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
export const __webpack_id__ = "33";
|
|
3
4
|
export const __webpack_ids__ = [
|
|
4
|
-
"
|
|
5
|
+
"33"
|
|
5
6
|
];
|
|
6
7
|
export const __webpack_modules__ = {
|
|
7
8
|
"./src/core/runTests.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -10,7 +11,7 @@ export const __webpack_modules__ = {
|
|
|
10
11
|
});
|
|
11
12
|
var src_pool = __webpack_require__("./src/pool/index.ts");
|
|
12
13
|
var utils = __webpack_require__("./src/utils/index.ts");
|
|
13
|
-
const isCliShortcutsEnabled = ()=>(0, utils.
|
|
14
|
+
const isCliShortcutsEnabled = ()=>(0, utils.Un)('stdin');
|
|
14
15
|
async function setupCliShortcuts({ closeServer, runAll, updateSnapshot, runFailedTests, runWithTestNamePattern, runWithFileFilters }) {
|
|
15
16
|
const { createInterface, emitKeypressEvents } = await import("node:readline");
|
|
16
17
|
const rl = createInterface({
|
|
@@ -67,28 +68,28 @@ export const __webpack_modules__ = {
|
|
|
67
68
|
const shortcuts = [
|
|
68
69
|
{
|
|
69
70
|
key: 'f',
|
|
70
|
-
description: `${utils
|
|
71
|
+
description: `${utils.yW.bold('f')} ${utils.yW.dim('rerun failed tests')}`,
|
|
71
72
|
action: async ()=>{
|
|
72
73
|
await runFailedTests();
|
|
73
74
|
}
|
|
74
75
|
},
|
|
75
76
|
{
|
|
76
77
|
key: 'a',
|
|
77
|
-
description: `${utils
|
|
78
|
+
description: `${utils.yW.bold('a')} ${utils.yW.dim('rerun all tests')}`,
|
|
78
79
|
action: async ()=>{
|
|
79
80
|
await runAll();
|
|
80
81
|
}
|
|
81
82
|
},
|
|
82
83
|
{
|
|
83
84
|
key: 'u',
|
|
84
|
-
description: `${utils
|
|
85
|
+
description: `${utils.yW.bold('u')} ${utils.yW.dim('update snapshot')}`,
|
|
85
86
|
action: async ()=>{
|
|
86
87
|
await updateSnapshot();
|
|
87
88
|
}
|
|
88
89
|
},
|
|
89
90
|
{
|
|
90
91
|
key: 't',
|
|
91
|
-
description: `${utils
|
|
92
|
+
description: `${utils.yW.bold('t')} ${utils.yW.dim('filter by a test name regex pattern')}`,
|
|
92
93
|
action: async ()=>{
|
|
93
94
|
clearCurrentInputLine();
|
|
94
95
|
await promptInput('Enter test name pattern (empty to clear): ', async (pattern)=>{
|
|
@@ -98,7 +99,7 @@ export const __webpack_modules__ = {
|
|
|
98
99
|
},
|
|
99
100
|
{
|
|
100
101
|
key: 'p',
|
|
101
|
-
description: `${utils
|
|
102
|
+
description: `${utils.yW.bold('p')} ${utils.yW.dim('filter by a filename regex pattern')}`,
|
|
102
103
|
action: async ()=>{
|
|
103
104
|
clearCurrentInputLine();
|
|
104
105
|
await promptInput('Enter file name pattern (empty to clear): ', async (input)=>{
|
|
@@ -109,14 +110,14 @@ export const __webpack_modules__ = {
|
|
|
109
110
|
},
|
|
110
111
|
{
|
|
111
112
|
key: 'c',
|
|
112
|
-
description: `${utils
|
|
113
|
+
description: `${utils.yW.bold('c')} ${utils.yW.dim('clear console')}`,
|
|
113
114
|
action: ()=>{
|
|
114
115
|
console.clear();
|
|
115
116
|
}
|
|
116
117
|
},
|
|
117
118
|
{
|
|
118
119
|
key: 'q',
|
|
119
|
-
description: `${utils
|
|
120
|
+
description: `${utils.yW.bold('q')} ${utils.yW.dim('quit process')}`,
|
|
120
121
|
action: async ()=>{
|
|
121
122
|
try {
|
|
122
123
|
await closeServer();
|
|
@@ -136,9 +137,9 @@ export const __webpack_modules__ = {
|
|
|
136
137
|
}
|
|
137
138
|
if ('h' === str) {
|
|
138
139
|
clearCurrentInputLine();
|
|
139
|
-
let message =
|
|
140
|
+
let message = ` ${utils.yW.bold(utils.yW.blue('Shortcuts:'))}\n`;
|
|
140
141
|
for (const shortcut of shortcuts)message += ` ${shortcut.description}\n`;
|
|
141
|
-
utils.
|
|
142
|
+
utils.vF.log(message);
|
|
142
143
|
}
|
|
143
144
|
};
|
|
144
145
|
process.stdin.on('keypress', handleKeypress);
|
|
@@ -156,7 +157,7 @@ export const __webpack_modules__ = {
|
|
|
156
157
|
const { normalizedConfig: { include, exclude, root, name, setupFiles: setups, includeSource }, rootPath, reporters, snapshotManager, command } = context;
|
|
157
158
|
const entriesCache = new Map();
|
|
158
159
|
const globTestSourceEntries = async ()=>{
|
|
159
|
-
const entries = await (0, utils.
|
|
160
|
+
const entries = await (0, utils.tG)({
|
|
160
161
|
include,
|
|
161
162
|
exclude,
|
|
162
163
|
includeSource,
|
|
@@ -168,18 +169,18 @@ export const __webpack_modules__ = {
|
|
|
168
169
|
fileFilters: context.fileFilters
|
|
169
170
|
});
|
|
170
171
|
if (!Object.keys(entries).length) {
|
|
171
|
-
utils.
|
|
172
|
-
utils.
|
|
173
|
-
if (context.fileFilters?.length) utils.
|
|
174
|
-
utils.
|
|
175
|
-
utils.
|
|
176
|
-
utils.
|
|
172
|
+
utils.vF.log(utils.yW.red('No test files found.'));
|
|
173
|
+
utils.vF.log('');
|
|
174
|
+
if (context.fileFilters?.length) utils.vF.log(utils.yW.gray('filter: '), context.fileFilters.join(utils.yW.gray(', ')));
|
|
175
|
+
utils.vF.log(utils.yW.gray('include:'), include.join(utils.yW.gray(', ')));
|
|
176
|
+
utils.vF.log(utils.yW.gray('exclude:'), exclude.join(utils.yW.gray(', ')));
|
|
177
|
+
utils.vF.log('');
|
|
177
178
|
}
|
|
178
179
|
return entries;
|
|
179
180
|
};
|
|
180
|
-
const setupFiles = (0, utils.
|
|
181
|
+
const setupFiles = (0, utils.pr)(setups, rootPath);
|
|
181
182
|
const rsbuildInstance = await (0, rsbuild.z)(context, globTestSourceEntries, setupFiles);
|
|
182
|
-
const { getRsbuildStats, closeServer } = await (0, rsbuild.
|
|
183
|
+
const { getRsbuildStats, closeServer } = await (0, rsbuild.X)({
|
|
183
184
|
name,
|
|
184
185
|
normalizedConfig: context.normalizedConfig,
|
|
185
186
|
globTestSourceEntries: 'watch' === command ? globTestSourceEntries : async ()=>{
|
|
@@ -190,8 +191,8 @@ export const __webpack_modules__ = {
|
|
|
190
191
|
rsbuildInstance,
|
|
191
192
|
rootPath
|
|
192
193
|
});
|
|
193
|
-
const recommendWorkerCount = 'watch' === command ? 1 / 0 : Array.from(entriesCache.values()).reduce((acc,
|
|
194
|
-
const pool = await (0, src_pool.
|
|
194
|
+
const recommendWorkerCount = 'watch' === command ? 1 / 0 : Array.from(entriesCache.values()).reduce((acc, entry)=>acc + Object.keys(entry.entries).length, 0);
|
|
195
|
+
const pool = await (0, src_pool.b)({
|
|
195
196
|
context,
|
|
196
197
|
recommendWorkerCount
|
|
197
198
|
});
|
|
@@ -231,20 +232,22 @@ export const __webpack_modules__ = {
|
|
|
231
232
|
if ('watch' === command) {
|
|
232
233
|
const enableCliShortcuts = isCliShortcutsEnabled();
|
|
233
234
|
const afterTestsWatchRun = ()=>{
|
|
234
|
-
utils.
|
|
235
|
-
if (enableCliShortcuts) if (snapshotManager.summary.unmatched) utils.
|
|
236
|
-
else utils.
|
|
235
|
+
utils.vF.log(utils.yW.green(' Waiting for file changes...'));
|
|
236
|
+
if (enableCliShortcuts) if (snapshotManager.summary.unmatched) utils.vF.log(` ${utils.yW.dim('press')} ${utils.yW.yellow(utils.yW.bold('u'))} ${utils.yW.dim('to update snapshot')}${utils.yW.dim(', press')} ${utils.yW.bold('h')} ${utils.yW.dim('to show help')}\n`);
|
|
237
|
+
else utils.vF.log(` ${utils.yW.dim('press')} ${utils.yW.bold('h')} ${utils.yW.dim('to show help')}${utils.yW.dim(', press')} ${utils.yW.bold('q')} ${utils.yW.dim('to quit')}\n`);
|
|
237
238
|
};
|
|
238
239
|
const clearLogs = ()=>{
|
|
239
240
|
console.clear();
|
|
240
241
|
};
|
|
241
|
-
const { onBeforeRestart } = await __webpack_require__.e("
|
|
242
|
+
const { onBeforeRestart } = await __webpack_require__.e("967").then(__webpack_require__.bind(__webpack_require__, "./src/core/restart.ts"));
|
|
242
243
|
onBeforeRestart(async ()=>{
|
|
243
244
|
await pool.close();
|
|
244
245
|
await closeServer();
|
|
245
246
|
});
|
|
246
|
-
rsbuildInstance.
|
|
247
|
+
rsbuildInstance.onBeforeDevCompile(({ isFirstCompile })=>{
|
|
247
248
|
if (!isFirstCompile) clearLogs();
|
|
249
|
+
});
|
|
250
|
+
rsbuildInstance.onAfterDevCompile(async ({ isFirstCompile })=>{
|
|
248
251
|
snapshotManager.clear();
|
|
249
252
|
await run();
|
|
250
253
|
if (isFirstCompile && enableCliShortcuts) {
|
|
@@ -264,16 +267,16 @@ export const __webpack_modules__ = {
|
|
|
264
267
|
runWithTestNamePattern: async (pattern)=>{
|
|
265
268
|
clearLogs();
|
|
266
269
|
context.normalizedConfig.testNamePattern = pattern;
|
|
267
|
-
if (pattern) utils.
|
|
268
|
-
else utils.
|
|
270
|
+
if (pattern) utils.vF.log(`\n${utils.yW.dim('Applied testNamePattern:')} ${utils.yW.bold(pattern)}\n`);
|
|
271
|
+
else utils.vF.log(`\n${utils.yW.dim('Cleared testNamePattern filter')}\n`);
|
|
269
272
|
snapshotManager.clear();
|
|
270
273
|
await run();
|
|
271
274
|
afterTestsWatchRun();
|
|
272
275
|
},
|
|
273
276
|
runWithFileFilters: async (filters)=>{
|
|
274
277
|
clearLogs();
|
|
275
|
-
if (filters && filters.length > 0) utils.
|
|
276
|
-
else utils.
|
|
278
|
+
if (filters && filters.length > 0) utils.vF.log(`\n${utils.yW.dim('Applied file filters:')} ${utils.yW.bold(filters.join(', '))}\n`);
|
|
279
|
+
else utils.vF.log(`\n${utils.yW.dim('Cleared file filters')}\n`);
|
|
277
280
|
snapshotManager.clear();
|
|
278
281
|
context.fileFilters = filters;
|
|
279
282
|
const entries = await globTestSourceEntries();
|
|
@@ -285,7 +288,7 @@ export const __webpack_modules__ = {
|
|
|
285
288
|
},
|
|
286
289
|
runFailedTests: async ()=>{
|
|
287
290
|
const failedTests = testFileResult.filter((result)=>'fail' === result.status).map((r)=>r.testPath);
|
|
288
|
-
if (!failedTests.length) return void utils.
|
|
291
|
+
if (!failedTests.length) return void utils.vF.log(utils.yW.yellow('\nNo failed tests were found that needed to be rerun.'));
|
|
289
292
|
clearLogs();
|
|
290
293
|
snapshotManager.clear();
|
|
291
294
|
await run({
|
|
@@ -294,7 +297,7 @@ export const __webpack_modules__ = {
|
|
|
294
297
|
afterTestsWatchRun();
|
|
295
298
|
},
|
|
296
299
|
updateSnapshot: async ()=>{
|
|
297
|
-
if (!snapshotManager.summary.unmatched) return void utils.
|
|
300
|
+
if (!snapshotManager.summary.unmatched) return void utils.vF.log(utils.yW.yellow('\nNo snapshots were found that needed to be updated.'));
|
|
298
301
|
const failedTests = testFileResult.filter((result)=>result.snapshotResult?.unmatched).map((r)=>r.testPath);
|
|
299
302
|
clearLogs();
|
|
300
303
|
const originalUpdateSnapshot = snapshotManager.options.updateSnapshot;
|
package/dist/{44.js → 350.js}
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
export const __webpack_id__ = "350";
|
|
3
4
|
export const __webpack_ids__ = [
|
|
4
|
-
"
|
|
5
|
+
"350"
|
|
5
6
|
];
|
|
6
7
|
export const __webpack_modules__ = {
|
|
7
8
|
"./src/runtime/worker/env/happyDom.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -18,7 +19,7 @@ export const __webpack_modules__ = {
|
|
|
18
19
|
url: happyDom.url || 'http://localhost:3000',
|
|
19
20
|
console: console && global.console ? global.console : void 0
|
|
20
21
|
});
|
|
21
|
-
const cleanupGlobal = (0, _utils__WEBPACK_IMPORTED_MODULE_0__.
|
|
22
|
+
const cleanupGlobal = (0, _utils__WEBPACK_IMPORTED_MODULE_0__.p5)(global, win, {
|
|
22
23
|
additionalKeys: [
|
|
23
24
|
'Request',
|
|
24
25
|
'Response',
|
|
@@ -26,7 +27,7 @@ export const __webpack_modules__ = {
|
|
|
26
27
|
'fetch'
|
|
27
28
|
]
|
|
28
29
|
});
|
|
29
|
-
const cleanupHandler = (0, _utils__WEBPACK_IMPORTED_MODULE_0__.
|
|
30
|
+
const cleanupHandler = (0, _utils__WEBPACK_IMPORTED_MODULE_0__.d1)(global);
|
|
30
31
|
return {
|
|
31
32
|
async teardown () {
|
|
32
33
|
cleanupHandler();
|
|
@@ -42,8 +43,8 @@ export const __webpack_modules__ = {
|
|
|
42
43
|
},
|
|
43
44
|
"./src/runtime/worker/env/utils.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
44
45
|
__webpack_require__.d(__webpack_exports__, {
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
d1: ()=>addDefaultErrorHandler,
|
|
47
|
+
p5: ()=>installGlobal
|
|
47
48
|
});
|
|
48
49
|
const LIVING_KEYS = [
|
|
49
50
|
'DOMException',
|
package/dist/{813.js → 607.js}
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
export const __webpack_id__ = "607";
|
|
3
4
|
export const __webpack_ids__ = [
|
|
4
|
-
"
|
|
5
|
+
"607"
|
|
5
6
|
];
|
|
6
7
|
export const __webpack_modules__ = {
|
|
7
8
|
"./src/runtime/worker/console.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -30,13 +31,13 @@ export const __webpack_modules__ = {
|
|
|
30
31
|
getPrettyName(type) {
|
|
31
32
|
switch(type){
|
|
32
33
|
case 'error':
|
|
33
|
-
return _utils__WEBPACK_IMPORTED_MODULE_3__
|
|
34
|
+
return _utils__WEBPACK_IMPORTED_MODULE_3__.yW.red(type);
|
|
34
35
|
case 'warn':
|
|
35
|
-
return _utils__WEBPACK_IMPORTED_MODULE_3__
|
|
36
|
+
return _utils__WEBPACK_IMPORTED_MODULE_3__.yW.yellow(type);
|
|
36
37
|
case 'info':
|
|
37
|
-
return _utils__WEBPACK_IMPORTED_MODULE_3__
|
|
38
|
+
return _utils__WEBPACK_IMPORTED_MODULE_3__.yW.cyan(type);
|
|
38
39
|
default:
|
|
39
|
-
return _utils__WEBPACK_IMPORTED_MODULE_3__
|
|
40
|
+
return _utils__WEBPACK_IMPORTED_MODULE_3__.yW.gray(type);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
_log(name, message, type = 'stdout') {
|
|
@@ -78,11 +79,11 @@ export const __webpack_modules__ = {
|
|
|
78
79
|
}
|
|
79
80
|
group(title, ...args) {
|
|
80
81
|
this._groupDepth++;
|
|
81
|
-
if (null != title || args.length > 0) this._log('group', _utils__WEBPACK_IMPORTED_MODULE_3__
|
|
82
|
+
if (null != title || args.length > 0) this._log('group', _utils__WEBPACK_IMPORTED_MODULE_3__.yW.bold((0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(title, ...args)));
|
|
82
83
|
}
|
|
83
84
|
groupCollapsed(title, ...args) {
|
|
84
85
|
this._groupDepth++;
|
|
85
|
-
if (null != title || args.length > 0) this._log('groupCollapsed', _utils__WEBPACK_IMPORTED_MODULE_3__
|
|
86
|
+
if (null != title || args.length > 0) this._log('groupCollapsed', _utils__WEBPACK_IMPORTED_MODULE_3__.yW.bold((0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(title, ...args)));
|
|
86
87
|
}
|
|
87
88
|
groupEnd() {
|
|
88
89
|
if (this._groupDepth > 0) this._groupDepth--;
|
|
@@ -102,7 +103,7 @@ export const __webpack_modules__ = {
|
|
|
102
103
|
if (null != startTime) {
|
|
103
104
|
const endTime = RealDate.now();
|
|
104
105
|
const time = endTime - startTime.getTime();
|
|
105
|
-
this._log('time', (0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(`${label}: ${(0, _utils__WEBPACK_IMPORTED_MODULE_3__.
|
|
106
|
+
this._log('time', (0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(`${label}: ${(0, _utils__WEBPACK_IMPORTED_MODULE_3__.kV)(time)}`));
|
|
106
107
|
delete this._timers[label];
|
|
107
108
|
}
|
|
108
109
|
}
|
|
@@ -111,7 +112,7 @@ export const __webpack_modules__ = {
|
|
|
111
112
|
if (null != startTime) {
|
|
112
113
|
const endTime = new RealDate();
|
|
113
114
|
const time = endTime.getTime() - startTime.getTime();
|
|
114
|
-
this._log('time', (0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(`${label}: ${(0, _utils__WEBPACK_IMPORTED_MODULE_3__.
|
|
115
|
+
this._log('time', (0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(`${label}: ${(0, _utils__WEBPACK_IMPORTED_MODULE_3__.kV)(time)}`, ...data));
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
warn(firstArg, ...args) {
|
|
@@ -124,12 +125,12 @@ export const __webpack_modules__ = {
|
|
|
124
125
|
},
|
|
125
126
|
"./src/utils/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
126
127
|
__webpack_require__.d(__webpack_exports__, {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
fN: ()=>helper.fN,
|
|
129
|
+
Gv: ()=>helper.Gv,
|
|
130
|
+
kV: ()=>helper.kV,
|
|
131
|
+
q_: ()=>constants.q_,
|
|
132
|
+
bg: ()=>helper.bg,
|
|
133
|
+
yW: ()=>helper.yW
|
|
133
134
|
});
|
|
134
135
|
var constants = __webpack_require__("./src/utils/constants.ts");
|
|
135
136
|
var helper = __webpack_require__("./src/utils/helper.ts");
|