vitest 0.0.100 → 0.0.101

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
@@ -1437,30 +1320,6 @@ Repository: unjs/pathe
1437
1320
 
1438
1321
  ---------------------------------------
1439
1322
 
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
1323
  ## picocolors
1465
1324
  License: ISC
1466
1325
  By: Alexey Raspopov
@@ -1920,33 +1779,6 @@ Repository: micromatch/to-regex-range
1920
1779
 
1921
1780
  ---------------------------------------
1922
1781
 
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
1782
  ## which
1951
1783
  License: ISC
1952
1784
  By: Isaac Z. Schlueter
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
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-c8e62373.js';
4
+ import { c as createVitest } from './index-37755855.js';
5
5
  import 'tty';
6
6
  import 'local-pkg';
7
7
  import 'path';
@@ -11,10 +11,10 @@ import 'fs';
11
11
  import 'os';
12
12
  import 'util';
13
13
  import 'stream';
14
- import './constants-3cbd9066.js';
14
+ import './constants-a1417084.js';
15
15
  import 'url';
16
16
  import 'perf_hooks';
17
- import './error-34c1d9e5.js';
17
+ import './error-d97062cd.js';
18
18
  import './index-825cb54c.js';
19
19
  import './_commonjsHelpers-bdec4bbd.js';
20
20
  import 'assert';
