vitest 0.0.117 → 0.0.118

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
@@ -7,8 +7,8 @@ import process$1 from 'process';
7
7
  import { m as mergeStream, g as getStream, c as crossSpawn } from './index-6e709f57.js';
8
8
  import require$$0, { constants } from 'os';
9
9
  import { s as signalExit } from './index-648e7ab2.js';
10
- import { e as ensurePackageInstalled } from './index-bf29f0e6.js';
11
- import { c as createVitest } from './index-33d800eb.js';
10
+ import { e as ensurePackageInstalled } from './index-80671389.js';
11
+ import { c as createVitest } from './index-62869b66.js';
12
12
  import './_commonjsHelpers-c9e3b764.js';
13
13
  import 'fs';
14
14
  import 'stream';
@@ -18,10 +18,10 @@ import 'url';
18
18
  import 'tty';
19
19
  import 'local-pkg';
20
20
  import 'vite';
21
- import './constants-080f26e8.js';
21
+ import './constants-56bfb5ab.js';
22
22
  import './magic-string.es-94000aea.js';
23
23
  import 'perf_hooks';
24
- import './diff-80c47cfa.js';
24
+ import './diff-d87307c6.js';
25
25
  import 'module';
26
26
  import 'worker_threads';
27
27
  import 'tinypool';
@@ -1700,10 +1700,10 @@ function execa(file, args, options) {
1700
1700
  return mergePromise(spawned, handlePromiseOnce);
1701
1701
  }
1702
1702
 
1703
- var version = "0.0.117";
1703
+ var version = "0.0.118";
1704
1704
 
1705
1705
  const cli = cac("vitest");
1706
- 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 UI", { default: false }).option("--api", "listen to port and serve API").option("--threads", "enabled threads", { default: true }).option("--silent", "silent console output from tests").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();
1706
+ 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 UI", { default: false }).option("-t, --testNamePattern <pattern>", "run test names with the specified pattern").option("--api", "listen to port and serve API").option("--threads", "enabled threads", { default: true }).option("--silent", "silent console output from tests").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();
1707
1707
  cli.command("run [...filters]").action(run);
1708
1708
  cli.command("watch [...filters]").action(dev);
1709
1709
  cli.command("dev [...filters]").action(dev);
@@ -1,5 +1,5 @@
1
1
  import { fileURLToPath } from 'url';
2
- import { k as resolve } from './index-bf29f0e6.js';
2
+ import { k as resolve } from './index-80671389.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 { o as notNullish, c, r as relative } from './index-bf29f0e6.js';
2
+ import { o as notNullish, c, r as relative } from './index-80671389.js';
3
3
 
4
4
  function Diff() {}
