@rstest/core 0.4.0 → 0.5.0

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~85.js CHANGED
@@ -1,7 +1,5 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
- import * as __WEBPACK_EXTERNAL_MODULE_chai__ from "chai";
4
- import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
5
3
  export const __webpack_id__ = "85";
6
4
  export const __webpack_ids__ = [
7
5
  "85"
@@ -13,7 +11,7 @@ export const __webpack_modules__ = {
13
11
  });
14
12
  var dist = __webpack_require__("../../node_modules/.pnpm/@vitest+expect@3.2.4/node_modules/@vitest/expect/dist/index.js");
15
13
  var src_utils = __webpack_require__("./src/utils/index.ts");
16
- var external_chai_ = __webpack_require__("chai");
14
+ var node_modules_chai = __webpack_require__("../../node_modules/.pnpm/chai@5.3.3/node_modules/chai/index.js");
17
15
  var runtime_util = __webpack_require__("./src/runtime/util.ts");
18
16
  const unsupported = [
19
17
  'matchSnapshot',
@@ -34,12 +32,12 @@ export const __webpack_modules__ = {
34
32
  poll: true
35
33
  });
36
34
  fn = fn.bind(assertion);
37
- const test = external_chai_.util.flag(assertion, 'vitest-test');
35
+ const test = node_modules_chai.ZS.flag(assertion, 'vitest-test');
38
36
  if (!test) throw new Error('expect.poll() must be called inside a test');
