vitest 0.0.92 → 0.0.93

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/bin/vitest.mjs CHANGED
@@ -6,6 +6,9 @@ import { ensurePackageInstalled } from '../dist/utils.js'
6
6
 
7
7
  const argv = process.argv.slice(2)
8
8
 
9
+ if (!await ensurePackageInstalled('vite'))
10
+ process.exit(1)
11
+
9
12
  if (argv.includes('--coverage')) {
10
13
  if (!await ensurePackageInstalled('c8'))
11
14
  process.exit(1)
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import require$$0 from 'readline';
2
2
  import { EventEmitter } from 'events';
3
- import { c, e as ensurePackageInstalled } from './utils-860e5f7e.js';
4
- import { c as createVitest } from './index-40ecbcb4.js';
3
+ import { c, e as ensurePackageInstalled } from './utils-576876dc.js';
4
+ import { c as createVitest } from './index-880654a3.js';
5
5
  import 'tty';
6
6
  import 'local-pkg';
7
7
  import 'path';
@@ -13,7 +13,7 @@ import 'util';
13
13
  import './constants-9cfa4d7b.js';
14
14
  import 'url';
15
15
  import 'perf_hooks';
16
- import './error-4b0c4b4b.js';
16
+ import './error-bf2213e4.js';
17
17
  import 'source-map';
18
18
  import './index-5cc247ff.js';
19
19
  import 'assert';
@@ -633,7 +633,7 @@ class CAC extends EventEmitter {
633
633
 
634
634
  const cac = (name = "") => new CAC(name);
635
635
 
636
- var version = "0.0.92";
636
+ var version = "0.0.93";
637
637
 
638
638
  const cli = cac("vitest");
639
639
  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("--global", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment", {
@@ -654,16 +654,18 @@ async function run(cliFilters, options) {
654
654
  process.env.NODE_ENV = "test";
655
655
  if (!options.silent) {
656
656
  console.log(c.magenta(c.bold("\nVitest is in closed beta exclusively for Sponsors")));
657
- console.log(c.yellow("Learn more at https://vitest.dev\n"));
657
+ console.log(c.yellow("Learn more at https://vitest.dev"));
658
658
  }
659
659
  const ctx = await createVitest(options);
660
- process.__vitest__ = ctx;
661
660
  process.chdir(ctx.config.root);
662
661
  registerConsoleShortcuts(ctx);
663
662
  if (ctx.config.environment && ctx.config.environment !== "node") {
664
663
  if (!await ensurePackageInstalled(ctx.config.environment))
665
664
  process.exit(1);
666
665
  }
666
+ ctx.onServerRestarted(() => {
667
+ ctx.start(cliFilters);
668
+ });
667
669
  try {
668
670
  await ctx.start(cliFilters);
669
671
  } catch (e) {
package/dist/entry.js CHANGED
@@ -6,8 +6,8 @@ import chai, { expect, util } from 'chai';
6
6
  import Subset from 'chai-subset';
7
7
  import path, { basename } from 'path';
8
8
  import { r as rpc, s as send } from './rpc-7de86f29.js';
9
- import { g as getNames, c as c$1, t as toArray, i as interpretOnlyMode, p as partitionSuiteChildren, d as hasTests, h as hasFailed } from './utils-860e5f7e.js';
10
- import { u as unifiedDiff } from './error-4b0c4b4b.js';
9
+ import { g as getNames, c as c$1, t as toArray, i as interpretOnlyMode, p as partitionSuiteChildren, f as hasTests, h as hasFailed } from './utils-576876dc.js';
10
+ import { u as unifiedDiff } from './error-bf2213e4.js';
11
11
  import { performance } from 'perf_hooks';
12
12
  import { b as setHooks, c as createSuiteHooks, e as clearContext, f as defaultSuite, h as context, j as getHooks, k as getFn } from './suite-b8c6cb53.js';
13
13
  import { n as nanoid } from './index-9e71c815.js';
@@ -3534,7 +3534,7 @@ const JestChaiExpect = (chai, utils) => {
3534
3534
  def(["toHaveBeenCalledWith", "toBeCalledWith"], function(...args) {
3535
3535
  const spy = getSpy(this);
3536
3536
  const pass = spy.calls.some((callArg) => equals(callArg, args));
3537
- return this.assert(pass, "expected spy to be called with arguments: #{exp}", "expected spy to not be called with arguments: #{exp}", args);
3537
+ return this.assert(pass, "expected spy to be called with arguments: #{exp}", "expected spy to not be called with arguments: #{exp}", args, spy.calls);
3538
3538
  });
3539
3539
  const ordinalOf = (i) => {
3540
3540
  const j = i % 10;
@@ -3629,7 +3629,7 @@ class StringContaining extends AsymmetricMatcher {
3629
3629
  }
3630
3630
  class Anything extends AsymmetricMatcher {
3631
3631
  asymmetricMatch(other) {
3632
- return other !== void 0 && other !== null;
3632
+ return other != null;
3633
3633
  }
3634
3634
  toString() {
3635
3635
  return "Anything";
@@ -3638,11 +3638,127 @@ class Anything extends AsymmetricMatcher {
3638
3638
  return "Anything";
3639
3639
  }
3640
3640
  }
3641
+ class ObjectContaining extends AsymmetricMatcher {
3642
+ constructor(sample, inverse = false) {
3643
+ super(sample, inverse);
3644
+ }
3645
+ getPrototype(obj) {
3646
+ if (Object.getPrototypeOf)
3647
+ return Object.getPrototypeOf(obj);
3648
+ if (obj.constructor.prototype === obj)
3649
+ return null;
3650
+ return obj.constructor.prototype;
3651
+ }
3652
+ hasProperty(obj, property) {
3653
+ if (!obj)
3654
+ return false;
3655
+ if (Object.prototype.hasOwnProperty.call(obj, property))
3656
+ return true;
3657
+ return this.hasProperty(this.getPrototype(obj), property);
3658
+ }
3659
+ asymmetricMatch(other) {
3660
+ if (typeof this.sample !== "object") {
3661
+ throw new TypeError(`You must provide an object to ${this.toString()}, not '${typeof this.sample}'.`);
3662
+ }
3663
+ let result = true;
3664
+ for (const property in this.sample) {
3665
+ if (!this.hasProperty(other, property) || !equals(this.sample[property], other[property])) {
3666
+ result = false;
3667
+ break;
3668
+ }
3669
+ }
3670
+ return this.inverse ? !result : result;
3671
+ }
3672
+ toString() {
3673
+ return `Object${this.inverse ? "Not" : ""}Containing`;
3674
+ }
3675
+ getExpectedType() {
3676
+ return "object";
3677
+ }
3678
+ }
3679
+ class ArrayContaining extends AsymmetricMatcher {
3680
+ constructor(sample, inverse = false) {
3681
+ super(sample, inverse);
3682
+ }
3683
+ asymmetricMatch(other) {
3684
+ if (!Array.isArray(this.sample)) {
3685
+ throw new TypeError(`You must provide an array to ${this.toString()}, not '${typeof this.sample}'.`);
3686
+ }
3687
+ const result = this.sample.length === 0 || Array.isArray(other) && this.sample.every((item) => other.some((another) => equals(item, another)));
3688
+ return this.inverse ? !result : result;
3689
+ }
3690
+ toString() {
3691
+ return `Array${this.inverse ? "Not" : ""}Containing`;
3692
+ }
3693
+ getExpectedType() {
3694
+ return "array";
3695
+ }
3696
+ }
3697
+ class Any extends AsymmetricMatcher {
3698
+ constructor(sample) {
3699
+ if (typeof sample === "undefined") {
3700
+ throw new TypeError("any() expects to be passed a constructor function. Please pass one or use anything() to match any object.");
3701
+ }
3702
+ super(sample);
3703
+ }
3704
+ fnNameFor(func) {
3705
+ if (func.name)
3706
+ return func.name;
3707
+ const functionToString = Function.prototype.toString;
3708
+ const matches = functionToString.call(func).match(/^(?:async)?\s*function\s*\*?\s*([\w$]+)\s*\(/);
3709
+ return matches ? matches[1] : "<anonymous>";
3710
+ }
3711
+ asymmetricMatch(other) {
3712
+ if (this.sample === String)
3713
+ return typeof other == "string" || other instanceof String;
3714
+ if (this.sample === Number)
3715
+ return typeof other == "number" || other instanceof Number;
3716
+ if (this.sample === Function)
3717
+ return typeof other == "function" || other instanceof Function;
3718
+ if (this.sample === Boolean)
3719
+ return typeof other == "boolean" || other instanceof Boolean;
3720
+ if (this.sample === BigInt)
3721
+ return typeof other == "bigint" || other instanceof BigInt;
3722
+ if (this.sample === Symbol)
3723
+ return typeof other == "symbol" || other instanceof Symbol;
3724
+ if (this.sample === Object)
3725
+ return typeof other == "object";
3726
+ return other instanceof this.sample;
3727
+ }
3728
+ toString() {
3729
+ return "Any";
3730
+ }
3731
+ getExpectedType() {
3732
+ if (this.sample === String)
3733
+ return "string";
3734
+ if (this.sample === Number)
3735
+ return "number";
3736
+ if (this.sample === Function)
3737
+ return "function";
3738
+ if (this.sample === Object)
3739
+ return "object";
3740
+ if (this.sample === Boolean)
3741
+ return "boolean";
3742
+ return this.fnNameFor(this.sample);
3743
+ }
3744
+ toAsymmetricMatcher() {
3745
+ return `Any<${this.fnNameFor(this.sample)}>`;
3746
+ }
3747
+ }
3641
3748
  const JestAsymmetricMatchers = (chai, utils) => {
3642
3749
  utils.addMethod(chai.expect, "stringContaining", (expected) => new StringContaining(expected));
3643
3750
  utils.addMethod(chai.expect, "anything", () => {
3644
3751
  return new Anything();
3645
3752
  });
3753
+ utils.addMethod(chai.expect, "objectContaining", (expected) => {
3754
+ return new ObjectContaining(expected);
3755
+ });
3756
+ utils.addMethod(chai.expect, "any", (expected) => {
3757
+ return new Any(expected);
3758
+ });
3759
+ utils.addMethod(chai.expect, "arrayContaining", (expected) => {
3760
+ return new ArrayContaining(expected);
3761
+ });
3646
3762
  };
3647
3763
 
3648
3764
  let installed = false;
@@ -1,6 +1,6 @@
1
1
  import { existsSync, promises } from 'fs';
2
2
  import { relative } from 'path';
3
- import { n as notNullish, c } from './utils-860e5f7e.js';
3
+ import { d as notNullish, c } from './utils-576876dc.js';
4
4
  import { SourceMapConsumer } from 'source-map';
5
5
 
6
6
  function Diff() {}
@@ -5,9 +5,9 @@ import { promises } from 'fs';
5
5
  import fg from 'fast-glob';
6
6
  import require$$0 from 'util';
7
7
  import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-9cfa4d7b.js';
8
- import { c, g as getNames, s as slash, a as getTests, b as getSuites, t as toArray, h as hasFailed } from './utils-860e5f7e.js';
8
+ import { c, g as getNames, s as slash, a as getTests, b as getSuites, n as noop, t as toArray, h as hasFailed } from './utils-576876dc.js';
9
9
  import { performance } from 'perf_hooks';
10
- import { s as stringWidth, a as ansiStyles, b as stripAnsi, c as sliceAnsi, F as F_POINTER, d as F_DOWN, e as F_LONG_DASH, f as F_DOWN_RIGHT, g as F_DOT, h as F_CHECK, i as F_CROSS, j as cliTruncate, k as F_RIGHT, p as printError } from './error-4b0c4b4b.js';
10
+ import { s as stringWidth, a as ansiStyles, b as stripAnsi, c as sliceAnsi, F as F_POINTER, d as F_DOWN, e as F_LONG_DASH, f as F_DOWN_RIGHT, g as F_DOT, h as F_CHECK, i as F_CROSS, j as cliTruncate, k as F_RIGHT, p as printError } from './error-bf2213e4.js';
11
11
  import { o as onetime, s as signalExit } from './index-5cc247ff.js';
12
12
  import { MessageChannel } from 'worker_threads';
13
13
  import { pathToFileURL } from 'url';
@@ -4971,7 +4971,8 @@ class ConsoleReporter {
4971
4971
  this.console = globalThis.console;
4972
4972
  this.isFirstWatchRun = true;
4973
4973
  const mode = ctx.config.watch ? c.yellow(" DEV ") : c.cyan(" RUN ");
4974
- this.log(`${c.inverse(c.bold(mode))} ${c.gray(this.ctx.config.root)}
4974
+ this.log(`
4975
+ ${c.inverse(c.bold(mode))} ${c.gray(this.ctx.config.root)}
4975
4976
  `);
4976
4977
  this.start = performance.now();
4977
4978
  }
@@ -5110,7 +5111,6 @@ ${c.bold(c.inverse(c.green(" PASS ")))}${c.green(" Waiting for file changes...")
5110
5111
  `);
5111
5112
  }
5112
5113
  onServerRestart() {
5113
- this.console.clear();
5114
5114
  this.log(c.cyan("Restarted due to config changes..."));
5115
5115
  }
5116
5116
  }
@@ -5343,11 +5343,17 @@ class Vitest {
5343
5343
  this.invalidates = /* @__PURE__ */ new Set();
5344
5344
  this.changedTests = /* @__PURE__ */ new Set();
5345
5345
  this.isFirstRun = true;
5346
+ this.restartsCount = 0;
5347
+ this._onRestartListeners = [];
5348
+ this.unregisterWatcher = noop;
5346
5349
  this.console = globalThis.console;
5347
5350
  }
5348
5351
  setServer(options, server) {
5349
- var _a;
5350
- (_a = this.pool) == null ? void 0 : _a.close();
5352
+ var _a, _b;
5353
+ (_a = this.unregisterWatcher) == null ? void 0 : _a.call(this);
5354
+ clearTimeout(this._rerunTimer);
5355
+ this.restartsCount += 1;
5356
+ (_b = this.pool) == null ? void 0 : _b.close();
5351
5357
  this.pool = void 0;
5352
5358
  const resolved = resolveConfig(options, server.config);
5353
5359
  this.server = server;
@@ -5360,6 +5366,7 @@ class Vitest {
5360
5366
  if (this.config.watch)
5361
5367
  this.registerWatcher();
5362
5368
  this.runningPromise = void 0;
5369
+ this._onRestartListeners.forEach((fn) => fn());
5363
5370
  }
5364
5371
  async start(filters) {
5365
5372
  const files = await this.globTestFiles(filters);
@@ -5368,11 +5375,8 @@ class Vitest {
5368
5375
  process.exitCode = 1;
5369
5376
  }
5370
5377
  await this.runFiles(files);
5371
- if (this.config.watch) {
5378
+ if (this.config.watch)
5372
5379
  await this.report("onWatcherStart");
5373
- await new Promise(() => {
5374
- });
5375
- }
5376
5380
  }
5377
5381
  async runFiles(files) {
5378
5382
  await this.runningPromise;
@@ -5390,44 +5394,59 @@ class Vitest {
5390
5394
  });
5391
5395
  return await this.runningPromise;
5392
5396
  }
5397
+ async scheduleRerun(triggerId) {
5398
+ const currentCount = this.restartsCount;
5399
+ clearTimeout(this._rerunTimer);
5400
+ await this.runningPromise;
5401
+ clearTimeout(this._rerunTimer);
5402
+ if (this.restartsCount !== currentCount)
5403
+ return;
5404
+ this._rerunTimer = setTimeout(async () => {
5405
+ if (this.changedTests.size === 0) {
5406
+ this.invalidates.clear();
5407
+ return;
5408
+ }
5409
+ if (this.restartsCount !== currentCount)
5410
+ return;
5411
+ this.isFirstRun = false;
5412
+ const files = Array.from(this.changedTests);
5413
+ await this.report("onWatcherRerun", files, triggerId);
5414
+ await this.runFiles(files);
5415
+ await this.report("onWatcherStart");
5416
+ }, WATCHER_DEBOUNCE);
5417
+ }
5393
5418
  registerWatcher() {
5394
- let timer;
5395
- const scheduleRerun = async (id) => {
5396
- await this.runningPromise;
5397
- clearTimeout(timer);
5398
- timer = setTimeout(async () => {
5399
- if (this.changedTests.size === 0) {
5400
- this.invalidates.clear();
5401
- return;
5402
- }
5403
- this.isFirstRun = false;
5404
- const files = Array.from(this.changedTests);
5405
- await this.report("onWatcherRerun", files, id);
5406
- await this.runFiles(files);
5407
- await this.report("onWatcherStart");
5408
- }, WATCHER_DEBOUNCE);
5409
- };
5410
- this.server.watcher.on("change", (id) => {
5419
+ const onChange = (id) => {
5411
5420
  id = slash(id);
5412
5421
  this.handleFileChanged(id);
5413
5422
  if (this.changedTests.size)
5414
- scheduleRerun(id);
5415
- });
5416
- this.server.watcher.on("unlink", (id) => {
5423
+ this.scheduleRerun(id);
5424
+ };
5425
+ const onUnlink = (id) => {
5417
5426
  id = slash(id);
5418
5427
  this.invalidates.add(id);
5419
5428
  if (id in this.state.filesMap) {
5420
5429
  delete this.state.filesMap[id];
5421
5430
  this.changedTests.delete(id);
5422
5431
  }
5423
- });
5424
- this.server.watcher.on("add", async (id) => {
5432
+ };
5433
+ const onAdd = (id) => {
5425
5434
  id = slash(id);
5426
5435
  if (this.isTargetFile(id)) {
5427
5436
  this.changedTests.add(id);
5428
- scheduleRerun(id);
5437
+ this.scheduleRerun(id);
5429
5438
  }
5430
- });
5439
+ };
5440
+ const watcher = this.server.watcher;
5441
+ watcher.on("change", onChange);
5442
+ watcher.on("unlink", onUnlink);
5443
+ watcher.on("add", onAdd);
5444
+ this.unregisterWatcher = () => {
5445
+ watcher.off("change", onChange);
5446
+ watcher.off("unlink", onUnlink);
5447
+ watcher.off("add", onAdd);
5448
+ this.unregisterWatcher = noop;
5449
+ };
5431
5450
  }
5432
5451
  handleFileChanged(id) {
5433
5452
  if (this.changedTests.has(id) || this.invalidates.has(id) || id.includes("/node_modules/") || id.includes("/vitest/dist/"))
@@ -5471,6 +5490,9 @@ class Vitest {
5471
5490
  return false;
5472
5491
  return micromatch_1.isMatch(id, this.config.include);
5473
5492
  }
5493
+ onServerRestarted(fn) {
5494
+ this._onRestartListeners.push(fn);
5495
+ }
5474
5496
  }
5475
5497
  async function createVitest(options, viteOverrides = {}) {
5476
5498
  const ctx = new Vitest();
@@ -5491,7 +5513,7 @@ async function createVitest(options, viteOverrides = {}) {
5491
5513
  ctx.setServer(options, server2);
5492
5514
  haveStarted = true;
5493
5515
  if (options.api)
5494
- server2.middlewares.use((await import('./middleware-b1884a99.js')).default());
5516
+ server2.middlewares.use((await import('./middleware-bf0f818d.js')).default(ctx));
5495
5517
  }
5496
5518
  }
5497
5519
  ],
@@ -5507,6 +5529,8 @@ async function createVitest(options, viteOverrides = {}) {
5507
5529
  };
5508
5530
  const server = await createServer(mergeConfig(config, viteOverrides));
5509
5531
  await server.pluginContainer.buildStart({});
5532
+ if (options.api === true)
5533
+ options.api = defaultPort;
5510
5534
  if (typeof options.api === "number")
5511
5535
  await server.listen(options.api);
5512
5536
  return ctx;
package/dist/index.d.ts CHANGED
@@ -129,6 +129,28 @@ declare class Anything extends AsymmetricMatcher<void> {
129
129
  toString(): string;
130
130
  toAsymmetricMatcher(): string;
131
131
  }
132
+ declare class ObjectContaining extends AsymmetricMatcher<Record<string, unknown>> {
133
+ constructor(sample: Record<string, unknown>, inverse?: boolean);
134
+ getPrototype(obj: object): any;
135
+ hasProperty(obj: object | null, property: string): boolean;
136
+ asymmetricMatch(other: any): boolean;
137
+ toString(): string;
138
+ getExpectedType(): string;
139
+ }
140
+ declare class ArrayContaining extends AsymmetricMatcher<Array<unknown>> {
141
+ constructor(sample: Array<unknown>, inverse?: boolean);
142
+ asymmetricMatch(other: Array<unknown>): boolean;
143
+ toString(): string;
144
+ getExpectedType(): string;
145
+ }
146
+ declare class Any extends AsymmetricMatcher<any> {
147
+ constructor(sample: unknown);
148
+ fnNameFor(func: Function): string;
149
+ asymmetricMatch(other: unknown): boolean;
150
+ toString(): string;
151
+ getExpectedType(): string;
152
+ toAsymmetricMatcher(): string;
153
+ }
132
154
 
133
155
  declare type Awaitable<T> = T | PromiseLike<T>;
134
156
  declare type Nullable<T> = T | null | undefined;
@@ -642,6 +664,9 @@ declare global {
642
664
  extend(expects: MatchersObject): void;
643
665
  stringContaining(expected: string): void;
644
666
  anything(): Anything;
667
+ objectContaining(expected: any): ObjectContaining;
668
+ any(constructor: unknown): Any;
669
+ arrayContaining(expected: any): ArrayContaining;
645
670
  }
646
671
  interface Assertion {
647
672
  chaiEqual(expected: any): void;
@@ -54,13 +54,12 @@ function sendFlatted(res, data) {
54
54
  res.statusCode = 200;
55
55
  res.end();
56
56
  }
57
- function middlewareAPI() {
57
+ function middlewareAPI(ctx) {
58
58
  return (req, res, next) => {
59
59
  var _a;
60
60
  if (!((_a = req.url) == null ? void 0 : _a.startsWith(API_PATH)))
61
61
  return next();
62
62
  const url = req.url.slice(API_PATH.length);
63
- const ctx = process.__vitest__;
64
63
  if (url === "/") {
65
64
  return sendFlatted(res, {
66
65
  files: ctx.state.filesMap
package/dist/node.js CHANGED
@@ -1,4 +1,4 @@
1
- export { c as createVitest } from './index-40ecbcb4.js';
1
+ export { c as createVitest } from './index-880654a3.js';
2
2
  import 'path';
3
3
  import 'vite';
4
4
  import 'process';
@@ -7,11 +7,11 @@ import 'fast-glob';
7
7
  import 'util';
8
8
  import './constants-9cfa4d7b.js';
9
9
  import 'url';
10
- import './utils-860e5f7e.js';
10
+ import './utils-576876dc.js';
11
11
  import 'tty';
12
12
  import 'local-pkg';
13
13
  import 'perf_hooks';
14
- import './error-4b0c4b4b.js';
14
+ import './error-bf2213e4.js';
15
15
  import 'source-map';
16
16
  import './index-5cc247ff.js';
17
17
  import 'assert';
@@ -76,6 +76,8 @@ function notNullish(v) {
76
76
  function slash(str) {
77
77
  return str.replace(/\\/g, "/");
78
78
  }
79
+ const noop = () => {
80
+ };
79
81
  function partitionSuiteChildren(suite) {
80
82
  let tasksGroup = [];
81
83
  const tasksGroups = [];
@@ -148,7 +150,7 @@ async function ensurePackageInstalled(dependency, promptInstall = !process.env.C
148
150
  const { install } = await prompts.prompt({
149
151
  type: "confirm",
150
152
  name: "install",
151
- message: `Do you want to install ${c.green(dependency)}?`
153
+ message: c.reset(`Do you want to install ${c.green(dependency)}?`)
152
154
  });
153
155
  if (install) {
154
156
  await (await import('./index-e7a421bb.js')).installPackage(dependency);
@@ -157,4 +159,4 @@ async function ensurePackageInstalled(dependency, promptInstall = !process.env.C
157
159
  return false;
158
160
  }
159
161
 
160
- export { getTests as a, getSuites as b, c, hasTests as d, ensurePackageInstalled as e, getTasks as f, getNames as g, hasFailed as h, interpretOnlyMode as i, notNullish as n, partitionSuiteChildren as p, slash as s, toArray as t };
162
+ export { getTests as a, getSuites as b, c, notNullish as d, ensurePackageInstalled as e, hasTests as f, getNames as g, hasFailed as h, interpretOnlyMode as i, getTasks as j, noop as n, partitionSuiteChildren as p, slash as s, toArray as t };
package/dist/utils.js CHANGED
@@ -1,3 +1,3 @@
1
- export { e as ensurePackageInstalled, g as getNames, b as getSuites, f as getTasks, a as getTests, h as hasFailed, d as hasTests, i as interpretOnlyMode, n as notNullish, p as partitionSuiteChildren, s as slash, t as toArray } from './utils-860e5f7e.js';
1
+ export { e as ensurePackageInstalled, g as getNames, b as getSuites, j as getTasks, a as getTests, h as hasFailed, f as hasTests, i as interpretOnlyMode, n as noop, d as notNullish, p as partitionSuiteChildren, s as slash, t as toArray } from './utils-576876dc.js';
2
2
  import 'local-pkg';
3
3
  import 'tty';
package/dist/worker.js CHANGED
@@ -4,7 +4,7 @@ import { c as distDir } from './constants-9cfa4d7b.js';
4
4
  import { builtinModules, createRequire } from 'module';
5
5
  import { pathToFileURL, fileURLToPath, URL as URL$1 } from 'url';
6
6
  import vm from 'vm';
7
- import { s as slash } from './utils-860e5f7e.js';
7
+ import { s as slash } from './utils-576876dc.js';
8
8
  import fs, { realpathSync, statSync, Stats, promises } from 'fs';
9
9
  import assert from 'assert';
10
10
  import { format as format$3, inspect } from 'util';
@@ -8371,15 +8371,7 @@ ${[...callstack, dep].reverse().map((p) => `- ${p}`).join("\n")}`);
8371
8371
  }
8372
8372
  }
8373
8373
  function normalizeId(id) {
8374
- if (id && id.startsWith("/@id/__x00__"))
8375
- id = `\0${id.slice("/@id/__x00__".length)}`;
8376
- if (id && id.startsWith("/@id/"))
8377
- id = id.slice("/@id/".length);
8378
- if (id.startsWith("__vite-browser-external:"))
8379
- id = id.slice("__vite-browser-external:".length);
8380
- if (id.startsWith("node:"))
8381
- id = id.slice("node:".length);
8382
- return id;
8374
+ return id.replace(/^\/@id\/__x00__/, "\0").replace(/^\/@id\//, "").replace(/^__vite-browser-external:/, "").replace(/^node:/, "").replace(/[?&]v=\w+/, "?").replace(/\?$/, "");
8383
8375
  }
8384
8376
  async function shouldExternalize(id, config) {
8385
8377
  if (matchExternalizePattern(id, config.inline))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest",
3
- "version": "0.0.92",
3
+ "version": "0.0.93",
4
4
  "description": "A blazing fast unit test framework powered by Vite",
5
5
  "keywords": [
6
6
  "vite",
@@ -57,8 +57,6 @@
57
57
  "tinyspy": "^0.1.0"
58
58
  },
59
59
  "devDependencies": {
60
- "flatted": "^3.2.4",
61
- "micromatch": "^4.0.4",
62
60
  "@antfu/install-pkg": "^0.1.0",
63
61
  "@types/diff": "^5.0.1",
64
62
  "@types/jsdom": "^16.2.13",
@@ -71,9 +69,11 @@
71
69
  "cli-truncate": "^3.1.0",
72
70
  "diff": "^5.0.0",
73
71
  "find-up": "^6.2.0",
72
+ "flatted": "^3.2.4",
74
73
  "happy-dom": "^2.24.5",
75
74
  "jsdom": "^19.0.0",
76
75
  "log-update": "^5.0.0",
76
+ "micromatch": "^4.0.4",
77
77
  "mlly": "^0.3.15",
78
78
  "nanoid": "^3.1.30",
79
79
  "natural-compare": "^1.4.0",