vitest 0.28.1 → 0.28.3

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/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { startTests } from '@vitest/runner';
2
- import { a as ResolvedConfig } from './types-c800444e.js';
2
+ import { a as ResolvedConfig } from './types-aac763a5.js';
3
3
  export { s as setupSnapshotEnvironment } from './env-afee91f0.js';
4
4
  import '@vitest/expect';
5
5
  import 'vite';
package/dist/browser.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { startTests } from '@vitest/runner';
2
- export { s as setupCommonEnv } from './chunk-runtime-setup.d9302cfd.js';
2
+ export { s as setupCommonEnv } from './chunk-runtime-setup.7dfc1a6a.js';
3
3
  export { s as setupSnapshotEnvironment } from './chunk-snapshot-env.6457638e.js';
4
4
  import '@vitest/utils';
5
5
  import './chunk-integrations-run-once.38756e30.js';
@@ -12,14 +12,14 @@ import require$$2$1 from 'http';
12
12
  import require$$7 from 'url';
13
13
  import { A as API_PATH } from './chunk-constants.797d3ebf.js';
14
14
  import './chunk-utils-global.442d1d33.js';
15
- import { a as parseStacktrace } from './chunk-utils-tasks.1b603032.js';
15
+ import { a as parseStacktrace } from './chunk-utils-tasks.a9a8d8e1.js';
16
16
  import 'node:url';
17
17
  import 'pathe';
18
18
  import './chunk-utils-env.860d90c2.js';
19
19
  import 'std-env';
20
20
  import '@vitest/runner/utils';
21
21
  import '@vitest/utils';
22
- import './chunk-utils-base.977ae74f.js';
22
+ import './chunk-utils-base.904102a8.js';
23
23
 
24
24
  async function getModuleGraph(ctx, id) {
25
25
  const graph = {};
@@ -3,7 +3,7 @@ import k from 'path';
3
3
  import require$$0$1 from 'util';
4
4
  import require$$0$3 from 'child_process';
5
5
  import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1 } from './vendor-index.618ca5a1.js';
6
- import { o as onetime$1 } from './chunk-node-pkg.a7963c3f.js';
6
+ import { o as onetime$1 } from './chunk-node-pkg.25890a5a.js';
7
7
  import require$$0$2 from 'os';
8
8
  import 'node:buffer';
9
9
  import 'node:path';
@@ -41,8 +41,8 @@ import 'node:worker_threads';
41
41
  import 'tinypool';
42
42
  import './vendor-index.783e7f3e.js';
43
43
  import 'perf_hooks';
44
- import './chunk-utils-base.977ae74f.js';
45
- import './chunk-utils-tasks.1b603032.js';
44
+ import './chunk-utils-base.904102a8.js';
45
+ import './chunk-utils-tasks.a9a8d8e1.js';
46
46
  import 'crypto';
47
47
  import 'vite-node/utils';
48
48
  import '@vitest/utils/diff';
@@ -1,11 +1,11 @@
1
1
  import { g as globalApis } from './chunk-constants.797d3ebf.js';
2
- import { i as index } from './chunk-integrations-utils.f1f6f1ed.js';
2
+ import { i as index } from './chunk-integrations-utils.dae69d89.js';
3
3
  import 'node:url';
4
4
  import 'pathe';
5
5
  import './chunk-utils-env.860d90c2.js';
6
6
  import 'std-env';
7
7
  import '@vitest/runner';
8
- import './chunk-utils-import.9911c99d.js';
8
+ import './chunk-utils-import.0402c9db.js';
9
9
  import '@vitest/runner/utils';
10
10
  import '@vitest/utils';
11
11
  import './chunk-utils-global.442d1d33.js';
@@ -14,8 +14,8 @@ import './vendor-_commonjsHelpers.addc3445.js';
14
14
  import '@vitest/expect';
15
15
  import './chunk-runtime-rpc.9c0386cc.js';
16
16
  import './chunk-snapshot-env.6457638e.js';
17
- import './chunk-utils-base.977ae74f.js';
18
- import './chunk-utils-tasks.1b603032.js';
17
+ import './chunk-utils-base.904102a8.js';
18
+ import './chunk-utils-tasks.a9a8d8e1.js';
19
19
  import 'util';
20
20
  import '@vitest/spy';
21
21
  import './chunk-integrations-run-once.38756e30.js';
@@ -1,5 +1,5 @@
1
1
  import { suite, test, describe, it, beforeAll, beforeEach, afterAll, afterEach, onTestFailed } from '@vitest/runner';
2
- import { b as bench, c as createExpect, g as globalExpect, v as vitest, a as vi } from './chunk-utils-import.9911c99d.js';
2
+ import { b as bench, c as createExpect, g as globalExpect, v as vitest, a as vi } from './chunk-utils-import.0402c9db.js';
3
3
  import { r as runOnce, i as isFirstRun } from './chunk-integrations-run-once.38756e30.js';
4
4
  import * as chai from 'chai';
5
5
  import { assert, should } from 'chai';
@@ -32,8 +32,8 @@ import { cpus, hostname } from 'node:os';
32
32
  import { Tinypool } from 'tinypool';
