vitest 0.0.108 → 0.0.112

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/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import require$$0 from 'readline';
2
2
  import { EventEmitter } from 'events';
3
- import { e as ensurePackageInstalled } from './utils-d97bd6d9.js';
4
- import { c as createVitest } from './index-a7df3e65.js';
3
+ import { e as ensurePackageInstalled } from './utils-cb6b1266.js';
4
+ import { c as createVitest } from './index-8ab26d25.js';
5
5
  import 'tty';
6
6
  import 'local-pkg';
7
7
  import 'path';
@@ -11,10 +11,10 @@ import 'fs';
11
11
  import 'os';
12
12
  import 'util';
13
13
  import 'stream';
14
- import './constants-e762cbc5.js';
14
+ import './constants-2b0310b7.js';
15
15
  import 'url';
16
16
  import 'perf_hooks';
17
- import './diff-46ee5d7d.js';
17
+ import './diff-66d6bb83.js';
18
18
  import './index-61c8686f.js';
19
19
  import './_commonjsHelpers-c9e3b764.js';
20
20
  import 'assert';
@@ -634,10 +634,10 @@ class CAC extends EventEmitter {
634
634
 
635
635
  const cac = (name = "") => new CAC(name);
636
636
 
637
- var version = "0.0.108";
637
+ var version = "0.0.112";
638
638
 
639
639
  const cli = cac("vitest");
640
- cli.version(version).option("-r, --root <path>", "root path").option("-c, --config <path>", "path to config file").option("-u, --update", "update snapshot").option("-w, --watch", "watch mode").option("-o, --open", "open Vitest UI").option("--api", "listen to port and serve API").option("--threads", "enabled threads", { default: true }).option("--silent", "silent").option("--coverage", "use c8 for coverage").option("--run", "do not watch").option("--global", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment", { default: "node" }).option("--passWithNoTests", "pass when no tests found").help();
640
+ cli.version(version).option("-r, --root <path>", "root path").option("-c, --config <path>", "path to config file").option("-u, --update", "update snapshot").option("-w, --watch", "watch mode").option("-o, --open", "open Vitest UI").option("--api", "listen to port and serve API").option("--threads", "enabled threads", { default: true }).option("--silent", "silent").option("--reporter <name>", "reporter").option("--coverage", "use c8 for coverage").option("--run", "do not watch").option("--global", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment", { default: "node" }).option("--passWithNoTests", "pass when no tests found").help();
641
641
  cli.command("run [...filters]").action(run);
642
642
  cli.command("watch [...filters]").action(dev);
643
643
  cli.command("dev [...filters]").action(dev);
@@ -1,5 +1,5 @@
1
1
  import { fileURLToPath } from 'url';
2
- import { h as resolve } from './utils-d97bd6d9.js';
2
+ import { h as resolve } from './utils-cb6b1266.js';
3
3
 
4
4
  const distDir = resolve(fileURLToPath(import.meta.url), "../../dist");
5
5
  const defaultInclude = ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];
@@ -1,5 +1,5 @@
1
1
  import { existsSync, promises } from 'fs';
2
- import { k as notNullish, c, r as relative } from './utils-d97bd6d9.js';
2
+ import { k as notNullish, c, r as relative } from './utils-cb6b1266.js';
3
3
 
4
4
  function Diff() {}
5
5
  Diff.prototype = {
@@ -4733,4 +4733,4 @@ function formatLine(line) {
4733
4733
  return cliTruncate(line, (process.stdout.columns || 80) - 4);
4734
4734
  }
4735
4735
 
4736
- export { F_POINTER as F, ansiStyles as a, stripAnsi as b, sliceAnsi as c, F_DOWN as d, F_LONG_DASH as e, F_DOWN_RIGHT as f, F_DOT as g, F_CHECK as h, F_CROSS as i, cliTruncate as j, F_RIGHT as k, printError as p, stringWidth as s, unifiedDiff as u };
4736
+ export { F_POINTER as F, F_DOWN as a, F_LONG_DASH as b, F_DOWN_RIGHT as c, F_DOT as d, F_CHECK as e, F_CROSS as f, F_RIGHT as g, stringWidth as h, ansiStyles as i, sliceAnsi as j, cliTruncate as k, printError as p, stripAnsi as s, unifiedDiff as u };
package/dist/entry.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import fs, { promises } from 'fs';
2
- import { c as clearContext, e as defaultSuite, f as setHooks, h as getHooks, j as context, k as getFn, b as vi } from './vi-9754296d.js';
2
+ import { f as equals, h as iterableEquality, j as subsetEquality, k as isA, J as JestChaiExpect, l as clearContext, m as defaultSuite, n as setHooks, o as getHooks, p as context, s as setState, q as getFn, b as getState, e as vi } from './vi-cb9e4e4e.js';
3
3
  import { Console } from 'console';
4
4
  import { Writable } from 'stream';
5
5
  import { importModule } from 'local-pkg';
6
6
  import chai$1, { expect, util } from 'chai';
7
7
  import { a as commonjsRequire, c as commonjsGlobal } from './_commonjsHelpers-c9e3b764.js';
8
- import { l as index, g as getNames, c as c$1, t as toArray, b as basename, o as interpretOnlyMode, p as partitionSuiteChildren, q as hasTests, j as hasFailed } from './utils-d97bd6d9.js';
8
+ import { l as index, o as getNames, c as c$1, t as toArray, r as relative, p as interpretOnlyMode, q as partitionSuiteChildren, u as hasTests, j as hasFailed } from './utils-cb6b1266.js';
9
9
  import { r as rpc, s as send } from './rpc-7de86f29.js';
10
- import { u as unifiedDiff } from './diff-46ee5d7d.js';
10
+ import { u as unifiedDiff } from './diff-66d6bb83.js';
11
11
  import { performance } from 'perf_hooks';
12
- import { n as nanoid } from './jest-mock-8498c46d.js';
12
+ import { n as nanoid } from './jest-mock-a57b745c.js';
13
13
  import { format as format$1 } from 'util';
14
14
  import 'tty';
15
15
  import 'path';
@@ -1422,13 +1422,13 @@ var _collections$1 = collections;
1422
1422
  // SENTINEL constants are from https://github.com/facebook/immutable-js
1423
1423
  const IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
1424
1424
  const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
1425
- const IS_KEYED_SENTINEL$1 = '@@__IMMUTABLE_KEYED__@@';
1425
+ const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
1426
1426
  const IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';
1427
- const IS_ORDERED_SENTINEL$1 = '@@__IMMUTABLE_ORDERED__@@';
1427
+ const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
1428
1428
  const IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4
1429
1429
 
1430
1430
  const IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';
1431
- const IS_SET_SENTINEL$1 = '@@__IMMUTABLE_SET__@@';
1431
+ const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
1432
1432
  const IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
1433
1433
 
1434
1434
  const getImmutableName = name => 'Immutable.' + name;
@@ -1517,7 +1517,7 @@ const printImmutableSeq = (val, config, indentation, depth, refs, printer) => {
1517
1517
  return printAsLeaf(name);
1518
1518
  }
1519
1519
 
1520
- if (val[IS_KEYED_SENTINEL$1]) {
1520
+ if (val[IS_KEYED_SENTINEL]) {
1521
1521
  return (
1522
1522
  name +
1523
1523
  SPACE +
@@ -1590,7 +1590,7 @@ const serialize$3 = (val, config, indentation, depth, refs, printer) => {
1590
1590
  depth,
1591
1591
  refs,
1592
1592
  printer,
1593
- val[IS_ORDERED_SENTINEL$1] ? 'OrderedMap' : 'Map'
1593
+ val[IS_ORDERED_SENTINEL] ? 'OrderedMap' : 'Map'
1594
1594
  );
1595
1595
  }
1596
1596
 
@@ -1606,7 +1606,7 @@ const serialize$3 = (val, config, indentation, depth, refs, printer) => {
1606
1606
  );
1607
1607
  }
1608
1608
 
1609
- if (val[IS_SET_SENTINEL$1]) {
1609
+ if (val[IS_SET_SENTINEL]) {
1610
1610
  return printImmutableValues(
1611
1611
  val,
1612
1612
  config,
@@ -1614,7 +1614,7 @@ const serialize$3 = (val, config, indentation, depth, refs, printer) => {
1614
1614
  depth,
1615
1615
  refs,
1616
1616
  printer,
1617
- val[IS_ORDERED_SENTINEL$1] ? 'OrderedSet' : 'Set'
1617
+ val[IS_ORDERED_SENTINEL] ? 'OrderedSet' : 'Set'
1618
1618
  );
1619
1619
  }
1620
1620
 
@@ -2187,7 +2187,7 @@ function _interopRequireDefault(obj) {
2187
2187
  */
2188
2188
 
2189
2189
  /* eslint-disable local/ban-types-eventually */
2190
- const toString$1 = Object.prototype.toString;
2190
+ const toString = Object.prototype.toString;
2191
2191
  const toISOString = Date.prototype.toISOString;
2192
2192
  const errorToString = Error.prototype.toString;
2193
2193
  const regExpToString = RegExp.prototype.toString;
@@ -2299,7 +2299,7 @@ function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
2299
2299
  return printSymbol(val);
2300
2300
  }
2301
2301
 
2302
- const toStringed = toString$1.call(val);
2302
+ const toStringed = toString.call(val);
2303
2303
 
2304
2304
  if (toStringed === '[object WeakMap]') {
2305
2305
  return 'WeakMap {}';
@@ -2375,7 +2375,7 @@ function printComplexValue(
2375
2375
  return printer(val.toJSON(), config, indentation, depth, refs, true);
2376
2376
  }
2377
2377
 
2378
- const toStringed = toString$1.call(val);
2378
+ const toStringed = toString.call(val);
2379
2379
 
2380
2380
  if (toStringed === '[object Arguments]') {
2381
2381
  return hitMaxDepth
@@ -3200,238 +3200,6 @@ var matcherUtils = /*#__PURE__*/Object.freeze({
3200
3200
  diff: diff
3201
3201
  });
3202
3202
 
3203
- const isObject = (val) => toString.call(val) === "[object Object]";
3204
- function equals(a, b, customTesters, strictCheck) {
3205
- customTesters = customTesters || [];
3206
- return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
3207
- }
3208
- function isAsymmetric(obj) {
3209
- return !!obj && isA("Function", obj.asymmetricMatch);
3210
- }
3211
- function hasAsymmetric(obj, seen = /* @__PURE__ */ new Set()) {
3212
- if (seen.has(obj))
3213
- return false;
3214
- seen.add(obj);
3215
- if (isAsymmetric(obj))
3216
- return true;
3217
- if (Array.isArray(obj))
3218
- return obj.some((i) => hasAsymmetric(i, seen));
3219
- if (obj instanceof Set)
3220
- return Array.from(obj).some((i) => hasAsymmetric(i, seen));
3221
- if (isObject(obj))
3222
- return Object.values(obj).some((v) => hasAsymmetric(v, seen));
3223
- return false;
3224
- }
3225
- function asymmetricMatch(a, b) {
3226
- const asymmetricA = isAsymmetric(a);
3227
- const asymmetricB = isAsymmetric(b);
3228
- if (asymmetricA && asymmetricB)
3229
- return void 0;
3230
- if (asymmetricA)
3231
- return a.asymmetricMatch(b);
3232
- if (asymmetricB)
3233
- return b.asymmetricMatch(a);
3234
- }
3235
- function eq(a, b, aStack, bStack, customTesters, hasKey2) {
3236
- let result = true;
3237
- const asymmetricResult = asymmetricMatch(a, b);
3238
- if (asymmetricResult !== void 0)
3239
- return asymmetricResult;
3240
- for (let i = 0; i < customTesters.length; i++) {
3241
- const customTesterResult = customTesters[i](a, b);
3242
- if (customTesterResult !== void 0)
3243
- return customTesterResult;
3244
- }
3245
- if (a instanceof Error && b instanceof Error)
3246
- return a.message === b.message;
3247
- if (Object.is(a, b))
3248
- return true;
3249
- if (a === null || b === null)
3250
- return a === b;
3251
- const className = Object.prototype.toString.call(a);
3252
- if (className !== Object.prototype.toString.call(b))
3253
- return false;
3254
- switch (className) {
3255
- case "[object Boolean]":
3256
- case "[object String]":
3257
- case "[object Number]":
3258
- if (typeof a !== typeof b) {
3259
- return false;
3260
- } else if (typeof a !== "object" && typeof b !== "object") {
3261
- return Object.is(a, b);
3262
- } else {
3263
- return Object.is(a.valueOf(), b.valueOf());
3264
- }
3265
- case "[object Date]":
3266
- return +a === +b;
3267
- case "[object RegExp]":
3268
- return a.source === b.source && a.flags === b.flags;
3269
- }
3270
- if (typeof a !== "object" || typeof b !== "object")
3271
- return false;
3272
- if (isDomNode(a) && isDomNode(b))
3273
- return a.isEqualNode(b);
3274
- let length = aStack.length;
3275
- while (length--) {
3276
- if (aStack[length] === a)
3277
- return bStack[length] === b;
3278
- else if (bStack[length] === b)
3279
- return false;
3280
- }
3281
- aStack.push(a);
3282
- bStack.push(b);
3283
- if (className === "[object Array]" && a.length !== b.length)
3284
- return false;
3285
- const aKeys = keys(a, hasKey2);
3286
- let key;
3287
- let size = aKeys.length;
3288
- if (keys(b, hasKey2).length !== size)
3289
- return false;
3290
- while (size--) {
3291
- key = aKeys[size];
3292
- result = hasKey2(b, key) && eq(a[key], b[key], aStack, bStack, customTesters, hasKey2);
3293
- if (!result)
3294
- return false;
3295
- }
3296
- aStack.pop();
3297
- bStack.pop();
3298
- return result;
3299
- }
3300
- function keys(obj, hasKey2) {
3301
- const keys2 = [];
3302
- for (const key in obj) {
3303
- if (hasKey2(obj, key))
3304
- keys2.push(key);
3305
- }
3306
- return keys2.concat(Object.getOwnPropertySymbols(obj).filter((symbol) => Object.getOwnPropertyDescriptor(obj, symbol).enumerable));
3307
- }
3308
- function hasDefinedKey(obj, key) {
3309
- return hasKey(obj, key) && obj[key] !== void 0;
3310
- }
3311
- function hasKey(obj, key) {
3312
- return Object.prototype.hasOwnProperty.call(obj, key);
3313
- }
3314
- function isA(typeName, value) {
3315
- return Object.prototype.toString.apply(value) === `[object ${typeName}]`;
3316
- }
3317
- function isDomNode(obj) {
3318
- return obj !== null && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string" && typeof obj.isEqualNode === "function";
3319
- }
3320
- const IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@";
3321
- const IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@";
3322
- const IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@";
3323
- function isImmutableUnorderedKeyed(maybeKeyed) {
3324
- return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL] && !maybeKeyed[IS_ORDERED_SENTINEL]);
3325
- }
3326
- function isImmutableUnorderedSet(maybeSet) {
3327
- return !!(maybeSet && maybeSet[IS_SET_SENTINEL] && !maybeSet[IS_ORDERED_SENTINEL]);
3328
- }
3329
- const IteratorSymbol = Symbol.iterator;
3330
- const hasIterator = (object) => !!(object != null && object[IteratorSymbol]);
3331
- const iterableEquality = (a, b, aStack = [], bStack = []) => {
3332
- if (typeof a !== "object" || typeof b !== "object" || Array.isArray(a) || Array.isArray(b) || !hasIterator(a) || !hasIterator(b))
3333
- return void 0;
3334
- if (a.constructor !== b.constructor)
3335
- return false;
3336
- let length = aStack.length;
3337
- while (length--) {
3338
- if (aStack[length] === a)
3339
- return bStack[length] === b;
3340
- }
3341
- aStack.push(a);
3342
- bStack.push(b);
3343
- const iterableEqualityWithStack = (a2, b2) => iterableEquality(a2, b2, [...aStack], [...bStack]);
3344
- if (a.size !== void 0) {
3345
- if (a.size !== b.size) {
3346
- return false;
3347
- } else if (isA("Set", a) || isImmutableUnorderedSet(a)) {
3348
- let allFound = true;
3349
- for (const aValue of a) {
3350
- if (!b.has(aValue)) {
3351
- let has = false;
3352
- for (const bValue of b) {
3353
- const isEqual = equals(aValue, bValue, [iterableEqualityWithStack]);
3354
- if (isEqual === true)
3355
- has = true;
3356
- }
3357
- if (has === false) {
3358
- allFound = false;
3359
- break;
3360
- }
3361
- }
3362
- }
3363
- aStack.pop();
3364
- bStack.pop();
3365
- return allFound;
3366
- } else if (isA("Map", a) || isImmutableUnorderedKeyed(a)) {
3367
- let allFound = true;
3368
- for (const aEntry of a) {
3369
- if (!b.has(aEntry[0]) || !equals(aEntry[1], b.get(aEntry[0]), [iterableEqualityWithStack])) {
3370
- let has = false;
3371
- for (const bEntry of b) {
3372
- const matchedKey = equals(aEntry[0], bEntry[0], [
3373
- iterableEqualityWithStack
3374
- ]);
3375
- let matchedValue = false;
3376
- if (matchedKey === true) {
3377
- matchedValue = equals(aEntry[1], bEntry[1], [
3378
- iterableEqualityWithStack
3379
- ]);
3380
- }
3381
- if (matchedValue === true)
3382
- has = true;
3383
- }
3384
- if (has === false) {
3385
- allFound = false;
3386
- break;
3387
- }
3388
- }
3389
- }
3390
- aStack.pop();
3391
- bStack.pop();
3392
- return allFound;
3393
- }
3394
- }
3395
- const bIterator = b[IteratorSymbol]();
3396
- for (const aValue of a) {
3397
- const nextB = bIterator.next();
3398
- if (nextB.done || !equals(aValue, nextB.value, [iterableEqualityWithStack]))
3399
- return false;
3400
- }
3401
- if (!bIterator.next().done)
3402
- return false;
3403
- aStack.pop();
3404
- bStack.pop();
3405
- return true;
3406
- };
3407
- const hasPropertyInObject = (object, key) => {
3408
- const shouldTerminate = !object || typeof object !== "object" || object === Object.prototype;
3409
- if (shouldTerminate)
3410
- return false;
3411
- return Object.prototype.hasOwnProperty.call(object, key) || hasPropertyInObject(Object.getPrototypeOf(object), key);
3412
- };
3413
- const isObjectWithKeys = (a) => isObject(a) && !(a instanceof Error) && !(a instanceof Array) && !(a instanceof Date);
3414
- const subsetEquality = (object, subset) => {
3415
- const subsetEqualityWithContext = (seenReferences = /* @__PURE__ */ new WeakMap()) => (object2, subset2) => {
3416
- if (!isObjectWithKeys(subset2))
3417
- return void 0;
3418
- return Object.keys(subset2).every((key) => {
3419
- if (isObjectWithKeys(subset2[key])) {
3420
- if (seenReferences.has(subset2[key]))
3421
- return equals(object2[key], subset2[key], [iterableEquality]);
3422
- seenReferences.set(subset2[key], true);
3423
- }
3424
- const result = object2 != null && hasPropertyInObject(object2, key) && equals(object2[key], subset2[key], [
3425
- iterableEquality,
3426
- subsetEqualityWithContext(seenReferences)
3427
- ]);
3428
- seenReferences.delete(subset2[key]);
3429
- return result;
3430
- });
3431
- };
3432
- return subsetEqualityWithContext()(object, subset);
3433
- };
3434
-
3435
3203
  var __defProp = Object.defineProperty;
3436
3204
  var __defProps = Object.defineProperties;
3437
3205
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -3499,213 +3267,11 @@ const JestExtend = (chai2, utils) => {
3499
3267
  });
3500
3268
  };
3501
3269
 
3502
- const JestChaiExpect = (chai, utils) => {
3503
- function def(name, fn) {
3504
- const addMethod = (n) => {
3505
- utils.addMethod(chai.Assertion.prototype, n, fn);
3506
- };
3507
- if (Array.isArray(name))
3508
- name.forEach((n) => addMethod(n));
3509
- else
3510
- addMethod(name);
3511
- }
3512
- const chaiEqual = chai.Assertion.prototype.equal;
3513
- def("chaiEqual", function(...args) {
3514
- return chaiEqual.apply(this, args);
3515
- });
3516
- utils.overwriteMethod(chai.Assertion.prototype, "equal", (_super) => {
3517
- return function(...args) {
3518
- const expected = args[0];
3519
- const actual = utils.flag(this, "object");
3520
- if (hasAsymmetric(expected)) {
3521
- this.assert(equals(actual, expected, void 0, true), "not match with #{act}", "should not match with #{act}", actual, expected);
3522
- } else {
3523
- _super.apply(this, args);
3524
- }
3525
- };
3526
- });
3527
- utils.overwriteMethod(chai.Assertion.prototype, "eql", (_super) => {
3528
- return function(...args) {
3529
- const expected = args[0];
3530
- const actual = utils.flag(this, "object");
3531
- if (hasAsymmetric(expected)) {
3532
- this.assert(equals(actual, expected), "not match with #{exp}", "should not match with #{exp}", actual, expected);
3533
- } else {
3534
- _super.apply(this, args);
3535
- }
3536
- };
3537
- });
3538
- def("toEqual", function(expected) {
3539
- return this.eql(expected);
3540
- });
3541
- def("toStrictEqual", function(expected) {
3542
- return this.chaiEqual(expected);
3543
- });
3544
- def("toBe", function(expected) {
3545
- return this.equal(expected);
3546
- });
3547
- def("toMatchObject", function(expected) {
3548
- return this.containSubset(expected);
3549
- });
3550
- def("toMatch", function(expected) {
3551
- if (typeof expected === "string")
3552
- return this.include(expected);
3553
- else
3554
- return this.match(expected);
3555
- });
3556
- def("toContain", function(item) {
3557
- return this.contain(item);
3558
- });
3559
- def("toContainEqual", function(expected) {
3560
- const obj = utils.flag(this, "object");
3561
- const index = Array.from(obj).findIndex((item) => {
3562
- try {
3563
- chai.assert.deepEqual(item, expected);
3564
- } catch {
3565
- return false;
3566
- }
3567
- return true;
3568
- });
3569
- this.assert(index !== -1, "expected #{this} to deep equally contain #{exp}", "expected #{this} to not deep equally contain #{exp}", expected);
3570
- });
3571
- def("toBeTruthy", function() {
3572
- const obj = utils.flag(this, "object");
3573
- this.assert(Boolean(obj), "expected #{this} to be truthy", "expected #{this} to not be truthy", obj);
3574
- });
3575
- def("toBeFalsy", function() {
3576
- const obj = utils.flag(this, "object");
3577
- this.assert(!obj, "expected #{this} to be falsy", "expected #{this} to not be falsy", obj);
3578
- });
3579
- def("toBeGreaterThan", function(expected) {
3580
- return this.to.greaterThan(expected);
3581
- });
3582
- def("toBeGreaterThanOrEqual", function(expected) {
3583
- return this.to.greaterThanOrEqual(expected);
3584
- });
3585
- def("toBeLessThan", function(expected) {
3586
- return this.to.lessThan(expected);
3587
- });
3588
- def("toBeLessThanOrEqual", function(expected) {
3589
- return this.to.lessThanOrEqual(expected);
3590
- });
3591
- def("toBeNaN", function() {
3592
- return this.be.NaN;
3593
- });
3594
- def("toBeUndefined", function() {
3595
- return this.be.undefined;
3596
- });
3597
- def("toBeNull", function() {
3598
- return this.be.null;
3599
- });
3600
- def("toBeDefined", function() {
3601
- return this.not.be.undefined;
3602
- });
3603
- def("toBeInstanceOf", function(obj) {
3604
- return this.instanceOf(obj);
3605
- });
3606
- def("toHaveLength", function(length) {
3607
- return this.have.length(length);
3608
- });
3609
- def("toHaveProperty", function(...args) {
3610
- return this.have.deep.nested.property(...args);
3611
- });
3612
- def("toBeCloseTo", function(number, numDigits = 2) {
3613
- utils.expectTypes(this, ["number"]);
3614
- return this.closeTo(number, numDigits);
3615
- });
3616
- function isSpy(putativeSpy) {
3617
- return typeof putativeSpy === "function" && "__isSpy" in putativeSpy && putativeSpy.__isSpy;
3618
- }
3619
- const assertIsMock = (assertion) => {
3620
- if (!isSpy(assertion._obj))
3621
- throw new TypeError(`${utils.inspect(assertion._obj)} is not a spy or a call to a spy!`);
3622
- };
3623
- const getSpy = (assertion) => {
3624
- assertIsMock(assertion);
3625
- return assertion._obj;
3626
- };
3627
- def(["toHaveBeenCalledTimes", "toBeCalledTimes"], function(number) {
3628
- const spy = getSpy(this);
3629
- return this.assert(spy.callCount === number, "expected spy to be called #{exp} times", "expected spy to not be called #{exp} times", number, spy.callCount);
3630
- });
3631
- def("toHaveBeenCalledOnce", function() {
3632
- const spy = getSpy(this);
3633
- return this.assert(spy.callCount === 1, "expected spy to be called once", "expected spy to not be called once", 1, spy.callCount);
3634
- });
3635
- def(["toHaveBeenCalled", "toBeCalled"], function() {
3636
- const spy = getSpy(this);
3637
- return this.assert(spy.called, "expected spy to be called at least once", "expected spy to not be called at all", true, spy.called);
3638
- });
3639
- def(["toHaveBeenCalledWith", "toBeCalledWith"], function(...args) {
3640
- const spy = getSpy(this);
3641
- const pass = spy.calls.some((callArg) => equals(callArg, args));
3642
- return this.assert(pass, "expected spy to be called with arguments: #{exp}", "expected spy to not be called with arguments: #{exp}", args, spy.calls);
3643
- });
3644
- const ordinalOf = (i) => {
3645
- const j = i % 10;
3646
- const k = i % 100;
3647
- if (j === 1 && k !== 11)
3648
- return `${i}st`;
3649
- if (j === 2 && k !== 12)
3650
- return `${i}nd`;
3651
- if (j === 3 && k !== 13)
3652
- return `${i}rd`;
3653
- return `${i}th`;
3654
- };
3655
- def(["toHaveBeenNthCalledWith", "nthCalledWith"], function(times, ...args) {
3656
- const spy = getSpy(this);
3657
- const nthCall = spy.calls[times - 1];
3658
- this.assert(equals(nthCall, args), `expected ${ordinalOf(times)} spy call to have been called with #{exp}`, `expected ${ordinalOf(times)} spy call to not have been called with #{exp}`, args, nthCall);
3659
- });
3660
- def(["toHaveBeenLastCalledWith", "lastCalledWith"], function(...args) {
3661
- const spy = getSpy(this);
3662
- const lastCall = spy.calls[spy.calls.length - 1];
3663
- this.assert(equals(lastCall, args), "expected last spy call to have been called with #{exp}", "expected last spy call to not have been called with #{exp}", args, lastCall);
3664
- });
3665
- def(["toThrow", "toThrowError"], function(expected) {
3666
- const negate = utils.flag(this, "negate");
3667
- if (negate)
3668
- this.not.to.throw(expected);
3669
- else
3670
- this.to.throw(expected);
3671
- });
3672
- def(["toHaveReturned", "toReturn"], function() {
3673
- const spy = getSpy(this);
3674
- const calledAndNotThrew = spy.called && !spy.results.some(([type]) => type === "error");
3675
- this.assert(calledAndNotThrew, "expected spy to be successfully called at least once", "expected spy to not be successfully called", calledAndNotThrew, !calledAndNotThrew);
3676
- });
3677
- def(["toHaveReturnedTimes", "toReturnTimes"], function(times) {
3678
- const spy = getSpy(this);
3679
- const successfullReturns = spy.results.reduce((success, [type]) => type === "error" ? success : ++success, 0);
3680
- this.assert(successfullReturns === times, `expected spy to be successfully called ${times} times`, `expected spy to not be successfully called ${times} times`, `expected number of returns: ${times}`, `received number of returns: ${successfullReturns}`);
3681
- });
3682
- def(["toHaveReturnedWith", "toReturnWith"], function(value) {
3683
- const spy = getSpy(this);
3684
- const pass = spy.results.some(([type, result]) => type === "ok" && equals(value, result));
3685
- this.assert(pass, "expected spy to be successfully called with #{exp}", "expected spy to not be successfully called with #{exp}", value);
3686
- });
3687
- def(["toHaveLastReturnedWith", "lastReturnedWith"], function(value) {
3688
- const spy = getSpy(this);
3689
- const lastResult = spy.returns[spy.returns.length - 1];
3690
- const pass = equals(lastResult, value);
3691
- this.assert(pass, "expected last spy call to return #{exp}", "expected last spy call to not return #{exp}", value, lastResult);
3692
- });
3693
- def(["toHaveNthReturnedWith", "nthReturnedWith"], function(nthCall, value) {
3694
- const spy = getSpy(this);
3695
- const isNot = utils.flag(this, "negate");
3696
- const [callType, callResult] = spy.results[nthCall - 1];
3697
- const ordinalCall = `${ordinalOf(nthCall)} call`;
3698
- if (!isNot && callType === "error")
3699
- chai.assert.fail(`expected ${ordinalCall} to return #{exp}, but instead it threw an error`);
3700
- const nthCallReturn = equals(callResult, value);
3701
- this.assert(nthCallReturn, `expected ${ordinalCall} spy call to return #{exp}`, `expected ${ordinalCall} spy call to not return #{exp}`, value, callResult);
3702
- });
3703
- };
3704
-
3705
3270
  class AsymmetricMatcher {
3706
3271
  constructor(sample, inverse = false) {
3707
3272
  this.sample = sample;
3708
3273
  this.inverse = inverse;
3274
+ this.$$typeof = Symbol.for("jest.asymmetricMatcher");
3709
3275
  }
3710
3276
  getMatcherContext() {
3711
3277
  return {
@@ -3906,7 +3472,7 @@ async function setupGlobalEnv(config) {
3906
3472
  setupConsoleLogSpy();
3907
3473
  await setupChai();
3908
3474
  if (config.global)
3909
- (await import('./global-e0d00047.js')).registerApiGlobally();
3475
+ (await import('./global-201fd559.js')).registerApiGlobally();
3910
3476
  }
3911
3477
  function setupConsoleLogSpy() {
3912
3478
  const stdout = new Writable({
@@ -3931,13 +3497,12 @@ function setupConsoleLogSpy() {
3931
3497
  callback();
3932
3498
  }
3933
3499
  });
3934
- const newConsole = new Console({
3500
+ globalThis.console = new Console({
3935
3501
  stdout,
3936
3502
  stderr,
3937
3503
  colorMode: true,
3938
3504
  groupIndentation: 2
3939
3505
  });
3940
- globalThis.console = newConsole;
3941
3506
  }
3942
3507
  async function withEnv(name, fn) {
3943
3508
  const env = await environments[name].setup(globalThis);
@@ -3992,7 +3557,7 @@ async function collectTests(paths, config) {
3992
3557
  for (const filepath of paths) {
3993
3558
  const file = {
3994
3559
  id: nanoid(),
3995
- name: basename(filepath),
3560
+ name: relative(config.root, filepath),
3996
3561
  type: "suite",
3997
3562
  mode: "run",
3998
3563
  computeMode: "serial",
@@ -4054,7 +3619,11 @@ async function runTest(test) {
4054
3619
  process.__vitest_worker__.current = test;
4055
3620
  try {
4056
3621
  await callSuiteHook(test.suite, "beforeEach", [test, test.suite]);
3622
+ setState({ assertionCalls: 0, expectedAssertionsNumber: null, expectedAssertionsNumberError: null });
4057
3623
  await getFn(test)();
3624
+ const { assertionCalls, expectedAssertionsNumber, expectedAssertionsNumberError } = getState();
3625
+ if (expectedAssertionsNumber !== null && assertionCalls !== expectedAssertionsNumber)
3626
+ throw expectedAssertionsNumberError;
4058
3627
  test.result.state = "pass";
4059
3628
  } catch (e) {
4060
3629
  test.result.state = "fail";
@@ -1,12 +1,12 @@
1
- import { g as globalApis } from './constants-e762cbc5.js';
2
- import { i as index } from './index-0961cf69.js';
1
+ import { g as globalApis } from './constants-2b0310b7.js';
2
+ import { i as index } from './index-2bb9fd4d.js';
3
3
  import 'url';
4
- import './utils-d97bd6d9.js';
4
+ import './utils-cb6b1266.js';
5
5
  import 'tty';
6
6
  import 'local-pkg';
7
7
  import 'path';
8
- import './vi-9754296d.js';
9
- import './jest-mock-8498c46d.js';
8
+ import './vi-cb9e4e4e.js';
9
+ import './jest-mock-a57b745c.js';
10
10
  import 'chai';
11
11
  import 'tinyspy';
12
12
  import './_commonjsHelpers-c9e3b764.js';