vitest 3.0.7 → 3.0.9

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.
Files changed (66) hide show
  1. package/dist/browser.d.ts +14 -43
  2. package/dist/browser.js +4 -4
  3. package/dist/chunks/{base.BgUWWWYp.js → base.DV59CbtV.js} +2 -2
  4. package/dist/chunks/{benchmark.Cdu9hjj4.js → benchmark.DL72EVN-.js} +1 -1
  5. package/dist/chunks/{benchmark.CFFwLv-O.d.ts → benchmark.d.BwvBVTda.d.ts} +11 -11
  6. package/dist/chunks/{cac.87F_onld.js → cac.CeVHgzve.js} +30 -6
  7. package/dist/chunks/{cli-api.BZbq1zTX.js → cli-api.Ckwz_xSb.js} +21 -23
  8. package/dist/chunks/config.d.DevWltVl.d.ts +218 -0
  9. package/dist/chunks/{constants.fzPh7AOq.js → constants.DTYd6dNH.js} +1 -1
  10. package/dist/chunks/{coverage.DnNIv-kJ.js → coverage.A3sS5-Wm.js} +1 -29
  11. package/dist/chunks/coverage.d.S9RMNXIe.d.ts +35 -0
  12. package/dist/chunks/{resolveConfig.BbcK25zb.js → coverage.gV8doR2Y.js} +500 -131
  13. package/dist/chunks/{creator.2CFRE1Yx.js → creator.BsBnpTzI.js} +1 -1
  14. package/dist/chunks/defaults.C2Ndd9wx.js +119 -0
  15. package/dist/chunks/env.D4Lgay0q.js +8 -0
  16. package/dist/chunks/environment.d.C8UItCbf.d.ts +170 -0
  17. package/dist/chunks/{execute.Bhwls1-Z.js → execute.eDH0aFFd.js} +4 -4
  18. package/dist/chunks/global.d.Cg2sEPIm.d.ts +127 -0
  19. package/dist/chunks/{globals.BCtI_nQG.js → globals.BEpDe-k3.js} +5 -5
  20. package/dist/chunks/{index.C1f-_gvH.js → index.B8tIoLPT.js} +8 -3
  21. package/dist/chunks/{index.B8haHJlQ.js → index.D7Ny8f_s.js} +2 -2
  22. package/dist/chunks/{index.BmFFzXX_.js → index.uXkkC4xl.js} +1 -2
  23. package/dist/chunks/{mocker.cRtM890J.d.ts → mocker.d.BE_2ls6u.d.ts} +6 -6
  24. package/dist/chunks/reporters.d.CqBhtcTq.d.ts +3006 -0
  25. package/dist/chunks/{runBaseTests.9XCQcSZC.js → runBaseTests.BVrL_ow3.js} +9 -9
  26. package/dist/chunks/{setup-common.wObu9a36.js → setup-common.CPvtqi8q.js} +25 -2
  27. package/dist/chunks/{suite.qtkXWc6R.d.ts → suite.d.FvehnV49.d.ts} +1 -1
  28. package/dist/chunks/{typechecker.cZ0LjdSi.js → typechecker.BlF3eHsb.js} +2 -7
  29. package/dist/chunks/{vi.DT3m61kS.js → vi.nSCvwQ7l.js} +4 -4
  30. package/dist/chunks/vite.d.BUZTGxQ3.d.ts +11 -0
  31. package/dist/chunks/{vm.6kNys9FN.js → vm.jEFQDlX_.js} +1 -1
  32. package/dist/chunks/{worker.DaAIyCKm.d.ts → worker.d.C58isfFm.d.ts} +62 -62
  33. package/dist/chunks/{worker.B2JXutr8.d.ts → worker.d.CSFlSYJg.d.ts} +2 -2
  34. package/dist/cli.js +2 -2
  35. package/dist/config.d.ts +48 -45
  36. package/dist/config.js +6 -123
  37. package/dist/coverage.d.ts +82 -79
  38. package/dist/coverage.js +19 -469
  39. package/dist/environments.d.ts +11 -11
  40. package/dist/execute.d.ts +109 -109
  41. package/dist/execute.js +1 -1
  42. package/dist/index.d.ts +414 -412
  43. package/dist/index.js +4 -4
  44. package/dist/node.d.ts +51 -48
  45. package/dist/node.js +13 -10
  46. package/dist/reporters.d.ts +7 -4
  47. package/dist/reporters.js +3 -2
  48. package/dist/runners.d.ts +28 -28
  49. package/dist/runners.js +3 -4
  50. package/dist/snapshot.d.ts +2 -2
  51. package/dist/suite.d.ts +2 -2
  52. package/dist/suite.js +1 -1
  53. package/dist/workers/forks.js +2 -2
  54. package/dist/workers/runVmTests.js +9 -9
  55. package/dist/workers/threads.js +2 -2
  56. package/dist/workers/vmForks.js +2 -2
  57. package/dist/workers/vmThreads.js +2 -2
  58. package/dist/workers.d.ts +13 -13
  59. package/dist/workers.js +3 -3
  60. package/package.json +12 -12
  61. package/dist/chunks/config.BRtC-JeT.d.ts +0 -215
  62. package/dist/chunks/environment.d8YfPkTm.d.ts +0 -173
  63. package/dist/chunks/global.CnI8_G5V.d.ts +0 -133
  64. package/dist/chunks/reporters.QZ837uWx.d.ts +0 -3051
  65. package/dist/chunks/spy.Cf_4R5Oe.js +0 -22
  66. package/dist/chunks/vite.vM3UZq1q.d.ts +0 -11
