vitest 0.0.89 → 0.0.93

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/bin/vitest.mjs CHANGED
@@ -2,12 +2,16 @@
2
2
 
3
3
  import { fileURLToPath } from 'url'
4
4
  import { resolve } from 'path'
5
- import { checkPeerDependency } from '../dist/utils.js'
5
+ import { ensurePackageInstalled } from '../dist/utils.js'
6
6
 
7
7
  const argv = process.argv.slice(2)
8
8
 
9
+ if (!await ensurePackageInstalled('vite'))
10
+ process.exit(1)
11
+
9
12
  if (argv.includes('--coverage')) {
10
- checkPeerDependency('c8/bin/c8.js')
13
+ if (!await ensurePackageInstalled('c8'))
14
+ process.exit(1)
11
15
  const filename = fileURLToPath(import.meta.url)
12
16
  const entry = resolve(filename, '../../dist/cli.js')
13
17
  process.argv.splice(2, 0, process.argv[0], entry)
package/dist/cli.js CHANGED
@@ -1,23 +1,24 @@
1
- import readline from 'readline';
1
+ import require$$0 from 'readline';
2
2
  import { EventEmitter } from 'events';
3
- import { c } from './utils-385e2d09.js';
4
- import { c as createVitest } from './index-733e7378.js';
5
- import 'module';
3
+ import { c, e as ensurePackageInstalled } from './utils-576876dc.js';
4
+ import { c as createVitest } from './index-880654a3.js';
6
5
  import 'tty';
6
+ import 'local-pkg';
7
7
  import 'path';
8
8
  import 'vite';
9
9
  import 'process';
10
10
  import 'fs';
11
- import './constants-adef7ffb.js';
11
+ import 'fast-glob';
12
+ import 'util';
13
+ import './constants-9cfa4d7b.js';
12
14
  import 'url';
13
15
  import 'perf_hooks';
14
- import './error-309196c9.js';
16
+ import './error-bf2213e4.js';
15
17
  import 'source-map';
18
+ import './index-5cc247ff.js';
16
19
  import 'assert';
17
20
  import 'worker_threads';
18
21
  import 'piscina';
19
- import 'fast-glob';
20
- import 'micromatch';
21
22
 
22
23
  function toArr(any) {
23
24
  return any == null ? [] : Array.isArray(any) ? any : [any];
@@ -632,7 +633,7 @@ class CAC extends EventEmitter {
632
633
 
633
634
  const cac = (name = "") => new CAC(name);
634
635
 
635
- var version = "0.0.89";
636
+ var version = "0.0.93";
636
637
 
637
638
  const cli = cac("vitest");
638
639
  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("--global", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment", {
@@ -653,12 +654,18 @@ async function run(cliFilters, options) {
653
654
  process.env.NODE_ENV = "test";
654
655
  if (!options.silent) {
655
656
  console.log(c.magenta(c.bold("\nVitest is in closed beta exclusively for Sponsors")));
656
- console.log(c.yellow("Learn more at https://vitest.dev\n"));
657
+ console.log(c.yellow("Learn more at https://vitest.dev"));
657
658
  }
658
659
  const ctx = await createVitest(options);
659
- process.__vitest__ = ctx;
660
660
  process.chdir(ctx.config.root);
661
661
  registerConsoleShortcuts(ctx);
662
+ if (ctx.config.environment && ctx.config.environment !== "node") {
663
+ if (!await ensurePackageInstalled(ctx.config.environment))
664
+ process.exit(1);
665
+ }
666
+ ctx.onServerRestarted(() => {
667
+ ctx.start(cliFilters);
668
+ });
662
669
  try {
663
670
  await ctx.start(cliFilters);
664
671
  } catch (e) {
@@ -671,7 +678,7 @@ async function run(cliFilters, options) {
671
678
  }
672
679
  function registerConsoleShortcuts(ctx) {
673
680
  if (process.stdin.isTTY) {
674
- readline.emitKeypressEvents(process.stdin);
681
+ require$$0.emitKeypressEvents(process.stdin);
675
682
  process.stdin.setRawMode(true);
676
683
  process.stdin.on("keypress", (str) => {
677
684
  if (str === "" || str === "")
@@ -22,9 +22,8 @@ const globalApis = [
22
22
  "chai",
23
23
  "expect",
24
24
  "assert",
25
- "spy",
26
- "spyOn",
27
25
  "vitest",
26
+ "vi",
28
27
  "beforeAll",
29
28
  "afterAll",
30
29
  "beforeEach",