33
33
  import { c as createBirpc } from './vendor-index.783e7f3e.js';
34
34
  import { performance } from 'perf_hooks';
35
- import { s as slash$1, n as notNullish, t as toArray, a as noop$1, d as deepMerge, b as stdout } from './chunk-utils-base.977ae74f.js';
36
- import { g as getFullName, h as hasFailedSnapshot, a as parseStacktrace, p as positionToOffset, l as lineSplitRE } from './chunk-utils-tasks.1b603032.js';
35
+ import { s as slash$1, n as notNullish, t as toArray, a as noop$1, d as deepMerge, b as stdout } from './chunk-utils-base.904102a8.js';
36
+ import { g as getFullName, h as hasFailedSnapshot, a as parseStacktrace, p as positionToOffset, l as lineSplitRE } from './chunk-utils-tasks.a9a8d8e1.js';
37
37
  import { getSafeTimers, shuffle, stringify } from '@vitest/utils';
38
38
  import { createHash } from 'crypto';
39
39
  import { slash as slash$2, cleanUrl } from 'vite-node/utils';
@@ -58,7 +58,7 @@ function _mergeNamespaces(n, m) {
58
58
  return Object.freeze(n);
59
59
  }
60
60
 
61
- var version$1 = "0.28.1";
61
+ var version$1 = "0.28.3";
62
62
 
63
63
  async function ensurePackageInstalled(dependency, root) {
64
64
  if (isPackageExists(dependency, { paths: [root] }))
@@ -76,7 +76,7 @@ async function ensurePackageInstalled(dependency, root) {
76
76
  message: c.reset(`Do you want to install ${c.green(dependency)}?`)
77
77
  });
78
78
  if (install) {
79
- await (await import('./chunk-install-pkg.e816b731.js')).installPackage(dependency, { dev: true });
79
+ await (await import('./chunk-install-pkg.4b6b9575.js')).installPackage(dependency, { dev: true });
80
80
  process.stderr.write(c.yellow(`
81
81
  Package ${dependency} installed, re-run the command to start.
82
82
  `));
@@ -3541,7 +3541,7 @@ function createPool(ctx) {
3541
3541
  );
3542
3542
  const options = {
3543
3543
  filename: workerPath,
3544
- useAtomics: false,
3544
+ useAtomics: ctx.config.useAtomics ?? false,
3545
3545
  maxThreads,
3546
3546
  minThreads,
3547
3547
  execArgv: ctx.config.deps.registerNodeLoader ? [
@@ -3618,7 +3618,7 @@ function createPool(ctx) {
3618
3618
  var _a2;
3619
3619
  const nodeVersion = Number((_a2 = process.version.match(/v(\d+)\.(\d+)/)) == null ? void 0 : _a2[0].slice(1));
3620
3620
  if (nodeVersion >= 16.17)
3621
- await Promise.all(pool.threads.map((w) => w.terminate()));
3621
+ await pool.destroy();
3622
3622
  }
3623
3623
  };
3624
3624
  }
@@ -4010,17 +4010,21 @@ class BaseReporter {
4010
4010
  });
4011
4011
  const BADGE = c.inverse(c.bold(c.blue(" RERUN ")));
4012
4012
  const TRIGGER = trigger ? c.dim(` ${this.relative(trigger)}`) : "";
4013
+ const FILENAME_PATTERN = this.ctx.filenamePattern ? `${BADGE_PADDING} ${c.dim("Filename pattern: ")}${c.blue(this.ctx.filenamePattern)}
4014
+ ` : "";
4015
+ const TESTNAME_PATTERN = this.ctx.config.testNamePattern ? `${BADGE_PADDING} ${c.dim("Test name pattern: ")}${c.blue(String(this.ctx.config.testNamePattern))}
4016
+ ` : "";
4013
4017
  if (files.length > 1) {
4014
4018
  this.ctx.logger.clearFullScreen(`
4015
4019
  ${BADGE}${TRIGGER}
4016
- `);
4020
+ ${FILENAME_PATTERN}${TESTNAME_PATTERN}`);
4017
4021
  this._lastRunCount = 0;
4018
4022
  } else if (files.length === 1) {
4019
4023
  const rerun = this._filesInWatchMode.get(files[0]) ?? 1;
4020
4024
  this._lastRunCount = rerun;
4021
4025
  this.ctx.logger.clearFullScreen(`
4022
4026
  ${BADGE}${TRIGGER} ${c.blue(`x${rerun}`)}
4023
- `);
4027
+ ${FILENAME_PATTERN}${TESTNAME_PATTERN}`);
4024
4028
  }
4025
4029
  this._timeStart = new Date();
4026
4030
  this.start = performance.now();
@@ -4029,8 +4033,9 @@ ${BADGE}${TRIGGER} ${c.blue(`x${rerun}`)}
4029
4033
  if (!this.shouldLog(log))
4030
4034
  return;
4031
4035
  const task = log.taskId ? this.ctx.state.idMap.get(log.taskId) : void 0;