@@ -0,0 +1,119 @@
1
+ import nodeos__default from 'node:os';
2
+ import './env.D4Lgay0q.js';
3
+ import { isCI } from 'std-env';
4
+
5
+ const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
6
+ const defaultExclude = [
7
+ "**/node_modules/**",
8
+ "**/dist/**",
9
+ "**/cypress/**",
10
+ "**/.{idea,git,cache,output,temp}/**",
11
+ "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*"
12
+ ];
13
+ const benchmarkConfigDefaults = {
14
+ include: ["**/*.{bench,benchmark}.?(c|m)[jt]s?(x)"],
15
+ exclude: defaultExclude,
16
+ includeSource: [],
17
+ reporters: ["default"],
18
+ includeSamples: false
19
+ };
20
+ const defaultCoverageExcludes = [
21
+ "coverage/**",
22
+ "dist/**",
23
+ "**/node_modules/**",
24
+ "**/[.]**",
25
+ "packages/*/test?(s)/**",
26
+ "**/*.d.ts",
27
+ "**/virtual:*",
28
+ "**/__x00__*",
29
+ "**/\0*",
30
+ "cypress/**",
31
+ "test?(s)/**",
32
+ "test?(-*).?(c|m)[jt]s?(x)",
33
+ "**/*{.,-}{test,spec,bench,benchmark}?(-d).?(c|m)[jt]s?(x)",
34
+ "**/__tests__/**",
35
+ "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*",
36
+ "**/vitest.{workspace,projects}.[jt]s?(on)",
37
+ "**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}"
38
+ ];
39
+ const coverageConfigDefaults = {
40
+ provider: "v8",
41
+ enabled: false,
42
+ all: true,
43
+ clean: true,
44
+ cleanOnRerun: true,
45
+ reportsDirectory: "./coverage",
46
+ exclude: defaultCoverageExcludes,
47
+ reportOnFailure: false,
48
+ reporter: [
49
+ ["text", {}],
50
+ ["html", {}],
51
+ ["clover", {}],
52
+ ["json", {}]
53
+ ],
54
+ extension: [
55
+ ".js",
56
+ ".cjs",
57
+ ".mjs",
58
+ ".ts",
59
+ ".mts",
60
+ ".tsx",
61
+ ".jsx",
62
+ ".vue",
63
+ ".svelte",
64
+ ".marko",
65
+ ".astro"
66
+ ],
67
+ allowExternal: false,
68
+ excludeAfterRemap: false,
69
+ ignoreEmptyLines: true,
70
+ processingConcurrency: Math.min(
71
+ 20,
72
+ nodeos__default.availableParallelism?.() ?? nodeos__default.cpus().length
73
+ )
74
+ };
75
+ const fakeTimersDefaults = {
76
+ loopLimit: 1e4,
77
+ shouldClearNativeTimers: true
78
+ };
79
+ const configDefaults = Object.freeze({
80
+ allowOnly: !isCI,
81
+ isolate: true,
82
+ watch: !isCI,
83
+ globals: false,
84
+ environment: "node",
85
+ pool: "forks",
86
+ clearMocks: false,
87
+ restoreMocks: false,
88
+ mockReset: false,
89
+ unstubGlobals: false,
90
+ unstubEnvs: false,
91
+ include: defaultInclude,
92
+ exclude: defaultExclude,
93
+ teardownTimeout: 1e4,
94
+ forceRerunTriggers: ["**/package.json/**", "**/{vitest,vite}.config.*/**"],
95
+ update: false,
96
+ reporters: [],
97
+ silent: false,
98
+ hideSkippedTests: false,
99
+ api: false,
100
+ ui: false,
101
+ uiBase: "/__vitest__/",
102
+ open: !isCI,
103
+ css: {
104
+ include: []
105
+ },
106
+ coverage: coverageConfigDefaults,
107
+ fakeTimers: fakeTimersDefaults,
108
+ maxConcurrency: 5,
109
+ dangerouslyIgnoreUnhandledErrors: false,
110
+ typecheck: {
111
+ checker: "tsc",
112
+ include: ["**/*.{test,spec}-d.?(c|m)[jt]s?(x)"],
113
+ exclude: defaultExclude
114
+ },
115
+ slowTestThreshold: 300,
116
+ disableConsoleIntercept: false
117
+ });
118
+
119
+ export { coverageConfigDefaults as a, defaultInclude as b, configDefaults as c, defaultExclude as d, benchmarkConfigDefaults as e };
@@ -0,0 +1,8 @@
1
+ import { isCI } from 'std-env';
2
+
3
+ const isNode = typeof process < "u" && typeof process.stdout < "u" && !process.versions?.deno && !globalThis.window;
4
+ const isDeno = typeof process < "u" && typeof process.stdout < "u" && process.versions?.deno !== void 0;
5
+ const isWindows = (isNode || isDeno) && process.platform === "win32";
6
+ const isTTY = (isNode || isDeno) && process.stdout?.isTTY && !isCI;
7
+
8
+ export { isWindows as a, isTTY as i };
@@ -0,0 +1,170 @@
1
+ type Awaitable<T> = T | PromiseLike<T>;
2
+ type Nullable<T> = T | null | undefined;
3
+ type Arrayable<T> = T | Array<T>;
4
+ type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
5
+ type MutableArray<T extends readonly any[]> = { -readonly [k in keyof T] : T[k] };
6
+ interface Constructable {
7
+ new (...args: any[]): any;
8
+ }
9
+ type TransformMode = "web" | "ssr";
10
+ /** @deprecated not used */
11
+ interface ModuleCache {
12
+ promise?: Promise<any>;
13
+ exports?: any;
14
+ code?: string;
15
+ }
16
+ interface AfterSuiteRunMeta {
17
+ coverage?: unknown;
18
+ testFiles: string[];
19
+ transformMode: TransformMode | "browser";
20
+ projectName?: string;
21
+ }
22
+ interface UserConsoleLog {
23
+ content: string;
24
+ origin?: string;
25
+ browser?: boolean;
26
+ type: "stdout" | "stderr";
27
+ taskId?: string;
28
+ time: number;
29
+ size: number;
30
+ }
31
+ interface ModuleGraphData {
32
+ graph: Record<string, string[]>;
33
+ externalized: string[];
34
+ inlined: string[];
35
+ }
36
+ interface ProvidedContext {}
37
+
38
+ /**
39
+ * Happy DOM options.
40
+ */
41
+ interface HappyDOMOptions {
42
+ width?: number;
43
+ height?: number;
44
+ url?: string;
45
+ settings?: {
46
+ disableJavaScriptEvaluation?: boolean
47
+ disableJavaScriptFileLoading?: boolean
48
+ disableCSSFileLoading?: boolean
49
+ disableIframePageLoading?: boolean
50
+ disableComputedStyleRendering?: boolean
51
+ enableFileSystemHttpRequests?: boolean
52
+ navigator?: {
53
+ userAgent?: string
54
+ }
55
+ device?: {
56
+ prefersColorScheme?: string
57
+ mediaType?: string
58
+ }
59
+ };
60
+ }
61
+
62
+ interface JSDOMOptions {
63
+ /**
64
+ * The html content for the test.
65
+ *
66
+ * @default '<!DOCTYPE html>'
67
+ */
68
+ html?: string | ArrayBufferLike;
69
+ /**
70
+ * referrer just affects the value read from document.referrer.
71
+ * It defaults to no referrer (which reflects as the empty string).
72
+ */
73
+ referrer?: string;
74
+ /**
75
+ * userAgent affects the value read from navigator.userAgent, as well as the User-Agent header sent while fetching subresources.
76
+ *
77
+ * @default `Mozilla/5.0 (${process.platform}) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/${jsdomVersion}`
78
+ */
79
+ userAgent?: string;
80
+ /**
81
+ * url sets the value returned by window.location, document.URL, and document.documentURI,
82
+ * and affects things like resolution of relative URLs within the document
83
+ * and the same-origin restrictions and referrer used while fetching subresources.
84
+ *
85
+ * @default 'http://localhost:3000'.
86
+ */
87
+ url?: string;
88
+ /**
89
+ * contentType affects the value read from document.contentType, and how the document is parsed: as HTML or as XML.
90
+ * Values that are not "text/html" or an XML mime type will throw.
91
+ *
92
+ * @default 'text/html'.
93
+ */
94
+ contentType?: string;
95
+ /**
96
+ * The maximum size in code units for the separate storage areas used by localStorage and sessionStorage.
97
+ * Attempts to store data larger than this limit will cause a DOMException to be thrown. By default, it is set
98
+ * to 5,000,000 code units per origin, as inspired by the HTML specification.
99
+ *
100
+ * @default 5_000_000
101
+ */
102
+ storageQuota?: number;
103
+ /**
104
+ * Enable console?
105
+ *
106
+ * @default false
107
+ */
108
+ console?: boolean;
109
+ /**
110
+ * jsdom does not have the capability to render visual content, and will act like a headless browser by default.
111
+ * It provides hints to web pages through APIs such as document.hidden that their content is not visible.
112
+ *
113
+ * When the `pretendToBeVisual` option is set to `true`, jsdom will pretend that it is rendering and displaying
114
+ * content.
115
+ *
116
+ * @default true
117
+ */
118
+ pretendToBeVisual?: boolean;
119
+ /**
120
+ * `includeNodeLocations` preserves the location info produced by the HTML parser,
121
+ * allowing you to retrieve it with the nodeLocation() method (described below).
122
+ *
123
+ * It defaults to false to give the best performance,
124
+ * and cannot be used with an XML content type since our XML parser does not support location info.
125
+ *
126
+ * @default false
127
+ */
128
+ includeNodeLocations?: boolean | undefined;
129
+ /**
130
+ * @default 'dangerously'
131
+ */
132
+ runScripts?: "dangerously" | "outside-only";
133
+ /**
134
+ * Enable CookieJar
135
+ *
136
+ * @default false
137
+ */
138
+ cookieJar?: boolean;
139
+ resources?: "usable";
140
+ }
141
+
142
+ interface EnvironmentReturn {
143
+ teardown: (global: any) => Awaitable<void>;
144
+ }
145
+ interface VmEnvironmentReturn {
146
+ getVmContext: () => {
147
+ [key: string]: any
148
+ };
149
+ teardown: () => Awaitable<void>;
150
+ }
151
+ interface Environment {
152
+ name: string;
153
+ transformMode: "web" | "ssr";
154
+ setupVM?: (options: Record<string, any>) => Awaitable<VmEnvironmentReturn>;
155
+ setup: (global: any, options: Record<string, any>) => Awaitable<EnvironmentReturn>;
156
+ }
157
+ interface EnvironmentOptions {
158
+ /**
159
+ * jsdom options.
160
+ */
161
+ jsdom?: JSDOMOptions;
162
+ happyDOM?: HappyDOMOptions;
163
+ [x: string]: unknown;
164
+ }
165
+ interface ResolvedTestEnvironment {
166
+ environment: Environment;
167
+ options: Record<string, any> | null;
168
+ }
169
+
170
+ export type { AfterSuiteRunMeta as A, Constructable as C, Environment as E, HappyDOMOptions as H, JSDOMOptions as J, ModuleGraphData as M, Nullable as N, ProvidedContext as P, ResolvedTestEnvironment as R, TransformMode as T, UserConsoleLog as U, VmEnvironmentReturn as V, EnvironmentReturn as a, Awaitable as b, Arrayable as c, ArgumentsType as d, MutableArray as e, EnvironmentOptions as f, ModuleCache as g };
@@ -2,7 +2,7 @@ import fs from 'node:fs';
2
2
  import { pathToFileURL } from 'node:url';