39
37
  const proxy = new Proxy(assertion, {
40
38
  get (target, key, receiver) {
41
39
  const assertionFunction = Reflect.get(target, key, receiver);
42
- if ('function' != typeof assertionFunction) return assertionFunction instanceof external_chai_.Assertion ? proxy : assertionFunction;
40
+ if ('function' != typeof assertionFunction) return assertionFunction instanceof node_modules_chai.zo ? proxy : assertionFunction;
43
41
  if ('assert' === key) return assertionFunction;
44
42
  if ('string' == typeof key && unsupported.includes(key)) throw new SyntaxError(`expect.poll() is not supported in combination with .${key}(). Use rstest.waitFor() if your assertion condition is unstable.`);
45
43
  return function(...args) {
@@ -50,20 +48,20 @@ export const __webpack_modules__ = {
50
48
  let lastError;
51
49
  const check = async ()=>{
52
50
  try {
53
- external_chai_.util.flag(assertion, '_name', key);
51
+ node_modules_chai.ZS.flag(assertion, '_name', key);
54
52
  const obj = await fn();
55
- external_chai_.util.flag(assertion, 'object', obj);
53
+ node_modules_chai.ZS.flag(assertion, 'object', obj);
56
54
  resolve(await assertionFunction.call(assertion, ...args));
57
55
  clearTimeout(intervalId);
58
56
  clearTimeout(timeoutId);
59
57
  } catch (err) {
60
58
  lastError = err;
61
- if (!external_chai_.util.flag(assertion, '_isLastPollAttempt')) intervalId = (0, runtime_util.rZ)().setTimeout(check, interval);
59
+ if (!node_modules_chai.ZS.flag(assertion, '_isLastPollAttempt')) intervalId = (0, runtime_util.rZ)().setTimeout(check, interval);
62
60
  }
63
61
  };
64
62
  timeoutId = (0, runtime_util.rZ)().setTimeout(()=>{
65
63
  clearTimeout(intervalId);
66
- external_chai_.util.flag(assertion, '_isLastPollAttempt', true);
64
+ node_modules_chai.ZS.flag(assertion, '_isLastPollAttempt', true);
67
65
  const rejectWithCause = (cause)=>{
68
66
  reject(copyStackTrace(new Error(`Matcher did not succeed in ${timeout}ms`, {
69
67
  cause
@@ -77,8 +75,8 @@ export const __webpack_modules__ = {
77
75
  test.onFinished ??= [];
78
76
  test.onFinished.push(()=>{
79
77
  if (!awaited) {
80
- const negated = external_chai_.util.flag(assertion, 'negate') ? 'not.' : '';
81
- const name = external_chai_.util.flag(assertion, '_poll.element') ? 'element(locator)' : 'poll(assertion)';
78
+ const negated = node_modules_chai.ZS.flag(assertion, 'negate') ? 'not.' : '';
79
+ const name = node_modules_chai.ZS.flag(assertion, '_poll.element') ? 'element(locator)' : 'poll(assertion)';
82
80
  const assertionString = `expect.${name}.${negated}${String(key)}()`;
83
81
  const error = new Error(`${assertionString} was not awaited. This assertion is asynchronous and must be awaited; otherwise, it is not executed to avoid unhandled rejections:\n\nawait ${assertionString}\n`);
84
82
  throw copyStackTrace(error, STACK_TRACE_ERROR);
@@ -301,22 +299,22 @@ export const __webpack_modules__ = {
301
299
  });
302
300
  utils.addMethod(chai.expect, 'addSnapshotSerializer', snapshot_dist.U$);
303
301
  };
304
- external_chai_.use(dist.Xs);
305
- external_chai_.use(dist.dB);
306
- external_chai_.use(SnapshotPlugin);
307
- external_chai_.use(dist.Mc);
302
+ node_modules_chai.Yx(dist.Xs);
303
+ node_modules_chai.Yx(dist.dB);
304
+ node_modules_chai.Yx(SnapshotPlugin);
305
+ node_modules_chai.Yx(dist.Mc);
308
306
  function createExpect({ getCurrentTest, workerState }) {
309
307
  const expect = (value, message)=>{
310
308
  const { assertionCalls } = (0, dist.Gu)(expect);
311
309
  (0, dist.wb)({
312
310
  assertionCalls: assertionCalls + 1
313
311
  }, expect);
314
- const assert = external_chai_.expect(value, message);
312
+ const assert = node_modules_chai.E3(value, message);
315
313
  const _test = getCurrentTest();
316
314
  if (_test) return assert.withTest(_test);
317
315
  return assert;
318
316
  };
319
- Object.assign(expect, external_chai_.expect);
317
+ Object.assign(expect, node_modules_chai.E3);
320
318
  Object.assign(expect, globalThis[dist.fs]);
321
319
  expect.getState = ()=>(0, dist.Gu)(expect);
322
320
  expect.setState = (state)=>(0, dist.wb)(state, expect);
@@ -332,14 +330,14 @@ export const __webpack_modules__ = {
332
330
  return workerState.testPath;
333
331
  }
334
332
  }, expect);
335
- expect.extend = (matchers)=>external_chai_.expect.extend(expect, matchers);
333
+ expect.extend = (matchers)=>node_modules_chai.E3.extend(expect, matchers);
336
334
  expect.addEqualityTesters = (customTesters)=>(0, dist.TB)(customTesters);
337
335
  expect.soft = (...args)=>expect(...args).withContext({
338
336
  soft: true
339
337
  });
340
338
  expect.poll = createExpectPoll(expect);
341
339
  expect.unreachable = (message)=>{
342
- external_chai_.assert.fail(`expected ${message ? `"${message}" ` : ''}not to be reached`);
340
+ node_modules_chai.vA.fail(`expected ${message ? `"${message}" ` : ''}not to be reached`);
343
341
  };
344
342
  function assertions(expected) {
345
343
  const errorGen = ()=>new Error(`expected number of assertions to be ${expected}, but got ${expect.getState().assertionCalls}`);
@@ -357,8 +355,8 @@ export const __webpack_modules__ = {
357
355
  isExpectingAssertionsError: error
358
356
  });
359
357
  }
360
- external_chai_.util.addMethod(expect, 'assertions', assertions);
361
- external_chai_.util.addMethod(expect, 'hasAssertions', hasAssertions);
358
+ node_modules_chai.ZS.addMethod(expect, 'assertions', assertions);
359
+ node_modules_chai.ZS.addMethod(expect, 'hasAssertions', hasAssertions);
362
360
  expect.extend(dist.Pf);
363
361
  return expect;
364
362
  }
@@ -1813,7 +1811,7 @@ export const __webpack_modules__ = {
1813
1811
  api: {
1814
1812
  ...runnerAPI,
1815
1813
  expect,
1816
- assert: external_chai_.assert,
1814
+ assert: node_modules_chai.vA,
1817
1815
  rstest,
1818
1816
  rs: rstest
1819
1817
  }
@@ -1821,28 +1819,5 @@ export const __webpack_modules__ = {
1821
1819
  globalThis.RSTEST_API = runtime.api;
1822
1820
  return runtime;
1823
1821
  };
1824
- },
1825
- "./src/utils/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1826
- __webpack_require__.d(__webpack_exports__, {
1827
- fN: ()=>helper.fN,
1828
- Gv: ()=>helper.Gv,
1829
- kV: ()=>helper.kV,
1830
- q_: ()=>constants.q_,
1831
- bg: ()=>helper.bg,
1832
- yW: ()=>helper.yW
1833
- });
1834
- var constants = __webpack_require__("./src/utils/constants.ts");
1835
- var helper = __webpack_require__("./src/utils/helper.ts");
1836
- __webpack_require__("./src/utils/logger.ts");
1837
- __webpack_require__("node:fs");
1838
- __webpack_require__("node:fs/promises");
1839
- __webpack_require__("node:module");
1840
- __webpack_require__("pathe");
1841
- },
1842
- chai: function(module) {
1843
- module.exports = __WEBPACK_EXTERNAL_MODULE_chai__;
1844
- },
1845
- "node:fs/promises": function(module) {
1846
- module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__;
1847
1822
  }
1848
1823
  };
@@ -1,10 +1,9 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
- import { isCI } from "std-env";
4
3
  import { stripVTControlCharacters } from "node:util";
5
- export const __webpack_id__ = "669";
4
+ export const __webpack_id__ = "876";
6
5
  export const __webpack_ids__ = [
7
- "669"
6
+ "876"
8
7
  ];
9
8
  export const __webpack_modules__ = {
10
9
  "./src/core/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
@@ -13,7 +12,8 @@ export const __webpack_modules__ = {
13
12
  });
14
13
  var external_node_fs_ = __webpack_require__("node:fs");
15
14
  var manager = __webpack_require__("../../node_modules/.pnpm/@vitest+snapshot@3.2.4/node_modules/@vitest/snapshot/dist/manager.js");
16
- var external_pathe_ = __webpack_require__("pathe");
15
+ var pathe_M_eThtNZ = __webpack_require__("../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs");
16
+ var dist = __webpack_require__("../../node_modules/.pnpm/std-env@3.9.0/node_modules/std-env/dist/index.mjs");
17
17
  var src_config = __webpack_require__("./src/config.ts");
18
18
  var stack_trace_parser_esm = __webpack_require__("../../node_modules/.pnpm/stacktrace-parser@0.1.11/node_modules/stacktrace-parser/dist/stack-trace-parser.esm.js");
19
19
  var utils = __webpack_require__("./src/utils/index.ts");
@@ -152,7 +152,7 @@ export const __webpack_modules__ = {
152
152
  getContent() {
153
153
  const summary = [];
154
154
  for (const module of this.runningModules){
155
- const relativePath = (0, external_pathe_.relative)(this.rootPath, module);
155
+ const relativePath = (0, pathe_M_eThtNZ.b)(this.rootPath, module);
156
156
  summary.push(`${utils.yW.bgYellow(utils.yW.bold(' RUNS '))} ${(0, utils.EQ)(relativePath)}`);
157
157
  }
158
158
  summary.push('');
@@ -171,6 +171,7 @@ export const __webpack_modules__ = {
171
171
  this.renderer?.finish();
172
172
  }
173
173
  }
174
+ var pathe_dist = __webpack_require__("../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.mjs");
174
175
  const getSummaryStatusString = (tasks, name = 'tests', showTotal = true)=>{
175
176
  if (0 === tasks.length) return utils.yW.dim(`no ${name}`);
176
177
  const passed = tasks.filter((result)=>'pass' === result.status);
@@ -229,7 +230,7 @@ export const __webpack_modules__ = {
229
230
  utils.vF.log(utils.yW.bold('Summary of all failing tests:'));
230
231
  utils.vF.log('');
231
232
  for (const test of failedTests){
232
- const relativePath = external_pathe_["default"].relative(rootPath, test.testPath);
233
+ const relativePath = pathe_dist.Ay.relative(rootPath, test.testPath);
233
234
  const nameStr = (0, utils.fN)(test);
234
235
  utils.vF.log(`${utils.yW.bgRed(' FAIL ')} ${(0, utils.EQ)(relativePath)} ${nameStr.length ? `${utils.yW.dim(utils.vO)} ${nameStr}` : ''}`);
235
236
  if (test.errors) {
@@ -276,14 +277,14 @@ export const __webpack_modules__ = {
276
277
  this.rootPath = rootPath;
277
278
  this.config = config;
278
279
  this.options = options;
279
- if (!isCI) this.statusRenderer = new StatusRenderer(rootPath);
280
+ if (!dist.JO) this.statusRenderer = new StatusRenderer(rootPath);
280
281
  }
281
282
  onTestFileStart(test) {
282
283
  this.statusRenderer?.addRunningModule(test.testPath);
283
284
  }
284
285
  onTestFileResult(test) {
285
286
  this.statusRenderer?.removeRunningModule(test.testPath);
286
- const relativePath = (0, external_pathe_.relative)(this.rootPath, test.testPath);
287
+ const relativePath = (0, pathe_M_eThtNZ.b)(this.rootPath, test.testPath);
287
288
  const { slowTestThreshold } = this.config;
288
289
  logFileTitle(test, relativePath, slowTestThreshold);
289
290
  const isTooSlow = test.duration && test.duration > slowTestThreshold;
@@ -303,10 +304,10 @@ export const __webpack_modules__ = {
303
304
  const titles = [
304
305
  log.name
305
306
  ];
306
- const testPath = (0, external_pathe_.relative)(this.rootPath, log.testPath);
307
+ const testPath = (0, pathe_M_eThtNZ.b)(this.rootPath, log.testPath);
307
308
  if (log.trace) {
308
309
  const [frame] = (0, stack_trace_parser_esm.q)(log.trace);
309
- const filePath = (0, external_pathe_.relative)(this.rootPath, frame.file || '');
310
+ const filePath = (0, pathe_M_eThtNZ.b)(this.rootPath, frame.file || '');
310
311
  if (filePath !== testPath) titles.push((0, utils.EQ)(testPath));
311
312
  titles.push((0, utils.EQ)(filePath) + utils.yW.gray(`:${frame.lineNumber}:${frame.column}`));
312
313
  } else titles.push((0, utils.EQ)(testPath));
@@ -357,7 +358,7 @@ export const __webpack_modules__ = {
357
358
  for (const test of failedTests){
358
359
  const { testPath } = test;
359
360
  const nameStr = (0, utils.fN)(test);
360
- const shortPath = (0, external_pathe_.relative)(this.rootPath, testPath);
361
+ const shortPath = (0, pathe_M_eThtNZ.b)(this.rootPath, testPath);
361
362
  const title = `${shortPath} ${utils.vO} ${nameStr}`;
362
363
  for (const error of test.errors || []){
363
364
  let file = testPath;
@@ -414,7 +415,7 @@ export const __webpack_modules__ = {
414
415
  async createJUnitTestCase(test, getSourcemap) {
415
416
  const testCase = {
416
417
  name: (0, utils.fN)(test),
417
- classname: (0, external_pathe_.relative)(this.rootPath, test.testPath),
418
+ classname: (0, pathe_M_eThtNZ.b)(this.rootPath, test.testPath),
418
419
  time: (test.duration || 0) / 1000,
419
420
  status: test.status
420
421
  };
@@ -441,7 +442,7 @@ export const __webpack_modules__ = {
441
442
  const skipped = testCases.filter((test)=>'skip' === test.status || 'todo' === test.status).length;
442
443
  const totalTime = testCases.reduce((sum, test)=>sum + test.time, 0);
443
444
  return {
444
- name: (0, external_pathe_.relative)(this.rootPath, fileResult.testPath),
445
+ name: (0, pathe_M_eThtNZ.b)(this.rootPath, fileResult.testPath),
445
446
  tests: testCases.length,
446
447
  failures,
447
448
  errors,
@@ -513,7 +514,7 @@ export const __webpack_modules__ = {
513
514
  class VerboseReporter extends DefaultReporter {
514
515
  onTestFileResult(test) {
515
516
  this.statusRenderer?.removeRunningModule(test.testPath);
516
- const relativePath = (0, external_pathe_.relative)(this.rootPath, test.testPath);
517
+ const relativePath = (0, pathe_M_eThtNZ.b)(this.rootPath, test.testPath);
517
518
  const { slowTestThreshold } = this.config;
518
519
  logFileTitle(test, relativePath, slowTestThreshold, true);
519
520
  for (const result of test.results)logCase(result, slowTestThreshold);
@@ -545,17 +546,20 @@ export const __webpack_modules__ = {
545
546
  this.fileFilters = fileFilters;
546
547
  this.configFilePath = configFilePath;
547
548
  const rootPath = userConfig.root ? (0, utils.FI)(cwd, userConfig.root) : cwd;
548
- const rstestConfig = (0, src_config.wX)(userConfig);
549
+ const rstestConfig = (0, src_config.wX)({
550
+ ...userConfig,
551
+ root: rootPath
552
+ });
549
553
  const reporters = 'list' !== command ? createReporters(rstestConfig.reporters, {
550
554
  rootPath,
551
555
  config: rstestConfig
552
556
  }) : [];
553
557
  const snapshotManager = new manager.CW({
554
- updateSnapshot: rstestConfig.update ? 'all' : isCI ? 'none' : 'new'
558
+ updateSnapshot: rstestConfig.update ? 'all' : dist.JO ? 'none' : 'new'
555
559
  });
556
560
  this.reporters = reporters;
557
561
  this.snapshotManager = snapshotManager;
558
- this.version = "0.4.0";
562
+ this.version = "0.5.0";
559
563
  this.rootPath = rootPath;
560
564
  this.originalConfig = userConfig;
561
565
  this.normalizedConfig = rstestConfig;
@@ -565,7 +569,7 @@ export const __webpack_modules__ = {
565
569
  config.source ??= {};
566
570
  config.coverage = rstestConfig.coverage;
567
571
  if (!config.source.tsconfigPath) {
568
- const tsconfigPath = (0, external_pathe_.join)(config.root, utils.WB);
572
+ const tsconfigPath = (0, pathe_M_eThtNZ.j)(config.root, utils.WB);
569
573
  if ((0, external_node_fs_.existsSync)(tsconfigPath)) config.source.tsconfigPath = tsconfigPath;
570
574
  }
571
575
  return {
@@ -637,14 +641,14 @@ export const __webpack_modules__ = {
637
641
  }, config);
638
642
  const runTests = async ()=>{
639
643
  const { runTests } = await Promise.all([
640
- __webpack_require__.e("938"),
644
+ __webpack_require__.e("816"),
641
645
  __webpack_require__.e("33")
642
646
  ]).then(__webpack_require__.bind(__webpack_require__, "./src/core/runTests.ts"));
643
647
  await runTests(context);
644
648
  };
645
649
  const listTests = async (options)=>{
646
650
  const { listTests } = await Promise.all([
647
- __webpack_require__.e("938"),
651
+ __webpack_require__.e("816"),
648
652
  __webpack_require__.e("971")
649
653
  ]).then(__webpack_require__.bind(__webpack_require__, "./src/core/listTests.ts"));
650
654
  await listTests(context, options);