vitest 0.0.100 → 0.0.104

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/LICENSE.md CHANGED
@@ -193,13 +193,6 @@ Repository: chalk/ansi-styles
193
193
 
194
194
  ---------------------------------------
195
195
 
196
- ## assertion-error
197
- License: MIT
198
- By: Jake Luer
199
- Repository: git@github.com:chaijs/assertion-error.git
200
-
201
- ---------------------------------------
202
-
203
196
  ## braces
204
197
  License: MIT
205
198
  By: Jon Schlinkert, Brian Woodward, Elan Shanker, Eugene Sharygin, hemanth.hm
@@ -258,35 +251,6 @@ Repository: egoist/cac
258
251
 
259
252
  ---------------------------------------
260
253
 
261
- ## chai
262
- License: MIT
263
- By: Jake Luer, Domenic Denicola, Veselin Todorov, John Firebaugh
264
- Repository: https://github.com/chaijs/chai
265
-
266
- > MIT License
267
- >
268
- > Copyright (c) 2017 Chai.js Assertion Library
269
- >
270
- > Permission is hereby granted, free of charge, to any person obtaining a copy
271
- > of this software and associated documentation files (the "Software"), to deal
272
- > in the Software without restriction, including without limitation the rights
273
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
274
- > copies of the Software, and to permit persons to whom the Software is
275
- > furnished to do so, subject to the following conditions:
276
- >
277
- > The above copyright notice and this permission notice shall be included in all
278
- > copies or substantial portions of the Software.
279
- >
280
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
281
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
282
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
283
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
284
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
285
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
286
- > SOFTWARE.
287
-
288
- ---------------------------------------
289
-
290
254
  ## chai-subset
291
255
  License: MIT
292
256
  By: Andrii Shumada, Robert Herhold
@@ -316,33 +280,6 @@ Repository: https://github.com/debitoor/chai-subset.git
316
280
 
317
281
  ---------------------------------------
318
282
 