@@ -634,7 +634,7 @@ class CAC extends EventEmitter {
634
634
 
635
635
  const cac = (name = "") => new CAC(name);
636
636
 
637
- var version = "0.0.100";
637
+ var version = "0.0.101";
638
638
 
639
639
  const cli = cac("vitest");
640
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", {
@@ -1,9 +1,9 @@
1
1
  import { fileURLToPath } from 'url';
2
- import { h as resolve } from './utils-b780070b.js';
2
+ import { h as resolve } from './utils-c8e62373.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
@@ -2,12 +2,13 @@ import fs, { promises } from 'fs';
2
2
  import { Console } from 'console';
3
3
  import { Writable } from 'stream';
4
4
  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';
5
+ import chai$1, { expect, util } from 'chai';
6
6
  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';
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-c8e62373.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-d97062cd.js';
10
10
  import { performance } from 'perf_hooks';
11
+ import { b as setHooks, c as createSuiteHooks, e as clearContext, f as defaultSuite, h as context, j as getHooks, k as getFn } from './suite-4f3fb0b5.js';
11
12
  import { n as nanoid } from './index-9e71c815.js';
12
13
  import { format as format$1 } from 'util';
13
14
  import 'tty';
@@ -3886,7 +3887,7 @@ async function setupGlobalEnv(config) {
3886
3887
  setupConsoleLogSpy();
3887
3888
  await setupChai();
3888
3889
  if (config.global)
3889
- (await import('./global-b84f9970.js')).registerApiGlobally();
3890
+ (await import('./global-5b58e48f.js')).registerApiGlobally();
3890
3891
  }
3891
3892
  function setupConsoleLogSpy() {
3892
3893
  const stdout = new Writable({
@@ -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 { k as notNullish, c, r as relative } from './utils-c8e62373.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) => {
@@ -1,13 +1,13 @@
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-a1417084.js';
2
+ import { i as index } from './index-f580d714.js';
3
3
  import 'url';
4
- import './utils-b780070b.js';
4
+ import './utils-c8e62373.js';
5
5
  import 'tty';
6
6
  import 'local-pkg';
7
7
  import 'path';
8
- import './index-0b2be7f7.js';
8
+ import './suite-4f3fb0b5.js';
9
9
  import './index-9e71c815.js';
10
- import './_commonjsHelpers-bdec4bbd.js';
10
+ import 'chai';
11
11
  import 'tinyspy';
12
12
 
13
13
  function registerApiGlobally() {
@@ -1,4 +1,4 @@
1
- import { c, g as getNames, s as slash$1, a as getTests, i as isAbsolute, r as relative, d as dirname, b as basename, f as getSuites, h as resolve, n as noop$1, t as toArray, j as hasFailed } from './utils-b780070b.js';
1
+ import { c, g as getNames, s as slash$1, a as getTests, i as isAbsolute, r as relative, d as dirname, b as basename, f as getSuites, h as resolve, n as noop$1, t as toArray, j as hasFailed } from './utils-c8e62373.js';
2
2
  import { createServer, mergeConfig } from 'vite';
3
3
  import path$a from 'path';
4
4
  import process$1 from 'process';
@@ -7,9 +7,9 @@ import require$$0 from 'os';
7
7
  import require$$0$1 from 'util';
8
8
  import require$$0$2 from 'stream';
9
9
  import require$$2 from 'events';
10
- import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-3cbd9066.js';
10
+ import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-a1417084.js';
11
11
  import { performance } from 'perf_hooks';
12
- import { s as stringWidth, a as ansiStyles, b as stripAnsi, c as sliceAnsi, F as F_POINTER, d as F_DOWN, e as F_LONG_DASH, f as F_DOWN_RIGHT, g as F_DOT, h as F_CHECK, i as F_CROSS, j as cliTruncate, k as F_RIGHT, p as printError } from './error-34c1d9e5.js';
12
+ import { s as stringWidth, a as ansiStyles, b as stripAnsi, c as sliceAnsi, F as F_POINTER, d as F_DOWN, e as F_LONG_DASH, f as F_DOWN_RIGHT, g as F_DOT, h as F_CHECK, i as F_CROSS, j as cliTruncate, k as F_RIGHT, p as printError } from './error-d97062cd.js';
13
13
  import { o as onetime, s as signalExit } from './index-825cb54c.js';
14
14
  import { MessageChannel } from 'worker_threads';
15
15
  import { pathToFileURL } from 'url';
@@ -7432,21 +7432,11 @@ class ConsoleReporter {
7432
7432
  this.end = 0;
7433
7433
  this.isFirstWatchRun = true;
7434
7434
  const mode = ctx.config.watch ? c.yellow(" DEV ") : c.cyan(" RUN ");
7435
- this.log(`
7435
+ this.ctx.log(`
7436
7436
  ${c.inverse(c.bold(mode))} ${c.gray(this.ctx.config.root)}
7437
7437
  `);
7438
7438
  this.start = performance.now();
7439
7439
  }
7440
- log(...args) {
7441
- if (this.ctx.config.silent)
7442
- return;
7443
- this.ctx.console.log(...args);
7444
- }
7445
- error(...args) {
7446
- if (this.ctx.config.silent)
7447
- return;
7448
- this.ctx.console.error(...args);
7449
- }
7450
7440
  relative(path) {
7451
7441
  return relative(this.ctx.config.root, path);
7452
7442
  }
@@ -7465,16 +7455,16 @@ ${c.inverse(c.bold(mode))} ${c.gray(this.ctx.config.root)}
7465
7455
  return;
7466
7456
  const task = this.ctx.state.idMap[pack[0]];
7467
7457
  if (task.type === "test" && ((_a = task.result) == null ? void 0 : _a.state) && ((_b = task.result) == null ? void 0 : _b.state) !== "run") {
7468
- this.log(` ${getStateSymbol(task)} ${getFullName(task)}`);
7458
+ this.ctx.log(` ${getStateSymbol(task)} ${getFullName(task)}`);
7469
7459
  if (task.result.state === "fail")
7470
- this.log(c.red(` ${F_RIGHT} ${(_c = task.result.error) == null ? void 0 : _c.message}`));
7460
+ this.ctx.log(c.red(` ${F_RIGHT} ${(_c = task.result.error) == null ? void 0 : _c.message}`));
7471
7461
  }
7472
7462
  }
7473
7463
  async onFinished(files = this.ctx.state.getFiles()) {
7474
7464
  var _a, _b;
7475
7465
  this.end = performance.now();
7476
7466
  await this.stopListRender();
7477
- this.log();
7467
+ this.ctx.log();
7478
7468
  const suites = getSuites(files);
7479
7469
  const tests = getTests(files);
7480
7470
  const failedSuites = suites.filter((i) => {
@@ -7487,23 +7477,23 @@ ${c.inverse(c.bold(mode))} ${c.gray(this.ctx.config.root)}
7487
7477
  });
7488
7478
  const failedTotal = failedSuites.length + failedTests.length;
7489
7479
  let current = 1;
7490
- const errorDivider = () => this.error(`${c.red(c.dim(divider(`[${current++}/${failedTotal}]`, void 0, 1)))}
7480
+ const errorDivider = () => this.ctx.error(`${c.red(c.dim(divider(`[${current++}/${failedTotal}]`, void 0, 1)))}
7491
7481
  `);
7492
7482
  if (failedSuites.length) {
7493
- this.error(c.red(divider(c.bold(c.inverse(` Failed Suites ${failedSuites.length} `)))));
7494
- this.error();
7483
+ this.ctx.error(c.red(divider(c.bold(c.inverse(` Failed Suites ${failedSuites.length} `)))));
7484
+ this.ctx.error();
7495
7485
  for (const suite of failedSuites) {
7496
- this.error(c.red(`
7486
+ this.ctx.error(c.red(`
7497
7487
  - ${getFullName(suite)}`));
7498
7488
  await printError((_a = suite.result) == null ? void 0 : _a.error, this.ctx);
7499
7489
  errorDivider();
7500
7490
  }
7501
7491
  }
7502
7492
  if (failedTests.length) {
7503
- this.error(c.red(divider(c.bold(c.inverse(` Failed Tests ${failedTests.length} `)))));
7504
- this.error();
7493
+ this.ctx.error(c.red(divider(c.bold(c.inverse(` Failed Tests ${failedTests.length} `)))));
7494
+ this.ctx.error();
7505
7495
  for (const test of failedTests) {
7506
- this.error(`${c.red(c.bold(c.inverse(" FAIL ")))} ${getFullName(test)}`);
7496
+ this.ctx.error(`${c.red(c.bold(c.inverse(" FAIL ")))} ${getFullName(test)}`);
7507
7497
  await printError((_b = test.result) == null ? void 0 : _b.error, this.ctx);
7508
7498
  errorDivider();
7509
7499
  }
@@ -7521,17 +7511,17 @@ ${c.inverse(c.bold(mode))} ${c.gray(this.ctx.config.root)}
7521
7511
  };
7522
7512
  const snapshotOutput = renderSnapshotSummary(this.ctx.config.root, this.ctx.snapshot.summary);
7523
7513
  if (snapshotOutput.length) {
7524
- this.log(snapshotOutput.map((t, i) => i === 0 ? `${padTitle("Snapshots")} ${t}` : `${padTitle("")} ${t}`).join("\n"));
7514
+ this.ctx.log(snapshotOutput.map((t, i) => i === 0 ? `${padTitle("Snapshots")} ${t}` : `${padTitle("")} ${t}`).join("\n"));
7525
7515
  if (snapshotOutput.length > 1)
7526
- this.log();
7516
+ this.ctx.log();
7527
7517
  }
7528
- this.log(padTitle("Test Files"), getStateString(files));
7529
- this.log(padTitle("Tests"), getStateString(tests));
7518
+ this.ctx.log(padTitle("Test Files"), getStateString(files));
7519
+ this.ctx.log(padTitle("Tests"), getStateString(tests));
7530
7520
  if (this.watchFilters)
7531
- this.log(padTitle("Time"), time(threadTime));
7521
+ this.ctx.log(padTitle("Time"), time(threadTime));
7532
7522
  else
7533
- this.log(padTitle("Time"), time(executionTime) + c.gray(` (in thread ${time(threadTime)}, ${(executionTime / threadTime * 100).toFixed(2)}%)`));
7534
- this.log();
7523
+ this.ctx.log(padTitle("Time"), time(executionTime) + c.gray(` (in thread ${time(threadTime)}, ${(executionTime / threadTime * 100).toFixed(2)}%)`));
7524
+ this.ctx.log();
7535
7525
  }
7536
7526
  async onWatcherStart() {
7537
7527
  await this.stopListRender();
@@ -7540,14 +7530,14 @@ ${c.inverse(c.bold(mode))} ${c.gray(this.ctx.config.root)}
7540
7530
  return ((_a = i.result) == null ? void 0 : _a.state) === "fail";
7541
7531
  });
7542
7532
  if (failed.length)
7543
- this.log(`
7533
+ this.ctx.log(`
7544
7534
  ${c.bold(c.inverse(c.red(" FAIL ")))}${c.red(` ${failed.length} tests failed. Watching for file changes...`)}`);
7545
7535
  else
7546
- this.log(`
7536
+ this.ctx.log(`
7547
7537
  ${c.bold(c.inverse(c.green(" PASS ")))}${c.green(" Waiting for file changes...")}`);
7548
7538
  if (this.isFirstWatchRun) {
7549
7539
  this.isFirstWatchRun = false;
7550
- this.log(c.gray("press any key to exit..."));
7540
+ this.ctx.log(c.gray("press any key to exit..."));
7551
7541
  }
7552
7542
  }
7553
7543
  async onWatcherRerun(files, trigger) {
@@ -7555,7 +7545,7 @@ ${c.bold(c.inverse(c.green(" PASS ")))}${c.green(" Waiting for file changes...")
7555
7545
  this.watchFilters = files;
7556
7546
  if (!this.ctx.config.silent) {
7557
7547
  this.ctx.console.clear();
7558
- this.log(c.blue("Re-running tests...") + c.dim(` [ ${this.relative(trigger)} ]
7548
+ this.ctx.log(c.blue("Re-running tests...") + c.dim(` [ ${this.relative(trigger)} ]
7559
7549
  `));
7560
7550
  }
7561
7551
  }
@@ -7569,12 +7559,12 @@ ${c.bold(c.inverse(c.green(" PASS ")))}${c.green(" Waiting for file changes...")
7569
7559
  var _a;
7570
7560
  (_a = this.renderer) == null ? void 0 : _a.clear();
7571
7561
  const task = log.taskId ? this.ctx.state.idMap[log.taskId] : void 0;
7572
- this.log(c.gray(log.type + c.dim(` | ${task ? getFullName(task) : "unknown test"}`)));
7562
+ this.ctx.log(c.gray(log.type + c.dim(` | ${task ? getFullName(task) : "unknown test"}`)));
7573
7563
  process[log.type].write(`${log.content}
7574
7564
  `);
7575
7565
  }
7576
7566
  onServerRestart() {
7577
- this.log(c.cyan("Restarted due to config changes..."));
7567
+ this.ctx.log(c.cyan("Restarted due to config changes..."));
7578
7568
  }
7579
7569
  }
7580
7570
 
@@ -7664,7 +7654,17 @@ function resolveConfig(options, viteConfig) {
7664
7654
  return resolved;
7665
7655
  }
7666
7656
 
7657
+ const promiseMap = /* @__PURE__ */ new Map();
7667
7658
  async function transformRequest(server, id) {
7659
+ if (!promiseMap.has(id)) {
7660
+ promiseMap.set(id, _transformRequest(server, id).then((r) => {
7661
+ promiseMap.delete(id);
7662
+ return r;
7663
+ }));
7664
+ }
7665
+ return promiseMap.get(id);
7666
+ }
7667
+ async function _transformRequest(server, id) {
7668
7668
  let result = null;
7669
7669
  if (id.match(/\.(?:[cm]?[jt]sx?|json)$/)) {
7670
7670
  result = await server.transformRequest(id, { ssr: true });
@@ -7837,8 +7837,8 @@ class Vitest {
7837
7837
  async start(filters) {
7838
7838
  const files = await this.globTestFiles(filters);
7839
7839
  if (!files.length) {
7840
- console.error("No test files found");
7841
- process.exitCode = 1;
7840
+ this.error(c.red("No test files found\n"));
7841
+ process.exit(1);
7842
7842
  }
7843
7843
  await this.runFiles(files);
7844
7844
  if (this.config.watch)
@@ -7860,6 +7860,16 @@ class Vitest {
7860
7860
  });
7861
7861
  return await this.runningPromise;
7862
7862
  }
7863
+ log(...args) {
7864
+ if (this.config.silent)
7865
+ return;
7866
+ this.console.log(...args);
7867
+ }
7868
+ error(...args) {
7869
+ if (this.config.silent)
7870
+ return;
7871
+ this.console.error(...args);
7872
+ }
7863
7873
  async scheduleRerun(triggerId) {
7864
7874
  const currentCount = this.restartsCount;
7865
7875
  clearTimeout(this._rerunTimer);
@@ -7981,7 +7991,7 @@ async function createVitest(options, viteOverrides = {}) {
7981
7991
  ctx.setServer(options, server2);
7982
7992
  haveStarted = true;
7983
7993
  if (options.api)
7984
- server2.middlewares.use((await import('./middleware-991dfa87.js')).default(ctx));
7994
+ server2.middlewares.use((await import('./middleware-05e03d95.js')).default(ctx));
7985
7995
  }
7986
7996
  }
7987
7997
  ],
@@ -1,4 +1,5 @@
1
- import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, u as util, s as suite, t as test, d as describe, i as it, b as assert, c as should, e as expect, f as chai } from './index-0b2be7f7.js';
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-4f3fb0b5.js';
2
+ import chai, { util, assert, should, expect } from 'chai';
2
3
  import * as tinyspy from 'tinyspy';
3
4
  import { spies } from 'tinyspy';
4
5
 
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- export { b as assert, f as chai, d as describe, e as expect, i as it, c as should, s as suite, t as test } from './index-0b2be7f7.js';
2
- export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, f as fn, s as spyOn, e as vi, v as vitest } from './index-d57cd3f0.js';
1
+ export { d as describe, i as it, s as suite, t as test } from './suite-4f3fb0b5.js';
2
+ export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, f as fn, s as spyOn, e as vi, v as vitest } from './index-f580d714.js';
3
+ export { assert, default as chai, expect, should } from 'chai';
3
4
  import './index-9e71c815.js';
4
- import './utils-b780070b.js';
5
+ import './utils-c8e62373.js';
5
6
  import 'tty';
6
7
  import 'local-pkg';
7
8
  import 'path';
8
- import './_commonjsHelpers-bdec4bbd.js';
9
9
  import 'tinyspy';
@@ -1,6 +1,6 @@
1
- import { A as API_PATH } from './constants-3cbd9066.js';
1
+ import { A as API_PATH } from './constants-a1417084.js';
2
2
  import 'url';
3
- import './utils-b780070b.js';
3
+ import './utils-c8e62373.js';
4
4
  import 'tty';
5
5
  import 'local-pkg';
6
6
  import 'path';
package/dist/node.js CHANGED
@@ -1,5 +1,5 @@
1
- export { c as createVitest } from './index-113b8b23.js';
2
- import './utils-b780070b.js';
1
+ export { c as createVitest } from './index-37755855.js';
2
+ import './utils-c8e62373.js';
3
3
  import 'tty';
4
4
  import 'local-pkg';
5
5
  import 'path';
@@ -10,10 +10,10 @@ import 'os';
10
10
  import 'util';
11
11
  import 'stream';
12
12
  import 'events';
13
- import './constants-3cbd9066.js';
13
+ import './constants-a1417084.js';
14
14
  import 'url';
15
15
  import 'perf_hooks';
16
- import './error-34c1d9e5.js';
16
+ import './error-d97062cd.js';
17
17
  import './index-825cb54c.js';
18
18
  import './_commonjsHelpers-bdec4bbd.js';
19
19
  import 'assert';