@rstest/core 0.0.4 → 0.0.6

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/285.js CHANGED
@@ -55,7 +55,7 @@ export const __webpack_modules__ = {
55
55
  const hasError = list.some((file)=>file.errors?.length);
56
56
  if (hasError) {
57
57
  const { printError } = await Promise.all([
58
- __webpack_require__.e("502"),
58
+ __webpack_require__.e("723"),
59
59
  __webpack_require__.e("355")
60
60
  ]).then(__webpack_require__.bind(__webpack_require__, "./src/utils/error.ts"));
61
61
  process.exitCode = 1;
package/dist/353.js CHANGED
@@ -323,7 +323,7 @@ export const __webpack_modules__ = {
323
323
  utils.kg.log(`${utils.$_.bgRed(' FAIL ')} ${(0, utils.aj)(relativePath)} ${nameStr.length ? `${utils.$_.dim(utils.Qd)} ${nameStr}` : ''}`);
324
324
  if (test.errors) {
325
325
  const { printError } = await Promise.all([
326
- __webpack_require__.e("502"),
326
+ __webpack_require__.e("723"),
327
327
  __webpack_require__.e("355")
328
328
  ]).then(__webpack_require__.bind(__webpack_require__, "./src/utils/error.ts"));
329
329
  for (const error of test.errors)await printError(error, getSourcemap, rootPath);
@@ -361,19 +361,21 @@ export const __webpack_modules__ = {
361
361
  const relativePath = (0, external_pathe_.relative)(this.rootPath, test.testPath);
362
362
  const { slowTestThreshold } = this.config;
363
363
  let title = ` ${utils.$_.bold(statusColorfulStr[test.status])} ${(0, utils.aj)(relativePath)}`;
364
- const formatDuration = (duration)=>utils.$_[duration > slowTestThreshold ? 'yellow' : 'green'](`${(0, utils.AS)(duration, false)}`);
364
+ const formatDuration = (duration)=>utils.$_[duration > slowTestThreshold ? 'yellow' : 'green'](`${(0, utils.AS)(duration)}`);
365
365
  title += ` ${utils.$_.gray(`(${test.results.length})`)}`;
366
366
  const isTooSlow = test.duration && test.duration > slowTestThreshold;
367
367
  if (isTooSlow) title += ` ${formatDuration(test.duration)}`;
368
+ const hasRetryCase = test.results.some((result)=>(result.retryCount || 0) > 0);
368
369
  utils.kg.log(title);
369
- if ('fail' !== test.status && !isTooSlow) return;
370
+ if ('fail' !== test.status && !isTooSlow && !hasRetryCase) return;
370
371
  const showAllCases = isTooSlow && !test.results.some((result)=>(result.duration || 0) > slowTestThreshold);
371
372
  for (const result of test.results){
372
373
  const isSlowCase = (result.duration || 0) > slowTestThreshold;
373
- if (!showAllCases && 'fail' !== result.status && !isSlowCase) continue;
374
+ const retried = (result.retryCount || 0) > 0;
375
+ if (!showAllCases && 'fail' !== result.status && !isSlowCase && !retried) continue;
374
376
  const icon = isSlowCase && 'pass' === result.status ? utils.$_.yellow(statusStr[result.status]) : statusColorfulStr[result.status];
375
377
  const nameStr = (0, utils.Yz)(result);
376
- const duration = void 0 !== result.duration ? ` (${(0, utils.AS)(result.duration, false)})` : '';
378
+ const duration = void 0 !== result.duration ? ` (${(0, utils.AS)(result.duration)})` : '';
377
379
  const retry = result.retryCount ? utils.$_.yellow(` (retry x${result.retryCount})`) : '';
378
380
  console.log(` ${icon} ${nameStr}${utils.$_.gray(duration)}${retry}`);
379
381
  if (result.errors) for (const error of result.errors)console.error(utils.$_.red(` ${error.message}`));
@@ -452,7 +454,7 @@ export const __webpack_modules__ = {
452
454
  });
453
455
  return {
454
456
  command,
455
- version: "0.0.4",
457
+ version: "0.0.6",
456
458
  rootPath,
457
459
  reporters,
458
460
  snapshotManager,
@@ -467,14 +469,14 @@ export const __webpack_modules__ = {
467
469
  }, config);
468
470
  const runTests = async ()=>{
469
471
  const { runTests } = await Promise.all([
470
- __webpack_require__.e("992"),
472
+ __webpack_require__.e("612"),
471
473
  __webpack_require__.e("629")
472
474
  ]).then(__webpack_require__.bind(__webpack_require__, "./src/core/runTests.ts"));
473
475
  await runTests(context, fileFilters);
474
476
  };
475
477
  const listTests = async (options)=>{
476
478
  const { listTests } = await Promise.all([
477
- __webpack_require__.e("992"),
479
+ __webpack_require__.e("612"),
478
480
  __webpack_require__.e("285")
479
481
  ]).then(__webpack_require__.bind(__webpack_require__, "./src/core/listTests.ts"));
480
482
  await listTests(context, fileFilters, options);
package/dist/355.js CHANGED
@@ -7,7 +7,7 @@ export const __webpack_modules__ = {
7
7
  printError: ()=>printError
8
8
  });
9
9
  var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:fs");
10
- var _jridgewell_trace_mapping__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.27/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs");
10
+ var _jridgewell_trace_mapping__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.29/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs");
11
11
  var stacktrace_parser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/stacktrace-parser@0.1.11/node_modules/stacktrace-parser/dist/stack-trace-parser.esm.js");
12
12
  var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/index.ts");
13
13
  async function printError(error, getSourcemap, rootPath) {
package/dist/44.js ADDED
@@ -0,0 +1,375 @@
1
+ export const __webpack_ids__ = [
2
+ "44"
3
+ ];
4
+ export const __webpack_modules__ = {
5
+ "./src/runtime/worker/env/happyDom.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6
+ __webpack_require__.d(__webpack_exports__, {
7
+ environment: ()=>environment
8
+ });
9
+ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/runtime/worker/env/utils.ts");
10
+ const environment = {
11
+ name: 'happy-dom',
12
+ async setup (global, { happyDom = {} }) {
13
+ const { Window } = await import("happy-dom");
14
+ const win = new Window({
15
+ ...happyDom,
16
+ url: happyDom.url || 'http://localhost:3000',
17
+ console: console && global.console ? global.console : void 0
18
+ });
19
+ const cleanupGlobal = (0, _utils__WEBPACK_IMPORTED_MODULE_0__.Nc)(global, win, {
20
+ additionalKeys: [
21
+ 'Request',
22
+ 'Response',
23
+ 'MessagePort',
24
+ 'fetch'
25
+ ]
26
+ });
27
+ const cleanupHandler = (0, _utils__WEBPACK_IMPORTED_MODULE_0__.xp)(global);
28
+ return {
29
+ async teardown () {
30
+ cleanupHandler();
31
+ if (win.close && win.happyDOM.abort) {
32
+ await win.happyDOM.abort();
33
+ win.close();
34
+ } else await win.happyDOM.cancelAsync();
35
+ cleanupGlobal();
36
+ }
37
+ };
38
+ }
39
+ };
40
+ },
41
+ "./src/runtime/worker/env/utils.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
42
+ __webpack_require__.d(__webpack_exports__, {
43
+ xp: ()=>addDefaultErrorHandler,
44
+ Nc: ()=>installGlobal
45
+ });
46
+ const LIVING_KEYS = [
47
+ 'DOMException',
48
+ 'URL',
49
+ 'URLSearchParams',
50
+ 'EventTarget',
51
+ 'NamedNodeMap',
52
+ 'Node',
53
+ 'Attr',
54
+ 'Element',
55
+ 'DocumentFragment',
56
+ 'DOMImplementation',
57
+ 'Document',
58
+ 'XMLDocument',
59
+ 'CharacterData',
60
+ 'Text',
61
+ 'CDATASection',
62
+ 'ProcessingInstruction',
63
+ 'Comment',
64
+ 'DocumentType',
65
+ 'NodeList',
66
+ 'RadioNodeList',
67
+ 'HTMLCollection',
68
+ 'HTMLOptionsCollection',
69
+ 'DOMStringMap',
70
+ 'DOMTokenList',
71
+ 'StyleSheetList',
72
+ 'HTMLElement',
73
+ 'HTMLHeadElement',
74
+ 'HTMLTitleElement',
75
+ 'HTMLBaseElement',
76
+ 'HTMLLinkElement',
77
+ 'HTMLMetaElement',
78
+ 'HTMLStyleElement',
79
+ 'HTMLBodyElement',
80
+ 'HTMLHeadingElement',
81
+ 'HTMLParagraphElement',
82
+ 'HTMLHRElement',
83
+ 'HTMLPreElement',
84
+ 'HTMLUListElement',
85
+ 'HTMLOListElement',
86
+ 'HTMLLIElement',
87
+ 'HTMLMenuElement',
88
+ 'HTMLDListElement',
89
+ 'HTMLDivElement',
90
+ 'HTMLAnchorElement',
91
+ 'HTMLAreaElement',
92
+ 'HTMLBRElement',
93
+ 'HTMLButtonElement',
94
+ 'HTMLCanvasElement',
95
+ 'HTMLDataElement',
96
+ 'HTMLDataListElement',
97
+ 'HTMLDetailsElement',
98
+ 'HTMLDialogElement',
99
+ 'HTMLDirectoryElement',
100
+ 'HTMLFieldSetElement',
101
+ 'HTMLFontElement',
102
+ 'HTMLFormElement',
103
+ 'HTMLHtmlElement',
104
+ 'HTMLImageElement',
105
+ 'HTMLInputElement',
106
+ 'HTMLLabelElement',
107
+ 'HTMLLegendElement',
108
+ 'HTMLMapElement',
109
+ 'HTMLMarqueeElement',
110
+ 'HTMLMediaElement',
111
+ 'HTMLMeterElement',
112
+ 'HTMLModElement',
113
+ 'HTMLOptGroupElement',
114
+ 'HTMLOptionElement',
115
+ 'HTMLOutputElement',
116
+ 'HTMLPictureElement',
117
+ 'HTMLProgressElement',
118
+ 'HTMLQuoteElement',
119
+ 'HTMLScriptElement',
120
+ 'HTMLSelectElement',
121
+ 'HTMLSlotElement',
122
+ 'HTMLSourceElement',
123
+ 'HTMLSpanElement',
124
+ 'HTMLTableCaptionElement',
125
+ 'HTMLTableCellElement',
126
+ 'HTMLTableColElement',
127
+ 'HTMLTableElement',
128
+ 'HTMLTimeElement',
129
+ 'HTMLTableRowElement',
130
+ 'HTMLTableSectionElement',
131
+ 'HTMLTemplateElement',
132
+ 'HTMLTextAreaElement',
133
+ 'HTMLUnknownElement',
134
+ 'HTMLFrameElement',
135
+ 'HTMLFrameSetElement',
136
+ 'HTMLIFrameElement',
137
+ 'HTMLEmbedElement',
138
+ 'HTMLObjectElement',
139
+ 'HTMLParamElement',
140
+ 'HTMLVideoElement',
141
+ 'HTMLAudioElement',
142
+ 'HTMLTrackElement',
143
+ 'HTMLFormControlsCollection',
144
+ 'SVGElement',
145
+ 'SVGGraphicsElement',
146
+ 'SVGSVGElement',
147
+ 'SVGGElement',
148
+ 'SVGDefsElement',
149
+ 'SVGDescElement',
150
+ 'SVGMetadataElement',
151
+ 'SVGTitleElement',
152
+ 'SVGSymbolElement',
153
+ 'SVGSwitchElement',
154
+ 'SVGAnimatedPreserveAspectRatio',
155
+ 'SVGAnimatedRect',
156
+ 'SVGAnimatedString',
157
+ 'SVGNumber',
158
+ 'SVGPreserveAspectRatio',
159
+ 'SVGRect',
160
+ 'SVGStringList',
161
+ 'Event',
162
+ 'BeforeUnloadEvent',
163
+ 'BlobEvent',
164
+ 'CloseEvent',
165
+ 'CustomEvent',
166
+ 'MessageEvent',
167
+ 'ErrorEvent',
168
+ 'HashChangeEvent',
169
+ 'PopStateEvent',
170
+ 'StorageEvent',
171
+ 'ProgressEvent',
172
+ 'PageTransitionEvent',
173
+ 'SubmitEvent',
174
+ 'UIEvent',
175
+ 'FocusEvent',
176
+ 'InputEvent',
177
+ 'MouseEvent',
178
+ 'KeyboardEvent',
179
+ 'TouchEvent',
180
+ 'CompositionEvent',
181
+ 'WheelEvent',
182
+ 'BarProp',
183
+ 'External',
184
+ 'Location',
185
+ 'History',
186
+ 'Screen',
187
+ 'Performance',
188
+ 'Navigator',
189
+ 'Crypto',
190
+ 'PluginArray',
191
+ 'MimeTypeArray',
192
+ 'Plugin',
193
+ 'MimeType',
194
+ 'FileReader',
195
+ 'Blob',
196
+ 'File',
197
+ 'FileList',
198
+ 'ValidityState',
199
+ 'DOMParser',
200
+ 'XMLSerializer',
201
+ 'FormData',
202
+ 'XMLHttpRequestEventTarget',
203
+ 'XMLHttpRequestUpload',
204
+ 'XMLHttpRequest',
205
+ 'WebSocket',
206
+ 'NodeFilter',
207
+ 'NodeIterator',
208
+ 'TreeWalker',
209
+ 'AbstractRange',
210
+ 'Range',
211
+ 'StaticRange',
212
+ 'Selection',
213
+ 'Storage',
214
+ 'CustomElementRegistry',
215
+ 'ElementInternals',
216
+ 'ShadowRoot',
217
+ 'MutationObserver',
218
+ 'MutationRecord',
219
+ 'Headers',
220
+ 'AbortController',
221
+ 'AbortSignal',
222
+ 'Uint8Array',
223
+ 'Uint16Array',
224
+ 'Uint32Array',
225
+ 'Uint8ClampedArray',
226
+ 'Int8Array',
227
+ 'Int16Array',
228
+ 'Int32Array',
229
+ 'Float32Array',
230
+ 'Float64Array',
231
+ 'ArrayBuffer',
232
+ 'DeviceMotionEventAcceleration',
233
+ 'DeviceMotionEventRotationRate',
234
+ 'DOMRectReadOnly',
235
+ 'DOMRect',
236
+ 'Image',
237
+ 'Audio',
238
+ 'Option',
239
+ 'CSS'
240
+ ];
241
+ const OTHER_KEYS = [
242
+ 'addEventListener',
243
+ 'alert',
244
+ 'blur',
245
+ 'cancelAnimationFrame',
246
+ 'close',
247
+ 'confirm',
248
+ 'createPopup',
249
+ 'dispatchEvent',
250
+ 'document',
251
+ 'focus',
252
+ 'frames',
253
+ 'getComputedStyle',
254
+ 'history',
255
+ 'innerHeight',
256
+ 'innerWidth',
257
+ 'length',
258
+ 'location',
259
+ 'matchMedia',
260
+ 'moveBy',
261
+ 'moveTo',
262
+ 'name',
263
+ 'navigator',
264
+ 'open',
265
+ 'outerHeight',
266
+ 'outerWidth',
267
+ 'pageXOffset',
268
+ 'pageYOffset',
269
+ 'parent',
270
+ 'postMessage',
271
+ 'print',
272
+ 'prompt',
273
+ 'removeEventListener',
274
+ 'requestAnimationFrame',
275
+ 'resizeBy',
276
+ 'resizeTo',
277
+ 'screen',
278
+ 'screenLeft',
279
+ 'screenTop',
280
+ 'screenX',
281
+ 'screenY',
282
+ 'scroll',
283
+ 'scrollBy',
284
+ 'scrollLeft',
285
+ 'scrollTo',
286
+ 'scrollTop',
287
+ 'scrollX',
288
+ 'scrollY',
289
+ 'self',
290
+ 'stop',
291
+ 'top',
292
+ 'Window',
293
+ 'window'
294
+ ];
295
+ const KEYS = LIVING_KEYS.concat(OTHER_KEYS);
296
+ const SKIP_KEYS = [
297
+ 'window',
298
+ 'self',
299
+ 'top',
300
+ 'parent'
301
+ ];
302
+ function getWindowKeys(global, win, additionalKeys = []) {
303
+ const keysArray = [
304
+ ...additionalKeys,
305
+ ...KEYS
306
+ ];
307
+ return new Set(keysArray.concat(Object.getOwnPropertyNames(win)).filter((k)=>{
308
+ if (SKIP_KEYS.includes(k)) return false;
309
+ if (k in global) return keysArray.includes(k);
310
+ return true;
311
+ }));
312
+ }
313
+ function isClassLike(name) {
314
+ return name[0] === name[0]?.toUpperCase();
315
+ }
316
+ function installGlobal(global, win, options = {}) {
317
+ const { bindFunctions = true } = options || {};
318
+ const keys = getWindowKeys(global, win, options.additionalKeys);
319
+ const originals = new Map();
320
+ const overrides = new Map();
321
+ for (const key of keys){
322
+ const boundFunction = bindFunctions && 'function' == typeof win[key] && !isClassLike(key) && win[key].bind(win);
323
+ if (key in global) originals.set(key, global[key]);
324
+ Object.defineProperty(global, key, {
325
+ get () {
326
+ if (overrides.has(key)) return overrides.get(key);
327
+ if (boundFunction) return boundFunction;
328
+ return win[key];
329
+ },
330
+ set (v) {
331
+ overrides.set(key, v);
332
+ },
333
+ configurable: true
334
+ });
335
+ }
336
+ global.window = global;
337
+ global.self = global;
338
+ global.top = global;
339
+ global.parent = global;
340
+ if (global.global) global.global = global;
341
+ if (global.document?.defaultView) Object.defineProperty(global.document, 'defaultView', {
342
+ get: ()=>global,
343
+ enumerable: true,
344
+ configurable: true
345
+ });
346
+ for (const k of SKIP_KEYS)keys.add(k);
347
+ return ()=>{
348
+ for (const key of keys)delete global[key];
349
+ originals.forEach((v, k)=>{
350
+ global[k] = v;
351
+ });
352
+ };
353
+ }
354
+ function addDefaultErrorHandler(window) {
355
+ let userErrorListenerCount = 0;
356
+ const throwUnhandledError = (e)=>{
357
+ if (0 === userErrorListenerCount && null != e.error) process.emit('uncaughtException', e.error);
358
+ };
359
+ const addEventListener = window.addEventListener.bind(window);
360
+ const removeEventListener = window.removeEventListener.bind(window);
361
+ window.addEventListener('error', throwUnhandledError);
362
+ window.addEventListener = function(...args) {
363
+ if ('error' === args[0]) userErrorListenerCount++;
364
+ return addEventListener.apply(this, args);
365
+ };
366
+ window.removeEventListener = function(...args) {
367
+ if ('error' === args[0] && userErrorListenerCount) userErrorListenerCount--;
368
+ return removeEventListener.apply(this, args);
369
+ };
370
+ return ()=>{
371
+ window.removeEventListener('error', throwUnhandledError);
372
+ };
373
+ }
374
+ }
375
+ };