vitest 0.0.87 → 0.0.91

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,10 +2,12 @@
2
2
 
3
3
  import { fileURLToPath } from 'url'
4
4
  import { resolve } from 'path'
5
+ import { checkPeerDependency } from '../dist/utils.js'
5
6
 
6
7
  const argv = process.argv.slice(2)
7
8
 
8
9
  if (argv.includes('--coverage')) {
10
+ checkPeerDependency('c8/bin/c8.js')
9
11
  const filename = fileURLToPath(import.meta.url)
10
12
  const entry = resolve(filename, '../../dist/cli.js')
11
13
  process.argv.splice(2, 0, process.argv[0], entry)
package/dist/cli.js CHANGED
@@ -1,22 +1,23 @@
1
+ import readline from 'readline';
1
2
  import { EventEmitter } from 'events';
2
- import { c } from './error-c5d734a1.js';
3
- import { c as createVitest } from './index-af5d5277.js';
4
- import 'fs';
5
- import 'path';
3
+ import { c } from './utils-5d0cec8a.js';
4
+ import { c as createVitest } from './index-25bef3dd.js';
5
+ import 'module';
6
6
  import 'tty';
7
- import 'source-map';
8
- import './utils-9dcc4050.js';
7
+ import 'path';
9
8
  import 'vite';
10
9
  import 'process';
11
- import './constants-adef7ffb.js';
10
+ import 'fs';
11
+ import './constants-9cfa4d7b.js';
12
12
  import 'url';
13
13
  import 'perf_hooks';
14
+ import './error-abd1f726.js';
15
+ import 'source-map';
14
16
  import 'assert';
15
17
  import 'worker_threads';
16
18
  import 'piscina';
17
19
  import 'fast-glob';
18
20
  import 'micromatch';
19
- import 'readline';
20
21
 
21
22
  function toArr(any) {
22
23
  return any == null ? [] : Array.isArray(any) ? any : [any];
@@ -631,7 +632,7 @@ class CAC extends EventEmitter {
631
632
 
632
633
  const cac = (name = "") => new CAC(name);
633
634
 
634
- var version = "0.0.87";
635
+ var version = "0.0.91";
635
636
 
636
637
  const cli = cac("vitest");
637
638
  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", {
@@ -657,8 +658,9 @@ async function run(cliFilters, options) {
657
658
  const ctx = await createVitest(options);
658
659
  process.__vitest__ = ctx;
659
660
  process.chdir(ctx.config.root);
661
+ registerConsoleShortcuts(ctx);
660
662
  try {
661
- await ctx.run(cliFilters);
663
+ await ctx.start(cliFilters);
662
664
  } catch (e) {
663
665
  process.exitCode = 1;
664
666
  throw e;
@@ -667,3 +669,17 @@ async function run(cliFilters, options) {
667
669
  await ctx.close();
668
670
  }
669
671
  }
672
+ function registerConsoleShortcuts(ctx) {
673
+ if (process.stdin.isTTY) {
674
+ readline.emitKeypressEvents(process.stdin);
675
+ process.stdin.setRawMode(true);
676
+ process.stdin.on("keypress", (str) => {
677
+ if (str === "" || str === "")
678
+ process.exit();
679
+ if (ctx.runningPromise)
680
+ return;
681
+ if (ctx.isFirstRun)
682
+ process.exit();
683
+ });
684
+ }
685
+ }
@@ -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",