4032
- this.ctx.logger.log(c.gray(log.type + c.dim(` | ${task ? getFullName(task, c.dim(" > ")) : "unknown test"}`)));
4033
- process[log.type].write(`${log.content}
4036
+ const header = c.gray(log.type + c.dim(` | ${task ? getFullName(task, c.dim(" > ")) : "unknown test"}`));
4037
+ process[log.type].write(`${header}
4038
+ ${log.content}
4034
4039
  `);
4035
4040
  }
4036
4041
  shouldLog(log) {
@@ -6393,11 +6398,11 @@ class VitestCache {
6393
6398
  return resolve(root, slash$1(dir || "node_modules/.vitest"));
6394
6399
  }
6395
6400
  static async clearCache(options) {
6396
- var _a;
6401
+ var _a, _b;
6397
6402
  const root = resolve(options.root || process.cwd());
6398
- const configPath = options.config ? resolve(root, options.config) : await findUp(configFiles, { cwd: root });
6399
- const config = await loadConfigFromFile({ command: "serve", mode: "test" }, configPath);
6400
- const cache = (_a = config == null ? void 0 : config.config.test) == null ? void 0 : _a.cache;
6403
+ const configPath = options.config === false ? false : options.config ? resolve(root, options.config) : await findUp(configFiles, { cwd: root });
6404
+ const config = configPath ? (_a = await loadConfigFromFile({ command: "serve", mode: "test" }, configPath)) == null ? void 0 : _a.config : void 0;
6405
+ const cache = (_b = config == null ? void 0 : config.test) == null ? void 0 : _b.cache;
6401
6406
  if (cache === false)
6402
6407
  throw new Error("Cache is disabled");
6403
6408
  const cachePath = VitestCache.resolveCacheDir(root, cache == null ? void 0 : cache.dir);
@@ -7164,7 +7169,7 @@ createLogUpdate(process$1.stdout);
7164
7169
 
7165
7170
  createLogUpdate(process$1.stderr);
7166
7171
 
7167
- var version = "0.28.1";
7172
+ var version = "0.28.3";
7168
7173
 
7169
7174
  async function printError(error, ctx, options = {}) {
7170
7175
  const { showCodeFrame = true, fullStack = false, type } = options;
@@ -7731,24 +7736,29 @@ class Vitest {
7731
7736
  return await this.runningPromise;
7732
7737
  }
7733
7738
  async rerunFiles(files = this.state.getFilepaths(), trigger) {
7739
+ if (this.filenamePattern) {
7740
+ const filteredFiles = await this.globTestFiles([this.filenamePattern]);
7741
+ files = files.filter((file) => filteredFiles.includes(file));
7742
+ }
7734
7743
  if (this.coverageProvider && this.config.coverage.cleanOnRerun)
7735
7744
  await this.coverageProvider.clean();
7736
7745
  await this.report("onWatcherRerun", files, trigger);
7737
7746
  await this.runFiles(files);
7738
7747
  await this.reportCoverage(!trigger);
7739
7748
  if (!this.config.browser)
7740
- await this.report("onWatcherStart");
7749
+ await this.report("onWatcherStart", this.state.getFiles(files));
7741
7750
  }
7742
7751
  async changeNamePattern(pattern, files = this.state.getFilepaths(), trigger) {
7752
+ if (pattern === "")
7753
+ this.filenamePattern = void 0;
7743
7754
  this.config.testNamePattern = pattern ? new RegExp(pattern) : void 0;
7744
7755
  await this.rerunFiles(files, trigger);
7745
7756
  }
7746
7757
  async changeFilenamePattern(pattern) {
7758
+ this.filenamePattern = pattern;
7747
7759
  const files = this.state.getFilepaths();
7748
- if (!pattern)
7749
- return await this.rerunFiles(files, "reset filename pattern");
7750
- const filteredFiles = await this.globTestFiles([pattern]);
7751
- await this.rerunFiles(filteredFiles, "change filename pattern");
7760
+ const trigger = this.filenamePattern ? "change filename pattern" : "reset filename pattern";
7761
+ await this.rerunFiles(files, trigger);
7752
7762
  }
7753
7763
  async rerunFailed() {
7754
7764
  await this.rerunFiles(this.state.getFailedFilepaths(), "rerun failed");
@@ -7785,7 +7795,13 @@ class Vitest {
7785
7795
  return;
7786
7796
  this.isFirstRun = false;
7787
7797
  this.snapshot.clear();
7788
- const files = Array.from(this.changedTests);
7798
+ let files = Array.from(this.changedTests);
7799
+ if (this.filenamePattern) {
7800
+ const filteredFiles = await this.globTestFiles([this.filenamePattern]);
7801
+ files = files.filter((file) => filteredFiles.includes(file));
7802
+ if (files.length === 0)
7803
+ return;
7804
+ }
7789
7805
  this.changedTests.clear();
7790
7806
  if (this.coverageProvider && this.config.coverage.cleanOnRerun)
7791
7807
  await this.coverageProvider.clean();
@@ -7793,7 +7809,7 @@ class Vitest {
7793
7809
  await this.runFiles(files);
7794
7810
  await this.reportCoverage(false);
7795
7811
  if (!this.config.browser)
7796
- await this.report("onWatcherStart");
7812
+ await this.report("onWatcherStart", this.state.getFiles(files));
7797
7813
  }, WATCHER_DEBOUNCE);
7798
7814
  }
7799
7815
  registerWatcher() {
@@ -8387,7 +8403,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
8387
8403
  try {
8388
8404
  await ctx.setServer(options, server);
8389
8405
  if (options.api && options.watch)
8390
- (await import('./chunk-api-setup.52751a38.js')).setup(ctx);
8406
+ (await import('./chunk-api-setup.ec61b167.js')).setup(ctx);
8391
8407
  } catch (err) {
8392
8408
  ctx.logger.printError(err, true);
8393
8409
  process.exit(1);
@@ -8410,7 +8426,7 @@ async function createVitest(mode, options, viteOverrides = {}) {
8410
8426
  var _a;
8411
8427
  const ctx = new Vitest(mode);
8412
8428
  const root = resolve(options.root || process.cwd());
8413
- const configPath = options.config ? resolve(root, options.config) : await findUp(configFiles, { cwd: root });
8429
+ const configPath = options.config === false ? false : options.config ? resolve(root, options.config) : await findUp(configFiles, { cwd: root });
8414
8430
  const config = {
8415
8431
  logLevel: "error",
8416
8432
  configFile: configPath,
@@ -1,13 +1,12 @@
1
1
  import { ViteNodeRunner } from 'vite-node/client';
2
2
  import { isInternalRequest } from 'vite-node/utils';
3
- import { normalizePath } from 'vite';
3
+ import { resolve, isAbsolute, dirname, join, basename, extname, normalize } from 'pathe';
4
4
  import { i as isNodeBuiltin } from './vendor-index.bdee400f.js';
5
5
  import { g as getWorkerState, b as getCurrentEnvironment } from './chunk-utils-global.442d1d33.js';
6
6
  import { existsSync, readdirSync } from 'node:fs';
7
- import { resolve, isAbsolute, dirname, join, basename, extname } from 'pathe';
8
- import { getColors } from '@vitest/utils';
7
+ import { getColors, getType } from '@vitest/utils';
8
+ import { g as getAllMockableProperties } from './chunk-utils-base.904102a8.js';
9
9
  import { d as distDir } from './chunk-constants.797d3ebf.js';
10
- import { g as getType, c as getAllMockableProperties } from './chunk-utils-base.977ae74f.js';
11
10
 
12
11
  class RefTracker {
13
12
  constructor() {
@@ -339,7 +338,7 @@ class VitestRunner extends ViteNodeRunner {
339
338
  }
340
339
  prepareContext(context) {
341
340
  const workerState = getWorkerState();
342
- if (workerState.filepath && normalizePath(workerState.filepath) === normalizePath(context.__filename)) {
341
+ if (workerState.filepath && normalize(workerState.filepath) === normalize(context.__filename)) {
343
342
  Object.defineProperty(context.__vite_ssr_import_meta__, "vitest", { get: () => globalThis.__vitest_index__ });
344
343
  }
345
344
  return context;
@@ -10,7 +10,7 @@ async function setupCommonEnv(config) {
10
10
  globalSetup = true;
11
11
  setSafeTimers();
12
12
  if (config.globals)
13
- (await import('./chunk-integrations-globals.0d5f50f0.js')).registerApiGlobally();
13
+ (await import('./chunk-integrations-globals.aacbac4d.js')).registerApiGlobally();
14
14
  }
15
15
  function setupDefines(defines) {
16
16
  for (const key in defines)
@@ -33,9 +33,6 @@ function slash(str) {
33
33
  }
34
34
  const noop = () => {
35
35
  };
36
- function getType(value) {
37
- return Object.prototype.toString.apply(value).slice(8, -1);
38
- }
39
36
  function toArray(array) {
40
37
  if (array === null || array === void 0)
41
38
  array = [];
@@ -74,4 +71,4 @@ function stdout() {
74
71
  return console._stdout || process.stdout;
75
72
  }
76
73
 
77
- export { noop as a, stdout as b, getAllMockableProperties as c, deepMerge as d, getType as g, isObject as i, notNullish as n, slash as s, toArray as t };
74
+ export { noop as a, stdout as b, deepMerge as d, getAllMockableProperties as g, isObject as i, notNullish as n, slash as s, toArray as t };
@@ -9,8 +9,8 @@ import { equals, iterableEquality, subsetEquality, JestExtend, JestChaiExpect, J
9
9
  import { r as rpc } from './chunk-runtime-rpc.9c0386cc.js';
10
10
  import { join, dirname } from 'pathe';
11
11
  import { g as getSnapshotEnironment } from './chunk-snapshot-env.6457638e.js';
12
- import { i as isObject, s as slash } from './chunk-utils-base.977ae74f.js';
13
- import { p as positionToOffset, o as offsetToLineNumber, l as lineSplitRE, a as parseStacktrace, g as getFullName, b as parseSingleStack } from './chunk-utils-tasks.1b603032.js';
12
+ import { i as isObject, s as slash } from './chunk-utils-base.904102a8.js';
13
+ import { p as positionToOffset, o as offsetToLineNumber, l as lineSplitRE, a as parseStacktrace, g as getFullName, b as parseSingleStack } from './chunk-utils-tasks.a9a8d8e1.js';
14
14
  import require$$0 from 'util';
15
15
  import { spyOn, fn, isMockFunction, spies } from '@vitest/spy';
16
16
 
@@ -1,6 +1,6 @@
1
1
  import { getNames, getTests } from '@vitest/runner/utils';
2
2
  import { resolve } from 'pathe';
3
- import { n as notNullish } from './chunk-utils-base.977ae74f.js';
3
+ import { n as notNullish } from './chunk-utils-base.904102a8.js';
4
4
 
5
5
  function hasFailedSnapshot(suite) {
6
6
  return getTests(suite).some((s) => {
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { normalize } from 'pathe';
2
2
  import cac from 'cac';
3
3
  import c from 'picocolors';
4
- import { v as version, s as startVitest, d as divider } from './chunk-node-pkg.a7963c3f.js';
4
+ import { v as version, s as startVitest, d as divider } from './chunk-node-pkg.25890a5a.js';
5
5
  import './chunk-constants.797d3ebf.js';
6
6
  import 'node:url';
7
7
  import './chunk-utils-env.860d90c2.js';
@@ -42,8 +42,8 @@ import 'node:worker_threads';
42
42
  import 'tinypool';
43
43
  import './vendor-index.783e7f3e.js';
44
44
  import 'perf_hooks';
45
- import './chunk-utils-base.977ae74f.js';
46
- import './chunk-utils-tasks.1b603032.js';
45
+ import './chunk-utils-base.904102a8.js';
46
+ import './chunk-utils-tasks.a9a8d8e1.js';
47
47
  import 'crypto';
48
48
  import 'vite-node/utils';
49
49
  import '@vitest/utils/diff';
package/dist/config.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { UserConfig as UserConfig$2, ConfigEnv } from 'vite';
2
2
  export { ConfigEnv } from 'vite';
3
- import { a1 as ResolvedCoverageOptions, U as UserConfig$1, a4 as CoverageC8Options, _ as CoverageProviderModule, a2 as BaseCoverageOptions, a3 as CoverageIstanbulOptions, $ as CoverageReporter, F as FakeTimerInstallOpts } from './types-c800444e.js';
3
+ import { a1 as ResolvedCoverageOptions, U as UserConfig$1, a4 as CoverageC8Options, _ as CoverageProviderModule, a2 as BaseCoverageOptions, a3 as CoverageIstanbulOptions, $ as CoverageReporter, F as FakeTimerInstallOpts } from './types-aac763a5.js';
4
4
  import '@vitest/expect';
5
5
  import '@vitest/runner/types';
6
6
  import '@vitest/runner';
package/dist/entry.js CHANGED
@@ -2,16 +2,16 @@ import { promises, existsSync } from 'node:fs';
2
2
  import { m as micromatch_1, t as takeCoverageInsideWorker } from './chunk-integrations-coverage.48e6286b.js';
3
3
  import { startTests } from '@vitest/runner';
4
4
  import { g as getWorkerState, r as resetModules } from './chunk-utils-global.442d1d33.js';
5
- import { R as RealDate, g as globalExpect, a as vi } from './chunk-utils-import.9911c99d.js';
5
+ import { R as RealDate, g as globalExpect, a as vi } from './chunk-utils-import.0402c9db.js';
6
6
  import { e as environments, a as envs } from './chunk-env-node.ffd1183b.js';
7
7
  import { createRequire } from 'node:module';
8
8
  import c from 'picocolors';
9
9
  import { installSourcemapsSupport } from 'vite-node/source-map';
10
10
  import { setColors, getSafeTimers } from '@vitest/utils';
11
- import { i as index } from './chunk-integrations-utils.f1f6f1ed.js';
11
+ import { i as index } from './chunk-integrations-utils.dae69d89.js';
12
12
  import { s as setupSnapshotEnvironment } from './chunk-snapshot-env.6457638e.js';
13
13
  import { r as rpc } from './chunk-runtime-rpc.9c0386cc.js';
14
- import { s as setupCommonEnv } from './chunk-runtime-setup.d9302cfd.js';
14
+ import { s as setupCommonEnv } from './chunk-runtime-setup.7dfc1a6a.js';
15
15
  import { V as VitestTestRunner, N as NodeBenchmarkRunner } from './runners-chunk.js';
16
16
  import 'local-pkg';
17
17
  import 'util';
@@ -23,8 +23,8 @@ import '@vitest/runner/utils';
23
23
  import 'chai';
24
24
  import './vendor-_commonjsHelpers.addc3445.js';
25
25
  import '@vitest/expect';
26
- import './chunk-utils-base.977ae74f.js';
27
- import './chunk-utils-tasks.1b603032.js';
26
+ import './chunk-utils-base.904102a8.js';
27
+ import './chunk-utils-tasks.a9a8d8e1.js';
28
28
  import '@vitest/spy';
29
29
  import 'node:console';
30
30
  import './chunk-integrations-run-once.38756e30.js';
@@ -99,12 +99,10 @@ async function setupConsoleLogSpy() {
99
99
  if (!buffer)
100
100
  return;
101
101
  const content = buffer.map((i) => String(i)).join("");
102
- if (!content.trim())
103
- return;
104
102
  const timer = timers.get(taskId);
105
103
  rpc().onUserConsoleLog({
106
104
  type: "stdout",
107
- content,
105
+ content: content || "<empty line>",
108
106
  taskId,
109
107
  time: timer.stdoutTime || RealDate.now(),
110
108
  size: buffer.length
@@ -117,12 +115,10 @@ async function setupConsoleLogSpy() {
117
115
  if (!buffer)
118
116
  return;
119
117
  const content = buffer.map((i) => String(i)).join("");
120
- if (!content.trim())
121
- return;
122
118
  const timer = timers.get(taskId);
123
119
  rpc().onUserConsoleLog({
124
120
  type: "stderr",
125
- content,
121
+ content: content || "<empty line>",
126
122
  taskId,
127
123
  time: timer.stderrTime || RealDate.now(),
128
124
  size: buffer.length
@@ -1,4 +1,4 @@
1
- import { P as Environment } from './types-c800444e.js';
1
+ import { P as Environment } from './types-aac763a5.js';
2
2
  import '@vitest/expect';
3
3
  import 'vite';
4
4
  import '@vitest/runner/types';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Test } from '@vitest/runner';
2
2
  export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
3
- import { B as BenchmarkAPI, F as FakeTimerInstallOpts, M as MockFactoryWithHelper, R as RuntimeConfig, a as ResolvedConfig, b as ModuleGraphData, S as SnapshotResult, c as Reporter } from './types-c800444e.js';
4
- export { u as AfterSuiteRunMeta, A as ApiConfig, z as ArgumentsType, y as Arrayable, x as Awaitable, a2 as BaseCoverageOptions, a8 as BenchFunction, a6 as Benchmark, B as BenchmarkAPI, a7 as BenchmarkResult, a5 as BenchmarkUserOptions, h as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, e as CollectLines, K as Constructable, g as Context, a4 as CoverageC8Options, a3 as CoverageIstanbulOptions, a0 as CoverageOptions, Y as CoverageProvider, _ as CoverageProviderModule, $ as CoverageReporter, G as DeepMerge, P as Environment, E as EnvironmentOptions, O as EnvironmentReturn, I as InlineConfig, J as JSDOMOptions, D as MergeInsertions, L as ModuleCache, b as ModuleGraphData, H as MutableArray, N as Nullable, X as OnServerRestartHandler, d as RawErrsMap, Z as ReportContext, c as Reporter, t as ResolveIdFunction, a as ResolvedConfig, a1 as ResolvedCoverageOptions, f as RootAndTarget, R as RuntimeConfig, j as SequenceHooks, n as SnapshotData, q as SnapshotMatchOptions, S as SnapshotResult, p as SnapshotStateOptions, s as SnapshotSummary, o as SnapshotUpdateState, T as TscErrorInfo, l as TypecheckConfig, r as UncheckedSnapshot, U as UserConfig, Q as UserConsoleLog, m as Vitest, V as VitestEnvironment, k as VitestRunMode, W as WorkerContext, w as WorkerGlobalState, v as WorkerRPC } from './types-c800444e.js';
3
+ import { B as BenchmarkAPI, F as FakeTimerInstallOpts, M as MockFactoryWithHelper, R as RuntimeConfig, a as ResolvedConfig, b as ModuleGraphData, S as SnapshotResult, c as Reporter } from './types-aac763a5.js';
4
+ export { u as AfterSuiteRunMeta, A as ApiConfig, z as ArgumentsType, y as Arrayable, x as Awaitable, a2 as BaseCoverageOptions, a8 as BenchFunction, a6 as Benchmark, B as BenchmarkAPI, a7 as BenchmarkResult, a5 as BenchmarkUserOptions, h as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, e as CollectLines, K as Constructable, g as Context, a4 as CoverageC8Options, a3 as CoverageIstanbulOptions, a0 as CoverageOptions, Y as CoverageProvider, _ as CoverageProviderModule, $ as CoverageReporter, G as DeepMerge, P as Environment, E as EnvironmentOptions, O as EnvironmentReturn, I as InlineConfig, J as JSDOMOptions, D as MergeInsertions, L as ModuleCache, b as ModuleGraphData, H as MutableArray, N as Nullable, X as OnServerRestartHandler, d as RawErrsMap, Z as ReportContext, c as Reporter, t as ResolveIdFunction, a as ResolvedConfig, a1 as ResolvedCoverageOptions, f as RootAndTarget, R as RuntimeConfig, j as SequenceHooks, n as SnapshotData, q as SnapshotMatchOptions, S as SnapshotResult, p as SnapshotStateOptions, s as SnapshotSummary, o as SnapshotUpdateState, T as TscErrorInfo, l as TypecheckConfig, r as UncheckedSnapshot, U as UserConfig, Q as UserConsoleLog, m as Vitest, V as VitestEnvironment, k as VitestRunMode, W as WorkerContext, w as WorkerGlobalState, v as WorkerRPC } from './types-aac763a5.js';
5
5
  import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, EnhancedSpy } from '@vitest/spy';
6
6
  export { EnhancedSpy, Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';
7
7
  export { S as SnapshotEnvironment } from './env-afee91f0.js';
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
2
- export { b as bench, c as createExpect, g as expect, a as vi, v as vitest } from './chunk-utils-import.9911c99d.js';
2
+ export { b as bench, c as createExpect, g as expect, a as vi, v as vitest } from './chunk-utils-import.0402c9db.js';
3
3
  export { i as isFirstRun, r as runOnce } from './chunk-integrations-run-once.38756e30.js';
4
- import { d as dist } from './chunk-integrations-utils.f1f6f1ed.js';
5
- export { b as assertType, g as getRunningMode, a as isWatchMode } from './chunk-integrations-utils.f1f6f1ed.js';
4
+ import { d as dist } from './chunk-integrations-utils.dae69d89.js';
5
+ export { b as assertType, g as getRunningMode, a as isWatchMode } from './chunk-integrations-utils.dae69d89.js';
6
6
  import * as chai from 'chai';
7
7
  export { chai };
8
8
  export { assert, should } from 'chai';
@@ -16,8 +16,8 @@ import './vendor-_commonjsHelpers.addc3445.js';
16
16
  import '@vitest/expect';
17
17
  import './chunk-runtime-rpc.9c0386cc.js';
18
18
  import './chunk-snapshot-env.6457638e.js';
19
- import './chunk-utils-base.977ae74f.js';
20
- import './chunk-utils-tasks.1b603032.js';
19
+ import './chunk-utils-base.904102a8.js';
20
+ import './chunk-utils-tasks.a9a8d8e1.js';
21
21
  import 'util';
22
22
  import '@vitest/spy';
23
23
 
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { k as VitestRunMode, U as UserConfig, m as Vitest, a9 as MockFactory, aa as MockMap, ab as TestSequencer } from './types-c800444e.js';
2
- export { ab as TestSequencer, ad as TestSequencerConstructor, m as Vitest, ac as startVitest } from './types-c800444e.js';
1
+ import { k as VitestRunMode, U as UserConfig, m as Vitest, a9 as MockFactory, aa as MockMap, ab as TestSequencer } from './types-aac763a5.js';
2
+ export { ab as TestSequencer, ad as TestSequencerConstructor, m as Vitest, ac as startVitest } from './types-aac763a5.js';
3
3
  import { UserConfig as UserConfig$1, Plugin } from 'vite';
4
4
  import { ViteNodeRunner } from 'vite-node/client';
5
5
  import { ViteNodeRunnerOptions } from 'vite-node';
package/dist/node.js CHANGED
@@ -1,5 +1,5 @@
1
- export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-node-pkg.a7963c3f.js';
2
- export { V as VitestRunner } from './chunk-runtime-mocker.03017e8c.js';
1
+ export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-node-pkg.25890a5a.js';
2
+ export { V as VitestRunner } from './chunk-runtime-mocker.eb0c265c.js';
3
3
  import 'pathe';
4
4
  import './chunk-constants.797d3ebf.js';
5
5
  import 'node:url';
@@ -42,8 +42,8 @@ import 'node:worker_threads';
42
42
  import 'tinypool';
43
43
  import './vendor-index.783e7f3e.js';
44
44
  import 'perf_hooks';
45
- import './chunk-utils-base.977ae74f.js';
46
- import './chunk-utils-tasks.1b603032.js';
45
+ import './chunk-utils-base.904102a8.js';
46
+ import './chunk-utils-tasks.a9a8d8e1.js';
47
47
  import 'crypto';
48
48
  import 'vite-node/utils';
49
49
  import '@vitest/utils/diff';
@@ -1,7 +1,7 @@
1
1
  import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
2
- import { d as getSnapshotClient, c as createExpect, a as vi, e as getBenchOptions, f as getBenchFn } from './chunk-utils-import.9911c99d.js';
2
+ import { d as getSnapshotClient, c as createExpect, a as vi, e as getBenchOptions, f as getBenchFn } from './chunk-utils-import.0402c9db.js';
3
3
  import { g as getWorkerState } from './chunk-utils-global.442d1d33.js';
4
- import { g as getFullName } from './chunk-utils-tasks.1b603032.js';
4
+ import { g as getFullName } from './chunk-utils-tasks.a9a8d8e1.js';
5
5
  import { updateTask } from '@vitest/runner';
6
6
  import { createDefer, getSafeTimers } from '@vitest/utils';
7
7
 
package/dist/runners.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VitestRunner, VitestRunnerImportSource, Suite, Test, TestContext } from '@vitest/runner';
2
- import { a as ResolvedConfig } from './types-c800444e.js';
2
+ import { a as ResolvedConfig } from './types-aac763a5.js';
3
3
  import '@vitest/expect';
4
4
  import 'vite';
5
5
  import '@vitest/runner/types';
package/dist/runners.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { N as NodeBenchmarkRunner, V as VitestTestRunner } from './runners-chunk.js';
2
2
  import '@vitest/expect';
3
- import './chunk-utils-import.9911c99d.js';
3
+ import './chunk-utils-import.0402c9db.js';
4
4
  import '@vitest/runner';
5
5
  import '@vitest/runner/utils';
6
6
  import '@vitest/utils';
@@ -12,7 +12,7 @@ import 'chai';
12
12
  import './vendor-_commonjsHelpers.addc3445.js';
13
13
  import './chunk-runtime-rpc.9c0386cc.js';
14
14
  import './chunk-snapshot-env.6457638e.js';
15
- import './chunk-utils-base.977ae74f.js';
16
- import './chunk-utils-tasks.1b603032.js';
15
+ import './chunk-utils-base.904102a8.js';
16
+ import './chunk-utils-tasks.a9a8d8e1.js';
17
17
  import 'util';
18
18
  import '@vitest/spy';
@@ -380,6 +380,7 @@ declare class Vitest {
380
380
  vitenode: ViteNodeServer;
381
381
  invalidates: Set<string>;
382
382
  changedTests: Set<string>;
383
+ filenamePattern?: string;
383
384
  runningPromise?: Promise<void>;
384
385
  closingPromise?: Promise<void>;
385
386
  isFirstRun: boolean;
@@ -1482,6 +1483,14 @@ interface InlineConfig {
1482
1483
  * @default available CPUs
1483
1484
  */
1484
1485
  minThreads?: number;
1486
+ /**
1487
+ * Use Atomics to synchronize threads
1488
+ *
1489
+ * This can improve performance in some cases, but might cause segfault in older Node versions.
1490
+ *
1491
+ * @default false
1492
+ */
1493
+ useAtomics?: boolean;
1485
1494
  /**
1486
1495
  * Default timeout of a test in milliseconds
1487
1496
  *
@@ -1762,8 +1771,10 @@ interface UserConfig extends InlineConfig {
1762
1771
  * Path to the config file.
1763
1772
  *
1764
1773
  * Default resolving to `vitest.config.*`, `vite.config.*`
1774
+ *
1775
+ * Setting to `false` will disable config resolving.
1765
1776
  */
1766
- config?: string | undefined;
1777
+ config?: string | false | undefined;
1767
1778
  /**
1768
1779
  * Use happy-dom
1769
1780
  */
package/dist/worker.js CHANGED
@@ -6,13 +6,12 @@ import { ModuleCacheMap } from 'vite-node/client';
6
6
  import { isPrimitive } from 'vite-node/utils';
7
7
  import { d as distDir } from './chunk-constants.797d3ebf.js';
8
8
  import { g as getWorkerState } from './chunk-utils-global.442d1d33.js';
9
- import { e as executeInViteNode } from './chunk-runtime-mocker.03017e8c.js';
9
+ import { e as executeInViteNode } from './chunk-runtime-mocker.eb0c265c.js';
10
10
  import { r as rpc } from './chunk-runtime-rpc.9c0386cc.js';
11
11
  import 'node:url';
12
12
  import './chunk-utils-env.860d90c2.js';
13
13
  import 'std-env';
14
14
  import '@vitest/utils';
15
- import 'vite';
16
15
  import './vendor-index.bdee400f.js';
17
16
  import 'acorn';
18
17
  import 'node:module';
@@ -22,7 +21,7 @@ import 'node:process';
22
21
  import 'node:path';
23
22
  import 'node:v8';
24
23
  import 'node:util';
25
- import './chunk-utils-base.977ae74f.js';
24
+ import './chunk-utils-base.904102a8.js';
26
25
 
27
26
  let _viteNode;
28
27
  const moduleCache = new ModuleCacheMap();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "0.28.1",
4
+ "version": "0.28.3",
5
5
  "description": "A blazing fast unit test framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -124,15 +124,15 @@
124
124
  "std-env": "^3.3.1",
125
125
  "strip-literal": "^1.0.0",
126
126
  "tinybench": "^2.3.1",
127
- "tinypool": "^0.3.0",
127
+ "tinypool": "^0.3.1",
128
128
  "tinyspy": "^1.0.2",
129
129
  "vite": "^3.0.0 || ^4.0.0",
130
130
  "why-is-node-running": "^2.2.2",
131
- "@vitest/expect": "0.28.1",
132
- "@vitest/runner": "0.28.1",
133
- "@vitest/spy": "0.28.1",
134
- "vite-node": "0.28.1",
135
- "@vitest/utils": "0.28.1"
131
+ "@vitest/runner": "0.28.3",
132
+ "vite-node": "0.28.3",
133
+ "@vitest/expect": "0.28.3",
134
+ "@vitest/spy": "0.28.3",
135
+ "@vitest/utils": "0.28.3"
136
136
  },
137
137
  "devDependencies": {
138
138
  "@antfu/install-pkg": "^0.1.1",