vitest 2.1.0-beta.7 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { collectTests, processError, startTests } from '@vitest/runner';
2
- export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './chunks/setup-common.fGBFoQKJ.js';
2
+ export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './chunks/setup-common.DV1PI68g.js';
3
3
  export { g as getCoverageProvider, a as startCoverageInsideWorker, s as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './chunks/coverage.zlNdAMHK.js';
4
4
  export { s as SpyModule } from './chunks/spy.Cf_4R5Oe.js';
5
5
  import '@vitest/utils';
@@ -24,7 +24,7 @@ async function runBaseTests(method, state) {
24
24
  ctx.files.forEach((i) => state.moduleCache.delete(i));
25
25
  const [executor, { run }] = await Promise.all([
26
26
  startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
27
- import('./runBaseTests.Cztfoflv.js')
27
+ import('./runBaseTests.9YDrdSI4.js')
28
28
  ]);
29
29
  await run(
30
30
  method,
@@ -618,7 +618,7 @@ class CAC extends EventEmitter {
618
618
 
619
619
  const cac = (name = "") => new CAC(name);
620
620
 
621
- var version = "2.1.0-beta.7";
621
+ var version = "2.1.0";
622
622
 
623
623
  const apiConfig = (port) => ({
624
624
  port: {
@@ -1501,7 +1501,7 @@ async function start(mode, cliFilters, options) {
1501
1501
  } catch {
1502
1502
  }
1503
1503
  try {
1504
- const { startVitest } = await import('./cli-api.ByZPnilx.js').then(function (n) { return n.d; });
1504
+ const { startVitest } = await import('./cli-api.KmLFBnKP.js').then(function (n) { return n.d; });
1505
1505
  const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(options));
1506
1506
  if (!ctx?.shouldKeepServer()) {
1507
1507
  await ctx?.exit();
@@ -1532,7 +1532,7 @@ async function collect(mode, cliFilters, options) {
1532
1532
  } catch {
1533
1533
  }
1534
1534
  try {
1535
- const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.ByZPnilx.js').then(function (n) { return n.d; });
1535
+ const { prepareVitest, processCollected, outputFileList } = await import('./cli-api.KmLFBnKP.js').then(function (n) { return n.d; });
1536
1536
  const ctx = await prepareVitest(mode, {
1537
1537
  ...normalizeCliOptions(options),
1538
1538
  watch: false,
@@ -8,13 +8,13 @@ import { V as VitestCache, d as configDefaults, m as mm, b as resolveConfig, i a
8
8
  import { ViteNodeRunner } from 'vite-node/client';
9
9
  import { SnapshotManager } from '@vitest/snapshot/manager';
10
10
  import { ViteNodeServer } from 'vite-node/server';
11
- import { v as version$1 } from './cac.B5XYKv2_.js';
11
+ import { v as version$1 } from './cac.Ce8UWvQp.js';
12
12
  import { createFileTask, getTasks, hasFailed, getTests, getNames } from '@vitest/runner/utils';
13
13
  import { n as noop, b as isPrimitive, t as toArray, d as deepMerge, c as nanoid, w as wildcardPatternToRegExp, a as slash, e as stdout } from './base.BlXpj3e_.js';
14
14
  import { toArray as toArray$1, notNullish, createDefer } from '@vitest/utils';
15
15
  import { i as isWindows } from './env.CmHVDJnw.js';
16
16
  import { c as createBirpc } from './index.BpSiYbpB.js';
17
- import { s as stringify, p as parse$5, R as ReportersMap, h as BenchmarkReportsMap, f as TestModule, g as TestSuite, e as TestCase, j as generateCodeFrame, i as TestProject, L as Logger, k as BlobReporter, r as readBlobs } from './index.DpJO1tkB.js';
17
+ import { s as stringify, p as parse$5, R as ReportersMap, h as BenchmarkReportsMap, f as TestModule, g as TestSuite, e as TestCase, j as generateCodeFrame, i as TestProject, L as Logger, k as BlobReporter, r as readBlobs } from './index.zPibhCkV.js';
18
18
  import require$$0$2 from 'stream';
19
19
  import require$$0 from 'zlib';
20
20
  import require$$0$1 from 'buffer';
@@ -1,5 +1,5 @@
1
1
  import { g as globalApis } from './constants.fzPh7AOq.js';
2
- import { V as VitestIndex } from './index.xm8OIiKD.js';
2
+ import { V as VitestIndex } from './index.iyKRMe3s.js';
3
3
  import '@vitest/runner';
4
4
  import './benchmark.C8CRJYG4.js';
5
5
  import '@vitest/runner/utils';
@@ -10,7 +10,7 @@ import './utils.Ck2hJTRs.js';
10
10
  import './env.CmHVDJnw.js';
11
11
  import 'std-env';
12
12
  import './run-once.Sxe67Wng.js';
13
- import './vi.DGgiNzJE.js';
13
+ import './vi.D6IHiKAI.js';
14
14
  import 'chai';
15
15
  import './_commonjsHelpers.BFTU3MAI.js';
16
16
  import '@vitest/expect';
@@ -4,7 +4,7 @@ import { distDir } from '../path.js';
4
4
  import { g as getWorkerState } from './utils.Ck2hJTRs.js';
5
5
  import { r as rpc } from './rpc.B7Mfb-Yf.js';
6
6
  import { t as takeCoverageInsideWorker } from './coverage.zlNdAMHK.js';
7
- import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.fGBFoQKJ.js';
7
+ import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.DV1PI68g.js';
8
8
 
9
9
  function setupChaiConfig(config) {
10
10
  Object.assign(chai.config, config);
@@ -1,7 +1,7 @@
1
1
  import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
2
2
  import { b as bench } from './benchmark.C8CRJYG4.js';
3
3
  import { i as isFirstRun, a as runOnce } from './run-once.Sxe67Wng.js';
4
- import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.DGgiNzJE.js';
4
+ import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.D6IHiKAI.js';
5
5
  import { g as getWorkerState } from './utils.Ck2hJTRs.js';
6
6
  import * as chai from 'chai';
7
7
  import { assert, should } from 'chai';
@@ -3980,10 +3980,12 @@ No ${config.mode} files found, exiting with code 1`)
3980
3980
  const output = project.isCore() ? "" : ` [${name}]`;
3981
3981
  const resolvedUrls = project.browser.vite.resolvedUrls;
3982
3982
  const origin = resolvedUrls?.local[0] ?? resolvedUrls?.network[0];
3983
+ const provider = project.browser.provider.name;
3984
+ const providerString = provider === "preview" ? "" : ` by ${provider}`;
3983
3985
  this.log(
3984
3986
  c.dim(
3985
3987
  c.green(
3986
- ` ${output} Browser runner started at ${new URL("/", origin)}`
3988
+ ` ${output} Browser runner started${providerString} at ${new URL("/", origin)}`
3987
3989
  )
3988
3990
  )
3989
3991
  );
@@ -5,16 +5,16 @@ import '@vitest/runner/utils';
5
5
  import { getSafeTimers } from '@vitest/utils';
6
6
  import { g as getWorkerState } from './utils.Ck2hJTRs.js';
7
7
  import './env.CmHVDJnw.js';
8
- import { a as globalExpect, r as resetModules, v as vi } from './vi.DGgiNzJE.js';
8
+ import { a as globalExpect, r as resetModules, v as vi } from './vi.D6IHiKAI.js';
9
9
  import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from './coverage.zlNdAMHK.js';
10
- import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.CSjyR2-v.js';
10
+ import { a as resolveSnapshotEnvironment, s as setupChaiConfig, r as resolveTestRunner } from './index.DkN6V87F.js';
11
11
  import { createRequire } from 'node:module';
12
12
  import util from 'node:util';
13
13
  import timers from 'node:timers';
14
14
  import { installSourcemapsSupport } from 'vite-node/source-map';
15
15
  import { KNOWN_ASSET_TYPES } from 'vite-node/constants';
16
- import { V as VitestIndex } from './index.xm8OIiKD.js';
17
- import { s as setupCommonEnv } from './setup-common.fGBFoQKJ.js';
16
+ import { V as VitestIndex } from './index.iyKRMe3s.js';
17
+ import { s as setupCommonEnv } from './setup-common.DV1PI68g.js';
18
18
  import { c as closeInspector } from './inspector.70d6emsh.js';
19
19
  import 'std-env';
20
20
  import 'chai';
@@ -13,7 +13,7 @@ async function setupCommonEnv(config) {
13
13
  globalSetup = true;
14
14
  setSafeTimers();
15
15
  if (config.globals) {
16
- (await import('./globals.jM7MxN2t.js')).registerApiGlobally();
16
+ (await import('./globals.C03P0O1a.js')).registerApiGlobally();
17
17
  }
18
18
  }
19
19
  function setupDefines(defines) {
@@ -463,7 +463,6 @@ function createExpect(test) {
463
463
  expect.getState = () => getState(expect);
464
464
  expect.setState = (state) => setState(state, expect);
465
465
  const globalState = getState(globalThis[GLOBAL_EXPECT]) || {};
466
- const testPath = getTestFile(test);
467
466
  setState(
468
467
  {
469
468
  // this should also add "snapshotState" that is added conditionally
@@ -474,7 +473,9 @@ function createExpect(test) {
474
473
  expectedAssertionsNumber: null,
475
474
  expectedAssertionsNumberErrorGen: null,
476
475
  environment: getCurrentEnvironment(),
477
- testPath,
476
+ get testPath() {
477
+ return getWorkerState().filepath;
478
+ },
478
479
  currentTestName: test ? getTestName(test) : globalState.currentTestName
479
480
  },
480
481
  expect
@@ -516,13 +517,6 @@ function createExpect(test) {
516
517
  chai$1.util.addMethod(expect, "hasAssertions", hasAssertions);
517
518
  return expect;
518
519
  }
519
- function getTestFile(test) {
520
- if (test) {
521
- return test.file.filepath;
522
- }
523
- const state = getWorkerState();
524
- return state.filepath;
525
- }
526
520
  const globalExpect = createExpect();
527
521
  Object.defineProperty(globalThis, GLOBAL_EXPECT, {
528
522
  value: globalExpect,
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createCLI } from './chunks/cac.B5XYKv2_.js';
1
+ import { c as createCLI } from './chunks/cac.Ce8UWvQp.js';
2
2
  import 'pathe';
3
3
  import 'events';
4
4
  import 'tinyrainbow';
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
2
2
  export { b as bench } from './chunks/benchmark.C8CRJYG4.js';
3
- import { d as dist } from './chunks/index.xm8OIiKD.js';
4
- export { a as assertType, g as getRunningMode, b as inject, i as isWatchMode } from './chunks/index.xm8OIiKD.js';
3
+ import { d as dist } from './chunks/index.iyKRMe3s.js';
4
+ export { a as assertType, g as getRunningMode, b as inject, i as isWatchMode } from './chunks/index.iyKRMe3s.js';
5
5
  export { i as isFirstRun, a as runOnce } from './chunks/run-once.Sxe67Wng.js';
6
- export { c as createExpect, a as expect, v as vi, b as vitest } from './chunks/vi.DGgiNzJE.js';
6
+ export { c as createExpect, a as expect, v as vi, b as vitest } from './chunks/vi.D6IHiKAI.js';
7
7
  import * as chai from 'chai';
8
8
  export { chai };
9
9
  export { assert, should } from 'chai';
package/dist/node.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { createServer as createServer$1 } from 'vite';
2
2
  export { createLogger as createViteLogger, isFileServingAllowed, parseAst, parseAstAsync } from 'vite';
3
- import { f as TestModule } from './chunks/index.DpJO1tkB.js';
4
- export { e as TestCase, i as TestProject, g as TestSuite } from './chunks/index.DpJO1tkB.js';
5
- export { G as GitNotFoundError, T as TestSpecification, F as TestsNotFoundError, a as VitestPackageInstaller, V as VitestPlugin, c as createVitest, r as registerConsoleShortcuts, b as resolveFsAllow, s as startVitest } from './chunks/cli-api.ByZPnilx.js';
6
- export { p as parseCLI } from './chunks/cac.B5XYKv2_.js';
3
+ import { f as TestModule } from './chunks/index.zPibhCkV.js';
4
+ export { e as TestCase, i as TestProject, g as TestSuite } from './chunks/index.zPibhCkV.js';
5
+ export { G as GitNotFoundError, T as TestSpecification, F as TestsNotFoundError, a as VitestPackageInstaller, V as VitestPlugin, c as createVitest, r as registerConsoleShortcuts, b as resolveFsAllow, s as startVitest } from './chunks/cli-api.KmLFBnKP.js';
6
+ export { p as parseCLI } from './chunks/cac.Ce8UWvQp.js';
7
7
  export { c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig, b as resolveConfig } from './chunks/resolveConfig.-K5hHm0S.js';
8
8
  import createDebug from 'debug';
9
9
  export { distDir, rootDir } from './path.js';
package/dist/reporters.js CHANGED
@@ -1,4 +1,4 @@
1
- export { B as BasicReporter, h as BenchmarkReportsMap, D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, c as TapFlatReporter, T as TapReporter, e as TestCase, d as TestFile, f as TestModule, g as TestSuite, V as VerboseReporter } from './chunks/index.DpJO1tkB.js';
1
+ export { B as BasicReporter, h as BenchmarkReportsMap, D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, c as TapFlatReporter, T as TapReporter, e as TestCase, d as TestFile, f as TestModule, g as TestSuite, V as VerboseReporter } from './chunks/index.zPibhCkV.js';
2
2
  import 'node:fs';
3
3
  import 'tinyrainbow';
4
4
  import 'pathe';
package/dist/runners.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
2
- import { g as getSnapshotClient, c as createExpect, v as vi } from './chunks/vi.DGgiNzJE.js';
2
+ import { g as getSnapshotClient, c as createExpect, v as vi } from './chunks/vi.D6IHiKAI.js';
3
3
  import 'pathe';
4
4
  import { g as getTestName } from './chunks/tasks.BZnCS9aT.js';
5
5
  import { createDefer, getSafeTimers } from '@vitest/utils';
@@ -1,6 +1,6 @@
1
1
  import v8 from 'node:v8';
2
2
  import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../chunks/utils.Cn0zI1t3.js';
3
- import { r as runBaseTests } from '../chunks/base.CchlWrnV.js';
3
+ import { r as runBaseTests } from '../chunks/base.CsQmmYBA.js';
4
4
  import '@vitest/utils';
5
5
  import 'vite-node/client';
6
6
  import '../chunks/utils.Ck2hJTRs.js';
@@ -5,11 +5,11 @@ import { performance } from 'node:perf_hooks';
5
5
  import { startTests, collectTests } from '@vitest/runner';
6
6
  import { installSourcemapsSupport } from 'vite-node/source-map';
7
7
  import { KNOWN_ASSET_TYPES } from 'vite-node/constants';
8
- import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../chunks/index.CSjyR2-v.js';
8
+ import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../chunks/index.DkN6V87F.js';
9
9
  import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../chunks/coverage.zlNdAMHK.js';
10
- import { V as VitestIndex } from '../chunks/index.xm8OIiKD.js';
10
+ import { V as VitestIndex } from '../chunks/index.iyKRMe3s.js';
11
11
  import { g as getWorkerState } from '../chunks/utils.Ck2hJTRs.js';
12
- import { s as setupCommonEnv } from '../chunks/setup-common.fGBFoQKJ.js';
12
+ import { s as setupCommonEnv } from '../chunks/setup-common.DV1PI68g.js';
13
13
  import { c as closeInspector } from '../chunks/inspector.70d6emsh.js';
14
14
  import 'chai';
15
15
  import 'pathe';
@@ -24,7 +24,7 @@ import '../chunks/index.CxRxs566.js';
24
24
  import '../chunks/env.CmHVDJnw.js';
25
25
  import 'std-env';
26
26
  import '../chunks/run-once.Sxe67Wng.js';
27
- import '../chunks/vi.DGgiNzJE.js';
27
+ import '../chunks/vi.D6IHiKAI.js';
28
28
  import '../chunks/_commonjsHelpers.BFTU3MAI.js';
29
29
  import '@vitest/expect';
30
30
  import '@vitest/snapshot';
@@ -1,4 +1,4 @@
1
- import { r as runBaseTests } from '../chunks/base.CchlWrnV.js';
1
+ import { r as runBaseTests } from '../chunks/base.CsQmmYBA.js';
2
2
  import { a as createThreadsRpcOptions } from '../chunks/utils.Cn0zI1t3.js';
3
3
  import 'vite-node/client';
4
4
  import '../chunks/utils.Ck2hJTRs.js';
package/dist/workers.js CHANGED
@@ -2,7 +2,7 @@ export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapSe
2
2
  export { p as provideWorkerState } from './chunks/utils.Ck2hJTRs.js';
3
3
  export { collect as collectVitestWorkerTests, run as runVitestWorker } from './worker.js';
4
4
  export { r as runVmTests } from './chunks/vm.CPXwWp4C.js';
5
- export { r as runBaseTests } from './chunks/base.CchlWrnV.js';
5
+ export { r as runBaseTests } from './chunks/base.CsQmmYBA.js';
6
6
  import '@vitest/utils';
7
7
  import 'node:url';
8
8
  import 'tinypool';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "2.1.0-beta.7",
4
+ "version": "2.1.0",
5
5
  "description": "Next generation testing framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -122,8 +122,8 @@
122
122
  "@types/node": "^18.0.0 || >=20.0.0",
123
123
  "happy-dom": "*",
124
124
  "jsdom": "*",
125
- "@vitest/ui": "2.1.0-beta.7",
126
- "@vitest/browser": "2.1.0-beta.7"
125
+ "@vitest/browser": "2.1.0",
126
+ "@vitest/ui": "2.1.0"
127
127
  },
128
128
  "peerDependenciesMeta": {
129
129
  "@edge-runtime/vm": {
@@ -157,14 +157,14 @@
157
157
  "tinyrainbow": "^1.2.0",
158
158
  "vite": "^5.0.0",
159
159
  "why-is-node-running": "^2.3.0",
160
- "@vitest/expect": "2.1.0-beta.7",
161
- "@vitest/mocker": "2.1.0-beta.7",
162
- "@vitest/pretty-format": "^2.1.0-beta.7",
163
- "@vitest/snapshot": "2.1.0-beta.7",
164
- "@vitest/spy": "2.1.0-beta.7",
165
- "@vitest/utils": "2.1.0-beta.7",
166
- "@vitest/runner": "2.1.0-beta.7",
167
- "vite-node": "2.1.0-beta.7"
160
+ "@vitest/expect": "2.1.0",
161
+ "@vitest/runner": "2.1.0",
162
+ "@vitest/mocker": "2.1.0",
163
+ "@vitest/snapshot": "2.1.0",
164
+ "@vitest/spy": "2.1.0",
165
+ "@vitest/pretty-format": "^2.1.0",
166
+ "@vitest/utils": "2.1.0",
167
+ "vite-node": "2.1.0"
168
168
  },
169
169
  "devDependencies": {
170
170
  "@ampproject/remapping": "^2.3.0",