3
3
  import vm from 'node:vm';
4
4
  import { processError } from '@vitest/utils/error';
5
- import { normalize as normalize$1, relative } from 'pathe';
5
+ import { normalize as normalize$1 } from 'pathe';
6
6
  import { ViteNodeRunner, DEFAULT_REQUEST_STUBS } from 'vite-node/client';
7
7
  import { isInternalRequest, isNodeBuiltin as isNodeBuiltin$1, isPrimitive, toFilePath } from 'vite-node/utils';
8
8
  import { distDir } from '../path.js';
@@ -581,7 +581,7 @@ function listenForErrors(state) {
581
581
  dispose.length = 0;
582
582
  function catchError(err, type, event) {
583
583
  const worker = state();
584
- if (worker.current) {
584
+ if (worker.current?.type === "test") {
585
585
  const listeners = process.listeners(event);
586
586
  if (listeners.length > 1) {
587
587
  return;
@@ -589,9 +589,9 @@ function listenForErrors(state) {
589
589
  }
590
590
  const error = processError(err);
591
591
  if (!isPrimitive(error)) {
592
- error.VITEST_TEST_NAME = worker.current?.name;
592
+ error.VITEST_TEST_NAME = worker.current?.type === "test" ? worker.current.name : void 0;
593
593
  if (worker.filepath) {
594
- error.VITEST_TEST_PATH = relative(state().config.root, worker.filepath);
594
+ error.VITEST_TEST_PATH = worker.filepath;
595
595
  }
596
596
  error.VITEST_AFTER_ENV_TEARDOWN = worker.environmentTeardownRun;
597
597
  }
@@ -0,0 +1,127 @@
1
+ import { PromisifyAssertion, Tester, ExpectStatic } from '@vitest/expect';
2
+ import { Plugin } from '@vitest/pretty-format';
3
+ import { SnapshotState } from '@vitest/snapshot';
4
+ import { B as BenchmarkResult } from './benchmark.d.BwvBVTda.js';
5
+ import { U as UserConsoleLog } from './environment.d.C8UItCbf.js';
6
+
7
+ type RawErrsMap = Map<string, TscErrorInfo[]>;
8
+ interface TscErrorInfo {
9
+ filePath: string;
10
+ errCode: number;
11
+ errMsg: string;
12
+ line: number;
13
+ column: number;
14
+ }
15
+ interface CollectLineNumbers {
16
+ target: number;
17
+ next: number;
18
+ prev?: number;
19
+ }
20
+ type CollectLines = { [key in keyof CollectLineNumbers] : string };
21
+ interface RootAndTarget {
22
+ root: string;
23
+ targetAbsPath: string;
24
+ }
25
+ type Context = RootAndTarget & {
26
+ rawErrsMap: RawErrsMap
27
+ openedDirs: Set<string>
28
+ lastActivePath?: string
29
+ };
30
+
31
+ declare global {
32
+ namespace Chai {
33
+ interface Assertion {
34
+ containSubset: (expected: any) => Assertion;
35
+ }
36
+ interface Assert {
37
+ containSubset: (val: any, exp: any, msg?: string) => void;
38
+ }
39
+ }
40
+ }
41
+ interface SnapshotMatcher<T> {
42
+ <U extends { [P in keyof T] : any }>(snapshot: Partial<U>, message?: string): void;
43
+ (message?: string): void;
44
+ }
45
+ interface InlineSnapshotMatcher<T> {
46
+ <U extends { [P in keyof T] : any }>(properties: Partial<U>, snapshot?: string, message?: string): void;
47
+ (message?: string): void;
48
+ }
49
+ declare module "@vitest/expect" {
50
+ interface MatcherState {
51
+ environment: string;
52
+ snapshotState: SnapshotState;
53
+ }
54
+ interface ExpectPollOptions {
55
+ interval?: number;
56
+ timeout?: number;
57
+ message?: string;
58
+ }
59
+ interface ExpectStatic {
60
+ unreachable: (message?: string) => never;
61
+ soft: <T>(actual: T, message?: string) => Assertion<T>;
62
+ poll: <T>(actual: () => T, options?: ExpectPollOptions) => PromisifyAssertion<Awaited<T>>;
63
+ addEqualityTesters: (testers: Array<Tester>) => void;
64
+ assertions: (expected: number) => void;
65
+ hasAssertions: () => void;
66
+ addSnapshotSerializer: (plugin: Plugin) => void;
67
+ }
68
+ interface Assertion<T> {
69
+ matchSnapshot: SnapshotMatcher<T>;
70
+ toMatchSnapshot: SnapshotMatcher<T>;
71
+ toMatchInlineSnapshot: InlineSnapshotMatcher<T>;
72
+ /**
73
+ * Checks that an error thrown by a function matches a previously recorded snapshot.
74
+ *
75
+ * @param message - Optional custom error message.
76
+ *
77
+ * @example
78
+ * expect(functionWithError).toThrowErrorMatchingSnapshot();
79
+ */
80
+ toThrowErrorMatchingSnapshot: (message?: string) => void;
81
+ /**
82
+ * Checks that an error thrown by a function matches an inline snapshot within the test file.
83
+ * Useful for keeping snapshots close to the test code.
84
+ *
85
+ * @param snapshot - Optional inline snapshot string to match.
86
+ * @param message - Optional custom error message.
87
+ *
88
+ * @example
89
+ * const throwError = () => { throw new Error('Error occurred') };
90
+ * expect(throwError).toThrowErrorMatchingInlineSnapshot(`"Error occurred"`);
91
+ */
92
+ toThrowErrorMatchingInlineSnapshot: (snapshot?: string, message?: string) => void;
93
+ /**
94
+ * Compares the received value to a snapshot saved in a specified file.
95
+ * Useful for cases where snapshot content is large or needs to be shared across tests.
96
+ *
97
+ * @param filepath - Path to the snapshot file.
98
+ * @param message - Optional custom error message.
99
+ *
100
+ * @example
101
+ * await expect(largeData).toMatchFileSnapshot('path/to/snapshot.json');
102
+ */
103
+ toMatchFileSnapshot: (filepath: string, message?: string) => Promise<void>;
104
+ }
105
+ }
106
+ declare module "@vitest/runner" {
107
+ interface TestContext {
108
+ expect: ExpectStatic;
109
+ }
110
+ interface TaskMeta {
111
+ typecheck?: boolean;
112
+ benchmark?: boolean;
113
+ failScreenshotPath?: string;
114
+ }
115
+ interface File {
116
+ prepareDuration?: number;
117
+ environmentLoad?: number;
118
+ }
119
+ interface TaskBase {
120
+ logs?: UserConsoleLog[];
121
+ }
122
+ interface TaskResult {
123
+ benchmark?: BenchmarkResult;
124
+ }
125
+ }
126
+
127
+ export type { CollectLineNumbers as C, RawErrsMap as R, TscErrorInfo as T, CollectLines as a, RootAndTarget as b, Context as c };
@@ -1,6 +1,6 @@
1
- import { g as globalApis } from './constants.fzPh7AOq.js';
2
- import { V as VitestIndex } from './index.B8haHJlQ.js';
3
- import './vi.DT3m61kS.js';
1
+ import { g as globalApis } from './constants.DTYd6dNH.js';
2
+ import { V as VitestIndex } from './index.D7Ny8f_s.js';
3
+ import './vi.nSCvwQ7l.js';
4
4
  import '@vitest/expect';
5
5
  import '@vitest/runner';
6
6
  import '@vitest/runner/utils';
@@ -10,11 +10,11 @@ import '@vitest/utils';
10
10
  import './_commonjsHelpers.BFTU3MAI.js';
11
11
  import '@vitest/snapshot';
12
12
  import '@vitest/utils/error';
13
+ import '@vitest/spy';
13
14
  import '@vitest/utils/source-map';
14
15
  import './date.W2xKR2qe.js';
15
- import '@vitest/spy';
16
16
  import './run-once.2ogXb3JV.js';
17
- import './benchmark.Cdu9hjj4.js';
17
+ import './benchmark.DL72EVN-.js';
18
18
  import 'expect-type';
19
19
 
20
20
  function registerApiGlobally() {
@@ -8,7 +8,8 @@ import { stripVTControlCharacters } from 'node:util';
8
8
  import { positionToOffset, lineSplitRE, isPrimitive, inspect, toArray, notNullish } from '@vitest/utils';
9
9
  import { performance as performance$1 } from 'node:perf_hooks';
10
10
  import { parseErrorStacktrace, parseStacktrace } from '@vitest/utils/source-map';
11
- import { T as TypeCheckError, g as getOutputFile, i as isTTY, h as hasFailedSnapshot } from './typechecker.cZ0LjdSi.js';
11
+ import { i as isTTY } from './env.D4Lgay0q.js';
12
+ import { T as TypeCheckError, g as getOutputFile, h as hasFailedSnapshot } from './typechecker.BlF3eHsb.js';
12
13
  import { mkdir, writeFile, readdir, stat, readFile } from 'node:fs/promises';
13
14
  import { Console } from 'node:console';
14
15
  import { Writable } from 'node:stream';
@@ -192,7 +193,7 @@ function printErrorInner(error, project, options) {
192
193
  }
193
194
  });
194
195
  if (type) {
195
- printErrorType(type, project.ctx);
196
+ printErrorType(type, project.vitest);
196
197
  }
197
198
  printErrorMessage(e, logger);
198
199
  if (options.screenshotPaths?.length) {
@@ -246,7 +247,7 @@ ${e.diff}
246
247
  logger.error(
247
248
  c.red(
248
249
  `This error originated in "${c.bold(
249
- testPath
250
+ relative(project.config.root, testPath)
250
251
  )}" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.`
251
252
  )
252
253
  );
@@ -299,6 +300,9 @@ const skipErrorProperties = /* @__PURE__ */ new Set([
299
300
  "actual",
300
301
  "expected",
301
302
  "diffOptions",
303
+ "sourceURL",
304
+ "column",
305
+ "line",
302
306
  "VITEST_TEST_NAME",
303
307
  "VITEST_TEST_PATH",
304
308
  "VITEST_AFTER_ENV_TEARDOWN",
@@ -2005,6 +2009,7 @@ class JUnitReporter {
2005
2009
  mode: "run",
2006
2010
  result: file.result,
2007
2011
  meta: {},
2012
+ timeout: 0,
2008
2013
  // NOTE: not used in JUnitReporter
2009
2014
  context: null,
2010
2015
  suite: null,
@@ -1,6 +1,6 @@
1
- import { c as createExpect, a as globalExpect, i as inject, v as vi, b as vitest } from './vi.DT3m61kS.js';
1
+ import { c as createExpect, a as globalExpect, i as inject, v as vi, b as vitest } from './vi.nSCvwQ7l.js';
2
2
  import { i as isFirstRun, a as runOnce } from './run-once.2ogXb3JV.js';
3
- import { b as bench } from './benchmark.Cdu9hjj4.js';
3
+ import { b as bench } from './benchmark.DL72EVN-.js';
4
4
  import { expectTypeOf } from 'expect-type';
5
5
  import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
6
6
  import * as chai from 'chai';
@@ -1,9 +1,8 @@
1
1
  import * as chai from 'chai';
2
2
  import { resolve } from 'node:path';
3
- import { t as takeCoverageInsideWorker } from './coverage.DnNIv-kJ.js';
3
+ import { l as loadDiffConfig, b as loadSnapshotSerializers, t as takeCoverageInsideWorker } from './setup-common.CPvtqi8q.js';
4
4
  import { distDir } from '../path.js';
5
5
  import { r as rpc } from './rpc.TVf73xOu.js';
6
- import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.wObu9a36.js';
7
6
  import { g as getWorkerState } from './utils.C8RiOc4B.js';
8
7
 
9
8
  function setupChaiConfig(config) {
@@ -4,14 +4,14 @@ type Promisable<T> = T | Promise<T>;
4
4
  type MockFactoryWithHelper<M = unknown> = (importOriginal: <T extends M = M>() => Promise<T>) => Promisable<Partial<M>>;
5
5
  type MockFactory = () => any;
6
6
  interface MockOptions {
7
- spy?: boolean;
7
+ spy?: boolean;
8
8
  }
9
9
  interface PendingSuiteMock {
10
- id: string;
11
- importer: string;
12
- action: 'mock' | 'unmock';
13
- type?: MockedModuleType;
14
- factory?: MockFactory;
10
+ id: string;
11
+ importer: string;
12
+ action: "mock" | "unmock";
13
+ type?: MockedModuleType;
14
+ factory?: MockFactory;
15
15
  }
16
16
 
17
17
  export type { MockFactoryWithHelper as M, PendingSuiteMock as P, MockOptions as a, MockFactory as b };