5
5
  Diff.prototype = {
package/dist/entry.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import fs, { promises } from 'fs';
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-39f06eb7.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-85b65e90.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 { q as index, s as slash, u as getNames, c as c$1, t as toArray, r as relative, v as interpretOnlyMode, w as partitionSuiteChildren, x as hasTests, h as hasFailed } from './index-bf29f0e6.js';
8
+ import { q as index, s as slash, u as getNames, c as c$1, t as toArray, r as relative, v as partitionSuiteChildren, w as hasTests, h as hasFailed } from './index-80671389.js';
9
9
  import { r as rpc } from './rpc-8c7cc374.js';
10
- import { l as getOriginalPos, m as posToNumber, n as parseStack, u as unifiedDiff } from './diff-80c47cfa.js';
10
+ import { l as getOriginalPos, m as posToNumber, n as parseStack, u as unifiedDiff } from './diff-d87307c6.js';
11
11
  import { performance } from 'perf_hooks';
12
12
  import { createHash } from 'crypto';
13
13
  import { format as format$1 } from 'util';
@@ -3532,7 +3532,7 @@ async function setupGlobalEnv(config) {
3532
3532
  setupConsoleLogSpy();
3533
3533
  await setupChai();
3534
3534
  if (config.global)
3535
- (await import('./global-d95ee155.js')).registerApiGlobally();
3535
+ (await import('./global-fc93e939.js')).registerApiGlobally();
3536
3536
  }
3537
3537
  function setupConsoleLogSpy() {
3538
3538
  const stdout = new Writable({
@@ -3665,10 +3665,33 @@ async function collectTests(paths, config) {
3665
3665
  calculateHash(file);
3666
3666
  files.push(file);
3667
3667
  }
3668
- const tasks = files.reduce((tasks2, file) => tasks2.concat(file.tasks), []);
3669
- interpretOnlyMode(tasks);
3668
+ interpretTaskModes(files, config.testNamePattern);
3670
3669
  return files;
3671
3670
  }
3671
+ function interpretTaskModes(tasks, namePattern) {
3672
+ if (tasks.some((t) => t.mode === "only")) {
3673
+ tasks.forEach((t) => {
3674
+ if (t.mode === "run")
3675
+ t.mode = "skip";
3676
+ else if (t.mode === "only")
3677
+ t.mode = "run";
3678
+ });
3679
+ }
3680
+ tasks.forEach((t) => {
3681
+ if (t.type === "test") {
3682
+ if (namePattern && !t.name.match(namePattern))
3683
+ t.mode = "skip";
3684
+ } else if (t.type === "suite") {
3685
+ if (t.mode === "skip")
3686
+ t.tasks.forEach((c) => c.mode === "run" && (c.mode = "skip"));
3687
+ interpretTaskModes(t.tasks, namePattern);
3688
+ if (t.mode === "run") {
3689
+ if (t.tasks.every((i) => i.mode !== "run"))
3690
+ t.mode = "skip";
3691
+ }
3692
+ }
3693
+ });
3694
+ }
3672
3695
  function calculateHash(parent) {
3673
3696
  parent.tasks.forEach((t, idx) => {
3674
3697
  t.id = `${parent.id}_${idx}`;
@@ -1,11 +1,11 @@
1
- import { g as globalApis } from './constants-080f26e8.js';
2
- import { i as index } from './index-2b1f526f.js';
1
+ import { g as globalApis } from './constants-56bfb5ab.js';
2
+ import { i as index } from './index-be3cc31e.js';
3
3
  import 'url';
4
- import './index-bf29f0e6.js';
4
+ import './index-80671389.js';
5
5
  import 'tty';
6
6
  import 'local-pkg';
7
7
  import 'path';
8
- import './vi-39f06eb7.js';
8
+ import './vi-85b65e90.js';
9
9
  import './_commonjsHelpers-c9e3b764.js';
10
10
  import './jest-mock-4a754991.js';
11
11
  import 'chai';
@@ -1,4 +1,4 @@
1
- import { c, s as slash$1, a as isAbsolute, r as relative, d as dirname, b as basename, g as getFullName, h as hasFailed, f as getSuites, j as getTests, t as toArray, k as resolve, l as deepMerge, m as toFilePath, n as noop$1 } from './index-bf29f0e6.js';
1
+ import { c, s as slash$1, a as isAbsolute, r as relative, d as dirname, b as basename, g as getFullName, h as hasFailed, f as getSuites, j as getTests, t as toArray, k as resolve, l as deepMerge, m as toFilePath, n as noop$1 } from './index-80671389.js';
2
2
  import { createServer, mergeConfig } from 'vite';
3
3
  import path$a from 'path';
4
4
  import process$1 from 'process';
@@ -7,10 +7,10 @@ import require$$0 from 'os';
7
7
  import require$$0$1 from 'util';
8
8
  import require$$0$2 from 'stream';
9
9
  import require$$2 from 'events';
10
- import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-080f26e8.js';
10
+ import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-56bfb5ab.js';
11
11
  import MagicString from './magic-string.es-94000aea.js';
12
12
  import { performance } from 'perf_hooks';
13
- import { F as F_POINTER, a as F_DOWN, s as stripAnsi, b as F_LONG_DASH, c as F_DOWN_RIGHT, d as F_DOT, e as F_CHECK, f as F_CROSS, g as F_RIGHT, p as printError, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as cliTruncate } from './diff-80c47cfa.js';
13
+ import { F as F_POINTER, a as F_DOWN, s as stripAnsi, b as F_LONG_DASH, c as F_DOWN_RIGHT, d as F_DOT, e as F_CHECK, f as F_CROSS, g as F_RIGHT, p as printError, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as cliTruncate } from './diff-d87307c6.js';
14
14
  import { o as onetime, s as signalExit } from './index-648e7ab2.js';
15
15
  import { createRequire } from 'module';
16
16
  import { pathToFileURL } from 'url';
@@ -6849,7 +6849,7 @@ const MocksPlugin = () => {
6849
6849
 
6850
6850
  const spinnerMap = /* @__PURE__ */ new WeakMap();
6851
6851
  const pointer = c.yellow(F_POINTER);
6852
- const skipped = c.yellow(F_DOWN);
6852
+ const skipped = c.dim(c.gray(F_DOWN));
6853
6853
  function getCols(delta = 0) {
6854
6854
  let length = process.stdout.columns;
6855
6855
  if (!length || isNaN(length))
@@ -6993,8 +6993,8 @@ ${c.inverse(c.bold(mode))} ${c.gray(this.ctx.config.root)}
6993
6993
  if (this.isTTY)
6994
6994
  return;
6995
6995
  for (const pack of packs) {
6996
- const task = this.ctx.state.idMap[pack[0]];
6997
- if (task.type === "test" && ((_a = task.result) == null ? void 0 : _a.state) && ((_b = task.result) == null ? void 0 : _b.state) !== "run") {
6996
+ const task = this.ctx.state.idMap.get(pack[0]);
6997
+ if (task && task.type === "test" && ((_a = task.result) == null ? void 0 : _a.state) && ((_b = task.result) == null ? void 0 : _b.state) !== "run") {
6998
6998
  this.ctx.log(` ${getStateSymbol(task)} ${getFullName(task)}`);
6999
6999
  if (task.result.state === "fail")
7000
7000
  this.ctx.log(c.red(` ${F_RIGHT} ${(_c = task.result.error) == null ? void 0 : _c.message}`));
@@ -7024,7 +7024,7 @@ ${c.bold(c.inverse(c.green(" PASS ")))}${c.green(" Waiting for file changes...")
7024
7024
  onUserConsoleLog(log) {
7025
7025
  if (this.ctx.config.silent)
7026
7026
  return;
7027
- const task = log.taskId ? this.ctx.state.idMap[log.taskId] : void 0;
7027
+ const task = log.taskId ? this.ctx.state.idMap.get(log.taskId) : void 0;
7028
7028
  this.ctx.log(c.gray(log.type + c.dim(` | ${task ? getFullName(task) : "unknown test"}`)));
7029
7029
  process[log.type].write(`${log.content}
7030
7030
  `);
@@ -7614,10 +7614,10 @@ function renderTree(tasks, options, level = 0) {
7614
7614
  for (const task of tasks) {
7615
7615
  let suffix = "";
7616
7616
  const prefix = ` ${getStateSymbol(task)} `;
7617
- if (task.mode === "skip" || task.mode === "todo")
7618
- suffix += ` ${c.dim("[skipped]")}`;
7619
7617
  if (task.type === "suite")
7620
7618
  suffix += c.dim(` (${getTests(task).length})`);
7619
+ if (task.mode === "skip" || task.mode === "todo")
7620
+ suffix += ` ${c.dim(c.gray("[skipped]"))}`;
7621
7621
  if ((_a = task.result) == null ? void 0 : _a.end) {
7622
7622
  const duration = task.result.end - task.result.start;
7623
7623
  if (duration > DURATION_LONG)
@@ -7895,25 +7895,25 @@ async function reportCoverage(ctx) {
7895
7895
 
7896
7896
  class StateManager {
7897
7897
  constructor() {
7898
- this.filesMap = {};
7899
- this.idMap = {};
7898
+ this.filesMap = /* @__PURE__ */ new Map();
7899
+ this.idMap = /* @__PURE__ */ new Map();
7900
7900
  this.taskFileMap = /* @__PURE__ */ new WeakMap();
7901
7901
  }
7902
7902
  getFiles(keys) {
7903
7903
  if (keys)
7904
- return keys.map((key) => this.filesMap[key]);
7905
- return Object.values(this.filesMap);
7904
+ return keys.map((key) => this.filesMap.get(key));
7905
+ return Array.from(this.filesMap.values());
7906
7906
  }
7907
7907
  collectFiles(files = []) {
7908
7908
  files.forEach((file) => {
7909
- this.filesMap[file.filepath] = file;
7909
+ this.filesMap.set(file.filepath, file);
7910
7910
  this.updateId(file);
7911
7911
  });
7912
7912
  }
7913
7913
  updateId(task) {
7914
- if (this.idMap[task.id] === task)
7914
+ if (this.idMap.get(task.id) === task)
7915
7915
  return;
7916
- this.idMap[task.id] = task;
7916
+ this.idMap.set(task.id, task);
7917
7917
  if (task.type === "suite") {
7918
7918
  task.tasks.forEach((task2) => {
7919
7919
  this.updateId(task2);
@@ -7922,8 +7922,8 @@ class StateManager {
7922
7922
  }
7923
7923
  updateTasks(packs) {
7924
7924
  for (const [id, result] of packs) {
7925
- if (this.idMap[id])
7926
- this.idMap[id].result = result;
7925
+ if (this.idMap.has(id))
7926
+ this.idMap.get(id).result = result;
7927
7927
  }
7928
7928
  }
7929
7929
  }
@@ -7968,6 +7968,7 @@ function resolveConfig(options, viteConfig) {
7968
7968
  resolved.testTimeout = resolved.testTimeout ?? 5e3;
7969
7969
  resolved.hookTimeout = resolved.hookTimeout ?? 1e4;
7970
7970
  resolved.isolate = resolved.isolate ?? true;
7971
+ resolved.testNamePattern = resolved.testNamePattern ? resolved.testNamePattern instanceof RegExp ? resolved.testNamePattern : new RegExp(resolved.testNamePattern) : void 0;
7971
7972
  resolved.watchIgnore = resolved.watchIgnore ?? [/\/node_modules\//, /\/dist\//];
7972
7973
  const CI = !!process.env.CI;
7973
7974
  const UPDATE_SNAPSHOT = resolved.update || process.env.UPDATE_SNAPSHOT;
@@ -8247,8 +8248,8 @@ class Vitest {
8247
8248
  const onUnlink = (id) => {
8248
8249
  id = slash$1(id);
8249
8250
  this.invalidates.add(id);
8250
- if (id in this.state.filesMap) {
8251
- delete this.state.filesMap[id];
8251
+ if (this.state.filesMap.has(id)) {
8252
+ this.state.filesMap.delete(id);
8252
8253
  this.changedTests.delete(id);
8253
8254
  }
8254
8255
  };
@@ -8277,7 +8278,7 @@ class Vitest {
8277
8278
  if (!mod)
8278
8279
  return;
8279
8280
  this.invalidates.add(id);
8280
- if (id in this.state.filesMap) {
8281
+ if (this.state.filesMap.has(id)) {
8281
8282
  this.changedTests.add(id);
8282
8283
  return;
8283
8284
  }
@@ -8335,7 +8336,7 @@ async function createVitest(options, viteOverrides = {}) {
8335
8336
  await ctx.setServer(options, server2);
8336
8337
  haveStarted = true;
8337
8338
  if (options.api)
8338
- (await import('./setup-95b119ff.js')).setup(ctx);
8339
+ (await import('./setup-b87afd31.js')).setup(ctx);
8339
8340
  }
8340
8341
  },
8341
8342
  MocksPlugin()
@@ -282,24 +282,6 @@ function partitionSuiteChildren(suite) {
282
282
  tasksGroups.push(tasksGroup);
283
283
  return tasksGroups;
284
284
  }
285
- function interpretOnlyMode(tasks) {
286
- if (tasks.some((t) => t.mode === "only")) {
287
- tasks.forEach((t) => {
288
- if (t.mode === "run")
289
- t.mode = "skip";
290
- else if (t.mode === "only")
291
- t.mode = "run";
292
- });
293
- }
294
- tasks.forEach((t) => {
295
- if (t.type === "suite") {
296
- if (t.mode === "skip")
297
- t.tasks.forEach((c2) => c2.mode === "run" && (c2.mode = "skip"));
298
- else
299
- interpretOnlyMode(t.tasks);
300
- }
301
- });
302
- }
303
285
  function getTests(suite) {
304
286
  return toArray(suite).flatMap((s) => s.type === "test" ? [s] : s.tasks.flatMap((c2) => c2.type === "test" ? [c2] : getTests(c2)));
305
287
  }
@@ -383,4 +365,4 @@ function toFilePath(id, root) {
383
365
  return isWindows && absolute.startsWith("/") ? fileURLToPath(pathToFileURL(absolute.slice(1)).href) : absolute;
384
366
  }
385
367
 
386
- export { isAbsolute as a, basename as b, c, dirname as d, ensurePackageInstalled as e, getSuites as f, getFullName as g, hasFailed as h, isObject as i, getTests as j, resolve as k, deepMerge as l, toFilePath as m, noop as n, notNullish as o, mergeSlashes as p, index as q, relative as r, slash as s, toArray as t, getNames as u, interpretOnlyMode as v, partitionSuiteChildren as w, hasTests as x, isWindows as y, getTasks as z };
368
+ export { isAbsolute as a, basename as b, c, dirname as d, ensurePackageInstalled as e, getSuites as f, getFullName as g, hasFailed as h, isObject as i, getTests as j, resolve as k, deepMerge as l, toFilePath as m, noop as n, notNullish as o, mergeSlashes as p, index as q, relative as r, slash as s, toArray as t, getNames as u, partitionSuiteChildren as v, hasTests as w, isWindows as x, getTasks as y };
@@ -1,4 +1,4 @@
1
- import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, b as getState, s as setState, c as suite, t as test, d as describe, i as it, v as vitest, e as vi } from './vi-39f06eb7.js';
1
+ import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, b as getState, s as setState, c as suite, t as test, d as describe, i as it, v as vitest, e as vi } from './vi-85b65e90.js';
2
2
  import chai, { assert, should } from 'chai';
3
3
  import { s as spies, a as spyOn, f as fn } from './jest-mock-4a754991.js';
4
4
 
package/dist/index.d.ts CHANGED
@@ -177,8 +177,8 @@ interface WorkerPool {
177
177
  }
178
178
 
179
179
  declare class StateManager {
180
- filesMap: Record<string, File>;
181
- idMap: Record<string, Task>;
180
+ filesMap: Map<string, File>;
181
+ idMap: Map<string, Task>;
182
182
  taskFileMap: WeakMap<Task, File>;
183
183
  getFiles(keys?: string[]): File[];
184
184
  collectFiles(files?: File[]): void;
@@ -624,6 +624,10 @@ interface InlineConfig {
624
624
  * @internal WIP
625
625
  */
626
626
  open?: boolean;
627
+ /**
628
+ * run test names with the specified pattern
629
+ */
630
+ testNamePattern?: string | RegExp;
627
631
  /**
628
632
  * Listen to port and serve API
629
633
  *
@@ -673,9 +677,10 @@ interface UserConfig extends InlineConfig {
673
677
  */
674
678
  passWithNoTests?: boolean;
675
679
  }
676
- interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage'> {
680
+ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern'> {
677
681
  config?: string;
678
682
  filters?: string[];
683
+ testNamePattern?: RegExp;
679
684
  depsInline: (string | RegExp)[];
680
685
  depsExternal: (string | RegExp)[];
681
686
  coverage: ResolvedC8Options;
@@ -866,6 +871,15 @@ declare class VitestUtils {
866
871
  declare const vitest: VitestUtils;
867
872
  declare const vi: VitestUtils;
868
873
 
874
+ interface WebSocketHandlers {
875
+ getFiles(): File[];
876
+ getConfig(): ResolvedConfig;
877
+ getSourceCode(id: string): Promise<string>;
878
+ rerun(files: string[]): Promise<void>;
879
+ }
880
+ interface WebSocketEvents extends Pick<Reporter, 'onCollected' | 'onTaskUpdate'> {
881
+ }
882
+
869
883
  declare type VitestInlineConfig = InlineConfig;
870
884
 
871
885
  declare module 'vite' {
@@ -941,4 +955,4 @@ declare global {
941
955
  }
942
956
  }
943
957
 
944
- export { ArgumentsOf, ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, ComputeMode, ConstructorArgumentsOf, DoneCallback, Environment, EnvironmentReturn, File, HookListener, InlineConfig, JestMockCompat, JestMockCompatContext, JestMockCompatFn, MaybeMocked, MaybeMockedConstructor, MaybeMockedDeep, MethodKeysOf, MockWithArgs, MockableFunction, MockedFunction, MockedFunctionDeep, MockedObject, MockedObjectDeep, ModuleCache, Nullable, ParsedStack, Position, PropertyKeysOf, Reporter, ResolvedConfig, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, Suite, SuiteCollector, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestCollector, TestFactory, TestFunction, UncheckedSnapshot, UserConfig, UserConsoleLog, WorkerContext, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, describe, expect, fn, it, spies, spyOn, suite, test, vi, vitest };
958
+ export { ArgumentsOf, ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, ComputeMode, ConstructorArgumentsOf, DoneCallback, Environment, EnvironmentReturn, File, HookListener, InlineConfig, JestMockCompat, JestMockCompatContext, JestMockCompatFn, MaybeMocked, MaybeMockedConstructor, MaybeMockedDeep, MethodKeysOf, MockWithArgs, MockableFunction, MockedFunction, MockedFunctionDeep, MockedObject, MockedObjectDeep, ModuleCache, Nullable, ParsedStack, Position, PropertyKeysOf, Reporter, ResolvedConfig, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, Suite, SuiteCollector, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestCollector, TestFactory, TestFunction, UncheckedSnapshot, UserConfig, UserConsoleLog, WebSocketEvents, WebSocketHandlers, WorkerContext, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, describe, expect, fn, it, spies, spyOn, suite, test, vi, vitest };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- export { d as describe, i as it, c as suite, t as test, e as vi, v as vitest } from './vi-39f06eb7.js';
2
- export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, e as expect } from './index-2b1f526f.js';
1
+ export { d as describe, i as it, c as suite, t as test, e as vi, v as vitest } from './vi-85b65e90.js';
2
+ export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, e as expect } from './index-be3cc31e.js';
3
3
  export { f as fn, s as spies, a as spyOn } from './jest-mock-4a754991.js';
4
4
  export { assert, default as chai, should } from 'chai';
5
- import './index-bf29f0e6.js';
5
+ import './index-80671389.js';
6
6
  import 'url';
7
7
  import 'tty';
8
8
  import 'local-pkg';
package/dist/node.d.ts CHANGED
@@ -334,6 +334,10 @@ interface InlineConfig {
334
334
  * @internal WIP
335
335
  */
336
336
  open?: boolean;
337
+ /**
338
+ * run test names with the specified pattern
339
+ */
340
+ testNamePattern?: string | RegExp;
337
341
  /**
338
342
  * Listen to port and serve API
339
343
  *
@@ -383,9 +387,10 @@ interface UserConfig extends InlineConfig {
383
387
  */
384
388
  passWithNoTests?: boolean;
385
389
  }
386
- interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage'> {
390
+ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern'> {
387
391
  config?: string;
388
392
  filters?: string[];
393
+ testNamePattern?: RegExp;
389
394
  depsInline: (string | RegExp)[];
390
395
  depsExternal: (string | RegExp)[];
391
396
  coverage: ResolvedC8Options;
@@ -408,8 +413,8 @@ interface WorkerPool {
408
413
  }
409
414
 
410
415
  declare class StateManager {
411
- filesMap: Record<string, File>;
412
- idMap: Record<string, Task>;
416
+ filesMap: Map<string, File>;
417
+ idMap: Map<string, Task>;
413
418
  taskFileMap: WeakMap<Task, File>;
414
419
  getFiles(keys?: string[]): File[];
415
420
  collectFiles(files?: File[]): void;
package/dist/node.js CHANGED
@@ -1,5 +1,5 @@
1
- export { c as createVitest } from './index-33d800eb.js';
2
- import './index-bf29f0e6.js';
1
+ export { c as createVitest } from './index-62869b66.js';
2
+ import './index-80671389.js';
3
3
  import 'url';
4
4
  import 'tty';
5
5
  import 'local-pkg';
@@ -11,10 +11,10 @@ import 'os';
11
11
  import 'util';
12
12
  import 'stream';
13
13
  import 'events';
14
- import './constants-080f26e8.js';
14
+ import './constants-56bfb5ab.js';
15
15
  import './magic-string.es-94000aea.js';
16
16
  import 'perf_hooks';
17
- import './diff-80c47cfa.js';
17
+ import './diff-d87307c6.js';
18
18
  import './index-648e7ab2.js';
19
19
  import './_commonjsHelpers-c9e3b764.js';
20
20
  import 'assert';
@@ -9,8 +9,8 @@ import require$$2 from 'events';
9
9
  import require$$1 from 'https';
10
10
  import require$$2$1 from 'http';
11
11
  import require$$7 from 'url';
12
- import { A as API_PATH } from './constants-080f26e8.js';
13
- import './index-bf29f0e6.js';
12
+ import { A as API_PATH } from './constants-56bfb5ab.js';
13
+ import './index-80671389.js';
14
14
  import 'tty';
15
15
  import 'local-pkg';
16
16
  import 'path';
package/dist/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- export { l as deepMerge, e as ensurePackageInstalled, g as getFullName, u as getNames, f as getSuites, z as getTasks, j as getTests, h as hasFailed, x as hasTests, v as interpretOnlyMode, i as isObject, y as isWindows, p as mergeSlashes, n as noop, o as notNullish, w as partitionSuiteChildren, k as resolvePath, s as slash, t as toArray, m as toFilePath } from './index-bf29f0e6.js';
1
+ export { l as deepMerge, e as ensurePackageInstalled, g as getFullName, u as getNames, f as getSuites, y as getTasks, j as getTests, h as hasFailed, w as hasTests, i as isObject, x as isWindows, p as mergeSlashes, n as noop, o as notNullish, v as partitionSuiteChildren, k as resolvePath, s as slash, t as toArray, m as toFilePath } from './index-80671389.js';
2
2
  import 'url';
3
3
  import 'tty';
4
4
  import 'local-pkg';
@@ -1,4 +1,4 @@
1
- import { n as noop, i as isObject } from './index-bf29f0e6.js';
1
+ import { n as noop, i as isObject } from './index-80671389.js';
2
2
  import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-c9e3b764.js';
3
3
  import { a as spyOn, f as fn, s as spies } from './jest-mock-4a754991.js';
4
4
 
package/dist/worker.js CHANGED
@@ -1,6 +1,6 @@
1
- import { k as resolve, d as dirname$2, b as basename$2, p as mergeSlashes, s as slash, m as toFilePath } from './index-bf29f0e6.js';
1
+ import { k as resolve, d as dirname$2, b as basename$2, p as mergeSlashes, s as slash, m as toFilePath } from './index-80671389.js';
2
2
  import { c as createBirpc } from './index-e909c175.js';
3
- import { c as distDir } from './constants-080f26e8.js';
3
+ import { c as distDir } from './constants-56bfb5ab.js';
4
4
  import { builtinModules, createRequire } from 'module';
5
5
  import { pathToFileURL, fileURLToPath as fileURLToPath$2, URL as URL$1 } from 'url';
6
6
  import vm from 'vm';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest",
3
- "version": "0.0.117",
3
+ "version": "0.0.118",
4
4
  "description": "A blazing fast unit test framework powered by Vite",
5
5
  "keywords": [
6
6
  "vite",