319
- ## check-error
320
- License: MIT
321
- By: Jake Luer, David Losert, Keith Cirkel, Miroslav Bajtoš, Lucas Fernandes da Costa
322
- Repository: git+ssh://git@github.com/chaijs/check-error.git
323
-
324
- > Copyright (c) 2013 Jake Luer <jake@alogicalparadox.com> (http://alogicalparadox.com)
325
- >
326
- > Permission is hereby granted, free of charge, to any person obtaining a copy
327
- > of this software and associated documentation files (the "Software"), to deal
328
- > in the Software without restriction, including without limitation the rights
329
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
330
- > copies of the Software, and to permit persons to whom the Software is
331
- > furnished to do so, subject to the following conditions:
332
- >
333
- > The above copyright notice and this permission notice shall be included in
334
- > all copies or substantial portions of the Software.
335
- >
336
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
337
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
338
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
339
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
340
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
341
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
342
- > THE SOFTWARE.
343
-
344
- ---------------------------------------
345
-
346
283
  ## cli-cursor
347
284
  License: MIT
348
285
  By: Sindre Sorhus
@@ -406,33 +343,6 @@ Repository: git@github.com:moxystudio/node-cross-spawn.git
406
343
 
407
344
  ---------------------------------------
408
345
 
409
- ## deep-eql
410
- License: MIT
411
- By: Jake Luer, Keith Cirkel, dougluce, Lorenz Leutgeb
412
- Repository: git@github.com:chaijs/deep-eql.git
413
-
414
- > Copyright (c) 2013 Jake Luer <jake@alogicalparadox.com> (http://alogicalparadox.com)
415
- >
416
- > Permission is hereby granted, free of charge, to any person obtaining a copy
417
- > of this software and associated documentation files (the "Software"), to deal
418
- > in the Software without restriction, including without limitation the rights
419
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
420
- > copies of the Software, and to permit persons to whom the Software is
421
- > furnished to do so, subject to the following conditions:
422
- >
423
- > The above copyright notice and this permission notice shall be included in
424
- > all copies or substantial portions of the Software.
425
- >
426
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
427
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
428
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
429
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
430
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
431
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
432
- > THE SOFTWARE.
433
-
434
- ---------------------------------------
435
-
436
346
  ## diff
437
347
  License: BSD-3-Clause
438
348
  Repository: git://github.com/kpdecker/jsdiff.git
@@ -635,33 +545,6 @@ Repository: git+https://github.com/WebReflection/flatted.git
635
545
 
636
546
  ---------------------------------------
637
547
 
638
- ## get-func-name
639
- License: MIT
640
- By: Jake Luer, Keith Cirkel, Lucas Fernandes da Costa, Grant Snodgrass, Lucas Vieira, Aleksey Shvayka
641
- Repository: git+ssh://git@github.com/chaijs/get-func-name.git
642
-
643
- > Copyright (c) 2013 Jake Luer <jake@alogicalparadox.com> (http://alogicalparadox.com)
644
- >
645
- > Permission is hereby granted, free of charge, to any person obtaining a copy
646
- > of this software and associated documentation files (the "Software"), to deal
647
- > in the Software without restriction, including without limitation the rights
648
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
649
- > copies of the Software, and to permit persons to whom the Software is
650
- > furnished to do so, subject to the following conditions:
651
- >
652
- > The above copyright notice and this permission notice shall be included in
653
- > all copies or substantial portions of the Software.
654
- >
655
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
656
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
657
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
658
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
659
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
660
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
661
- > THE SOFTWARE.
662
-
663
- ---------------------------------------
664
-
665
548
  ## get-stream
666
549
  License: MIT
667
550
  By: Sindre Sorhus
@@ -1118,6 +1001,21 @@ Repository: sindresorhus/log-update
1118
1001
 
1119
1002
  ---------------------------------------
1120
1003
 
1004
+ ## magic-string
1005
+ License: MIT
1006
+ By: Rich Harris
1007
+ Repository: https://github.com/rich-harris/magic-string
1008
+
1009
+ > Copyright 2018 Rich Harris
1010
+ >
1011
+ > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1012
+ >
1013
+ > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1014
+ >
1015
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1016
+
1017
+ ---------------------------------------
1018
+
1121
1019
  ## merge-stream
1122
1020
  License: MIT
1123
1021
  By: Stephen Sugden
@@ -1437,30 +1335,6 @@ Repository: unjs/pathe
1437
1335
 
1438
1336
  ---------------------------------------
1439
1337
 
1440
- ## pathval
1441
- License: MIT
1442
- By: Veselin Todorov
1443
- Repository: git+ssh://git@github.com/chaijs/pathval.git
1444
-
1445
- > MIT License
1446
- >
1447
- > Copyright (c) 2011-2013 Jake Luer jake@alogicalparadox.com
1448
- >
1449
- > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1450
- > documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights
1451
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
1452
- > persons to whom the Software is furnished to do so, subject to the following conditions:
1453
- >
1454
- > The above copyright notice and this permission notice shall be included in all copies or substantial
1455
- > portions of the Software.
1456
- >
1457
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1458
- > THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1459
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
1460
- > TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1461
-
1462
- ---------------------------------------
1463
-
1464
1338
  ## picocolors
1465
1339
  License: ISC
1466
1340
  By: Alexey Raspopov
@@ -1840,6 +1714,35 @@ Repository: 7rulnik/source-map
1840
1714
 
1841
1715
  ---------------------------------------
1842
1716
 
1717
+ ## sourcemap-codec
1718
+ License: MIT
1719
+ By: Rich Harris
1720
+ Repository: https://github.com/Rich-Harris/sourcemap-codec
1721
+
1722
+ > The MIT License
1723
+ >
1724
+ > Copyright (c) 2015 Rich Harris
1725
+ >
1726
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
1727
+ > of this software and associated documentation files (the "Software"), to deal
1728
+ > in the Software without restriction, including without limitation the rights
1729
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1730
+ > copies of the Software, and to permit persons to whom the Software is
1731
+ > furnished to do so, subject to the following conditions:
1732
+ >
1733
+ > The above copyright notice and this permission notice shall be included in
1734
+ > all copies or substantial portions of the Software.
1735
+ >
1736
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1737
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1738
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1739
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1740
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1741
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1742
+ > THE SOFTWARE.
1743
+
1744
+ ---------------------------------------
1745
+
1843
1746
  ## string-width
1844
1747
  License: MIT
1845
1748
  By: Sindre Sorhus
@@ -1920,33 +1823,6 @@ Repository: micromatch/to-regex-range
1920
1823
 
1921
1824
  ---------------------------------------
1922
1825
 
1923
- ## type-detect
1924
- License: MIT
1925
- By: Jake Luer, Keith Cirkel, David Losert, Aleksey Shvayka, Lucas Fernandes da Costa, Grant Snodgrass, Jeremy Tice, Edward Betts, dvlsg, Amila Welihinda, Jake Champion, Miroslav Bajtoš
1926
- Repository: git+ssh://git@github.com/chaijs/type-detect.git
1927
-
1928
- > Copyright (c) 2013 Jake Luer <jake@alogicalparadox.com> (http://alogicalparadox.com)
1929
- >
1930
- > Permission is hereby granted, free of charge, to any person obtaining a copy
1931
- > of this software and associated documentation files (the "Software"), to deal
1932
- > in the Software without restriction, including without limitation the rights
1933
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1934
- > copies of the Software, and to permit persons to whom the Software is
1935
- > furnished to do so, subject to the following conditions:
1936
- >
1937
- > The above copyright notice and this permission notice shall be included in
1938
- > all copies or substantial portions of the Software.
1939
- >
1940
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1941
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1942
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1943
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1944
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1945
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1946
- > THE SOFTWARE.
1947
-
1948
- ---------------------------------------
1949
-
1950
1826
  ## which
1951
1827
  License: ISC
1952
1828
  By: Isaac Z. Schlueter
package/dist/cli.js CHANGED
@@ -1,20 +1,22 @@
1
1
  import require$$0 from 'readline';
2
2
  import { EventEmitter } from 'events';
3
- import { e as ensurePackageInstalled } from './utils-b780070b.js';
4
- import { c as createVitest } from './index-113b8b23.js';
3
+ import { e as ensurePackageInstalled } from './utils-49e5008c.js';
4
+ import { c as createVitest } from './index-40564dba.js';
5
5
  import 'tty';
6
6
  import 'local-pkg';
7
7
  import 'path';
8
+ import 'chai';
9
+ import 'tinyspy';
8
10
  import 'vite';
9
11
  import 'process';
10
12
  import 'fs';
11
13
  import 'os';
12
14
  import 'util';
13
15
  import 'stream';
14
- import './constants-3cbd9066.js';
16
+ import './constants-c4dc2ff5.js';
15
17
  import 'url';
16
18
  import 'perf_hooks';
17
- import './error-34c1d9e5.js';
19
+ import './error-796962c6.js';
18
20
  import './index-825cb54c.js';
19
21
  import './_commonjsHelpers-bdec4bbd.js';
20
22
  import 'assert';
@@ -634,12 +636,10 @@ class CAC extends EventEmitter {
634
636
 
635
637
  const cac = (name = "") => new CAC(name);
636
638
 
637
- var version = "0.0.100";
639
+ var version = "0.0.104";
638
640
 
639
641
  const cli = cac("vitest");
640
- cli.version(version).option("-r, --root <path>", "root path").option("-c, --config <path>", "path to config file").option("-u, --update", "update snapshot").option("-w, --watch", "watch mode").option("-o, --open", "open Vitest UI").option("--api", "listen to port and serve API").option("--threads", "enabled threads", { default: true }).option("--silent", "silent").option("--run", "do not watch").option("--global", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment", {
641
- default: "node"
642
- }).help();
642
+ cli.version(version).option("-r, --root <path>", "root path").option("-c, --config <path>", "path to config file").option("-u, --update", "update snapshot").option("-w, --watch", "watch mode").option("-o, --open", "open Vitest UI").option("--api", "listen to port and serve API").option("--threads", "enabled threads", { default: true }).option("--silent", "silent").option("--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();
643
643
  cli.command("run [...filters]").action(run);
644
644
  cli.command("watch [...filters]").action(dev);
645
645
  cli.command("dev [...filters]").action(dev);
@@ -679,8 +679,8 @@ function registerConsoleShortcuts(ctx) {
679
679
  if (process.stdin.isTTY) {
680
680
  require$$0.emitKeypressEvents(process.stdin);
681
681
  process.stdin.setRawMode(true);
682
- process.stdin.on("keypress", (str) => {
683
- if (str === "" || str === "")
682
+ process.stdin.on("keypress", (str, key) => {
683
+ if (str === "" || str === "" || key && key.ctrl && key.name === "c")
684
684
  process.exit();
685
685
  if (ctx.runningPromise)
686
686
  return;
@@ -1,9 +1,9 @@
1
1
  import { fileURLToPath } from 'url';
2
- import { h as resolve } from './utils-b780070b.js';
2
+ import { m as resolve } from './utils-49e5008c.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}"];
6
- const defaultExclude = ["**/node_modules/**", "**/dist/**"];
6
+ const defaultExclude = ["node_modules", "dist", ".idea", ".git", ".cache"];
7
7
  const defaultPort = 51204;
8
8
  const API_PATH = "/__vitest_api__";
9
9
  const configFiles = [
package/dist/entry.js CHANGED
@@ -1,17 +1,19 @@
1
1
  import fs, { promises } from 'fs';
2
+ import { u as index, g as getNames, c as c$1, t as toArray, k as basename, w as interpretOnlyMode, x as partitionSuiteChildren, y as hasTests, o as hasFailed, z as clearModuleMocks, b as vi } from './utils-49e5008c.js';
2
3
  import { Console } from 'console';
3
4
  import { Writable } from 'stream';
4
5
  import { importModule } from 'local-pkg';
5
- import { e as expect, f as chai$1, u as util, h as setHooks, j as createSuiteHooks, k as clearContext, l as defaultSuite, m as context, n as getHooks, o as getFn } from './index-0b2be7f7.js';
6
+ import chai$1, { expect, util } from 'chai';
6
7
  import { a as commonjsRequire, c as commonjsGlobal } from './_commonjsHelpers-bdec4bbd.js';
7
- import { l as index, g as getNames, c as c$1, t as toArray, b as basename, m as interpretOnlyMode, p as partitionSuiteChildren, o as hasTests, j as hasFailed } from './utils-b780070b.js';
8
8
  import { r as rpc, s as send } from './rpc-7de86f29.js';
9
- import { u as unifiedDiff } from './error-34c1d9e5.js';
9
+ import { u as unifiedDiff } from './error-796962c6.js';
10
10
  import { performance } from 'perf_hooks';
11
+ import { c as clearContext, b as defaultSuite, e as setHooks, f as getHooks, h as context, j as getFn } from './suite-8d666d5a.js';
11
12
  import { n as nanoid } from './index-9e71c815.js';
12
13
  import { format as format$1 } from 'util';
13
14
  import 'tty';
14
15
  import 'path';
16
+ import 'tinyspy';
15
17
 
16
18
  var node = {
17
19
  name: "node",
@@ -3850,6 +3852,23 @@ class Any extends AsymmetricMatcher {
3850
3852
  return `Any<${this.fnNameFor(this.sample)}>`;
3851
3853
  }
3852
3854
  }
3855
+ class StringMatching extends AsymmetricMatcher {
3856
+ constructor(sample, inverse = false) {
3857
+ if (!isA("String", sample) && !isA("RegExp", sample))
3858
+ throw new Error("Expected is not a String or a RegExp");
3859
+ super(new RegExp(sample), inverse);
3860
+ }
3861
+ asymmetricMatch(other) {
3862
+ const result = isA("String", other) && this.sample.test(other);
3863
+ return this.inverse ? !result : result;
3864
+ }
3865
+ toString() {
3866
+ return `String${this.inverse ? "Not" : ""}Matching`;
3867
+ }
3868
+ getExpectedType() {
3869
+ return "string";
3870
+ }
3871
+ }
3853
3872
  const JestAsymmetricMatchers = (chai, utils) => {
3854
3873
  utils.addMethod(chai.expect, "stringContaining", (expected) => new StringContaining(expected));
3855
3874
  utils.addMethod(chai.expect, "anything", () => {
@@ -3864,6 +3883,9 @@ const JestAsymmetricMatchers = (chai, utils) => {
3864
3883
  utils.addMethod(chai.expect, "arrayContaining", (expected) => {
3865
3884
  return new ArrayContaining(expected);
3866
3885
  });
3886
+ utils.addMethod(chai.expect, "stringMatching", (expected) => {
3887
+ return new StringMatching(expected);
3888
+ });
3867
3889
  };
3868
3890
 
3869
3891
  let installed = false;
@@ -3886,7 +3908,7 @@ async function setupGlobalEnv(config) {
3886
3908
  setupConsoleLogSpy();
3887
3909
  await setupChai();
3888
3910
  if (config.global)
3889
- (await import('./global-b84f9970.js')).registerApiGlobally();
3911
+ (await import('./global-166f6789.js')).registerApiGlobally();
3890
3912
  }
3891
3913
  function setupConsoleLogSpy() {
3892
3914
  const stdout = new Writable({
@@ -3975,12 +3997,12 @@ async function collectTests(paths, config) {
3975
3997
  filepath,
3976
3998
  tasks: []
3977
3999
  };
3978
- setHooks(file, createSuiteHooks());
3979
4000
  clearContext();
3980
4001
  try {
3981
4002
  await runSetupFiles(config);
3982
4003
  await import(filepath);
3983
4004
  const defaultTasks = await defaultSuite.collect(file);
4005
+ setHooks(file, getHooks(defaultTasks));
3984
4006
  for (const c of [...defaultTasks.tasks, ...context.tasks]) {
3985
4007
  if (c.type === "test") {
3986
4008
  file.tasks.push(c);
@@ -4025,6 +4047,7 @@ async function runTest(test) {
4025
4047
  state: "run"
4026
4048
  };
4027
4049
  updateTask(test);
4050
+ clearModuleMocks();
4028
4051
  getSnapshotClient().setTest(test);
4029
4052
  process.__vitest_worker__.current = test;
4030
4053
  try {
@@ -4122,9 +4145,12 @@ async function run(files, config) {
4122
4145
  const env = ((_a = code.match(/@(?:vitest|jest)-environment\s+?([\w-]+)\b/)) == null ? void 0 : _a[1]) || config.environment || "node";
4123
4146
  if (!["node", "jsdom", "happy-dom"].includes(env))
4124
4147
  throw new Error(`Unsupported environment: ${env}`);
4148
+ process.__vitest_worker__.filepath = file;
4149
+ vi.restoreAllMocks();
4125
4150
  await withEnv(env, async () => {
4126
4151
  await startTests([file], config);
4127
4152
  });
4153
+ process.__vitest_worker__.filepath = void 0;
4128
4154
  }
4129
4155
  }
4130
4156
 
@@ -1,6 +1,6 @@
1
1
  import { existsSync, promises } from 'fs';
2
2
  import { format } from 'util';
3
- import { k as notNullish, c, r as relative } from './utils-b780070b.js';
3
+ import { p as notNullish, c, r as relative } from './utils-49e5008c.js';
4
4
 
5
5
  function Diff() {}
6
6
  Diff.prototype = {
@@ -4521,7 +4521,7 @@ async function printError(error, ctx) {
4521
4521
  await printStack(ctx, stacks, nearest, async (s, pos) => {
4522
4522
  if (s === nearest) {
4523
4523
  const sourceCode = await promises.readFile(nearest.file, "utf-8");
4524
- ctx.console.log(c.yellow(generateCodeFrame(sourceCode, 4, pos)));
4524
+ ctx.log(c.yellow(generateCodeFrame(sourceCode, 4, pos)));
4525
4525
  }
4526
4526
  });
4527
4527
  }
@@ -4577,14 +4577,12 @@ async function printStack(ctx, stack, highlight, onStack) {
4577
4577
  const pos = await getSourcePos(ctx, frame) || frame;
4578
4578
  const color = frame === highlight ? c.yellow : c.gray;
4579
4579
  const path = relative(ctx.config.root, frame.file);
4580
- if (!ctx.config.silent)
4581
- ctx.console.log(color(` ${c.dim(F_POINTER)} ${[frame.method, c.dim(`${path}:${pos.line}:${pos.column}`)].filter(Boolean).join(" ")}`));
4580
+ ctx.log(color(` ${c.dim(F_POINTER)} ${[frame.method, c.dim(`${path}:${pos.line}:${pos.column}`)].filter(Boolean).join(" ")}`));
4582
4581
  await (onStack == null ? void 0 : onStack(frame, pos));
4583
4582
  if (frame.file in ctx.state.filesMap)
4584
4583
  break;
4585
4584
  }
4586
- if (!ctx.config.silent)
4587
- ctx.console.log();
4585
+ ctx.log();
4588
4586
  }
4589
4587
  function getOriginalPos(map, { line, column }) {
4590
4588
  return new Promise((resolve) => {
@@ -4617,6 +4615,7 @@ function generateCodeFrame(source, indent = 0, start = 0, end, range = 2) {
4617
4615
  const lines = source.split(splitRE);
4618
4616
  let count = 0;
4619
4617
  let res = [];
4618
+ const columns = process.stdout.columns || 80;
4620
4619
  function lineNo(no = "") {
4621
4620
  return c.gray(`${String(no).padStart(3, " ")}| `);
4622
4621
  }
@@ -4629,7 +4628,7 @@ function generateCodeFrame(source, indent = 0, start = 0, end, range = 2) {
4629
4628
  const lineLength = lines[j].length;
4630
4629
  if (lineLength > 200)
4631
4630
  return "";
4632
- res.push(lineNo(j + 1) + cliTruncate(lines[j], process.stdout.columns - 5 - indent));
4631
+ res.push(lineNo(j + 1) + cliTruncate(lines[j], columns - 5 - indent));
4633
4632
  if (j === i) {
4634
4633
  const pad = start - (count - lineLength);
4635
4634
  const length = Math.max(1, end > count ? lineLength - pad : end - start);
@@ -4726,7 +4725,7 @@ ${indent}${c.red("+ actual")}
4726
4725
  ${cleanLines.map((l) => l()).join("\n")}`;
4727
4726
  }
4728
4727
  function formatLine(line) {
4729
- return cliTruncate(line, (process.stdout.columns || 40) - 1);
4728
+ return cliTruncate(line, (process.stdout.columns || 80) - 1);
4730
4729
  }
4731
4730
  function renderTruncateMessage(indent) {
4732
4731
  return `
@@ -1,14 +1,14 @@
1
- import { g as globalApis } from './constants-3cbd9066.js';
2
- import { i as index } from './index-d57cd3f0.js';
1
+ import { g as globalApis } from './constants-c4dc2ff5.js';
2
+ import { i as index } from './index-145f6f09.js';
3
3
  import 'url';
4
- import './utils-b780070b.js';
4
+ import './utils-49e5008c.js';
5
5
  import 'tty';
6
6
  import 'local-pkg';
7
7
  import 'path';
8
- import './index-0b2be7f7.js';
9
- import './index-9e71c815.js';
10
- import './_commonjsHelpers-bdec4bbd.js';
8
+ import 'chai';
11
9
  import 'tinyspy';
10
+ import './suite-8d666d5a.js';
11
+ import './index-9e71c815.js';
12
12
 
13
13
  function registerApiGlobally() {
14
14
  globalApis.forEach((api) => {
@@ -0,0 +1,31 @@
1
+ import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it } from './suite-8d666d5a.js';
2
+ import chai, { assert, should, expect } from 'chai';
3
+ import { s as spies, a as spyOn, f as fn, v as vitest, b as vi } from './utils-49e5008c.js';
4
+
5
+ const beforeAll = (fn, timeout) => getCurrentSuite().on("beforeAll", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
6
+ const afterAll = (fn, timeout) => getCurrentSuite().on("afterAll", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
7
+ const beforeEach = (fn, timeout) => getCurrentSuite().on("beforeEach", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
8
+ const afterEach = (fn, timeout) => getCurrentSuite().on("afterEach", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
9
+
10
+ var index = /*#__PURE__*/Object.freeze({
11
+ __proto__: null,
12
+ suite: suite,
13
+ test: test,
14
+ describe: describe,
15
+ it: it,
16
+ beforeAll: beforeAll,
17
+ afterAll: afterAll,
18
+ beforeEach: beforeEach,
19
+ afterEach: afterEach,
20
+ assert: assert,
21
+ should: should,
22
+ expect: expect,
23
+ chai: chai,
24
+ spies: spies,
25
+ spyOn: spyOn,
26
+ fn: fn,
27
+ vitest: vitest,
28
+ vi: vi
29
+ });
30
+
31
+ export { afterAll as a, beforeAll as b, beforeEach as c, afterEach as d, index as i };