@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.
@@ -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
- "72"
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) {
@@ -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
- "920"
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._l)('stdin');
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.$_.bold('f')} ${utils.$_.dim('rerun failed tests')}`,
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.$_.bold('a')} ${utils.$_.dim('rerun all tests')}`,
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.$_.bold('u')} ${utils.$_.dim('update snapshot')}`,
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.$_.bold('t')} ${utils.$_.dim('filter by a test name regex pattern')}`,
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.$_.bold('p')} ${utils.$_.dim('filter by a filename regex pattern')}`,
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.$_.bold('c')} ${utils.$_.dim('clear console')}`,
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.$_.bold('q')} ${utils.$_.dim('quit process')}`,
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 = `\n ${utils.$_.bold(utils.$_.blue('Shortcuts:'))}\n`;
140
+ let message = ` ${utils.yW.bold(utils.yW.blue('Shortcuts:'))}\n`;
140
141
  for (const shortcut of shortcuts)message += ` ${shortcut.description}\n`;
141
- utils.kg.log(message);
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.GL)({
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.kg.log(utils.$_.red('No test files found.'));
172
- utils.kg.log('');
173
- if (context.fileFilters?.length) utils.kg.log(utils.$_.gray('filter: '), context.fileFilters.join(utils.$_.gray(', ')));
174
- utils.kg.log(utils.$_.gray('include:'), include.join(utils.$_.gray(', ')));
175
- utils.kg.log(utils.$_.gray('exclude:'), exclude.join(utils.$_.gray(', ')));
176
- utils.kg.log('');
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.aA)(setups, rootPath);
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.r)({
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, entries)=>acc + Object.keys(entries).length, 0);
194
- const pool = await (0, src_pool.K)({
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.kg.log(utils.$_.green(' Waiting for file changes...'));
235
- if (enableCliShortcuts) if (snapshotManager.summary.unmatched) utils.kg.log(` ${utils.$_.dim('press')} ${utils.$_.yellow(utils.$_.bold('u'))} ${utils.$_.dim('to update snapshot')}${utils.$_.dim(', press')} ${utils.$_.bold('h')} ${utils.$_.dim('to show help')}\n`);
236
- else utils.kg.log(` ${utils.$_.dim('press')} ${utils.$_.bold('h')} ${utils.$_.dim('to show help')}${utils.$_.dim(', press')} ${utils.$_.bold('q')} ${utils.$_.dim('to quit')}\n`);
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("25").then(__webpack_require__.bind(__webpack_require__, "./src/core/restart.ts"));
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.onDevCompileDone(async ({ isFirstCompile })=>{
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.kg.log(`\n${utils.$_.dim('Applied testNamePattern:')} ${utils.$_.bold(pattern)}\n`);
268
- else utils.kg.log(`\n${utils.$_.dim('Cleared testNamePattern filter')}\n`);
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.kg.log(`\n${utils.$_.dim('Applied file filters:')} ${utils.$_.bold(filters.join(', '))}\n`);
276
- else utils.kg.log(`\n${utils.$_.dim('Cleared file filters')}\n`);
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.kg.log(utils.$_.yellow('\nNo failed tests were found that needed to be rerun.'));
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.kg.log(utils.$_.yellow('\nNo snapshots were found that needed to be updated.'));
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;
@@ -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
- "44"
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__.Nc)(global, win, {
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__.xp)(global);
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
- xp: ()=>addDefaultErrorHandler,
46
- Nc: ()=>installGlobal
46
+ d1: ()=>addDefaultErrorHandler,
47
+ p5: ()=>installGlobal
47
48
  });
48
49
  const LIVING_KEYS = [
49
50
  'DOMException',
@@ -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
- "813"
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__.$_.red(type);
34
+ return _utils__WEBPACK_IMPORTED_MODULE_3__.yW.red(type);
34
35
  case 'warn':
35
- return _utils__WEBPACK_IMPORTED_MODULE_3__.$_.yellow(type);
36
+ return _utils__WEBPACK_IMPORTED_MODULE_3__.yW.yellow(type);
36
37
  case 'info':
37
- return _utils__WEBPACK_IMPORTED_MODULE_3__.$_.cyan(type);
38
+ return _utils__WEBPACK_IMPORTED_MODULE_3__.yW.cyan(type);
38
39
  default:
39
- return _utils__WEBPACK_IMPORTED_MODULE_3__.$_.gray(type);
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__.$_.bold((0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(title, ...args)));
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__.$_.bold((0, node_util__WEBPACK_IMPORTED_MODULE_2__.format)(title, ...args)));
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__.AS)(time)}`));
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__.AS)(time)}`, ...data));
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
- Kn: ()=>helper.Kn,
128
- AS: ()=>helper.AS,
129
- n1: ()=>constants.n1,
130
- XQ: ()=>helper.XQ,
131
- $_: ()=>helper.$_,
132
- Yz: ()=>helper.Yz
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");