vitest 0.0.118 → 0.0.122

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
@@ -166,7 +166,7 @@ Repository: chalk/ansi-regex
166
166
 
167
167
  > MIT License
168
168
  >
169
- > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
169
+ > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
170
170
  >
171
171
  > 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:
172
172
  >
@@ -183,7 +183,7 @@ Repository: chalk/ansi-styles
183
183
 
184
184
  > MIT License
185
185
  >
186
- > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
186
+ > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
187
187
  >
188
188
  > 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:
189
189
  >
package/dist/cli.js CHANGED
@@ -7,8 +7,8 @@ import process$1 from 'process';
7
7
  import { m as mergeStream, g as getStream, c as crossSpawn } from './index-6e709f57.js';
8
8
  import require$$0, { constants } from 'os';
9
9
  import { s as signalExit } from './index-648e7ab2.js';
10
- import { e as ensurePackageInstalled } from './index-80671389.js';
11
- import { c as createVitest } from './index-62869b66.js';
10
+ import { e as ensurePackageInstalled } from './index-090545ef.js';
11
+ import { c as createVitest } from './index-123a18df.js';
12
12
  import './_commonjsHelpers-c9e3b764.js';
13
13
  import 'fs';
14
14
  import 'stream';
@@ -18,10 +18,10 @@ import 'url';
18
18
  import 'tty';
19
19
  import 'local-pkg';
20
20
  import 'vite';
21
- import './constants-56bfb5ab.js';
21
+ import './constants-22bbd600.js';
22
22
  import './magic-string.es-94000aea.js';
23
23
  import 'perf_hooks';
24
- import './diff-d87307c6.js';
24
+ import './diff-a295cb37.js';
25
25
  import 'module';
26
26
  import 'worker_threads';
27
27
  import 'tinypool';
@@ -1700,10 +1700,11 @@ function execa(file, args, options) {
1700
1700
  return mergePromise(spawned, handlePromiseOnce);
1701
1701
  }
1702
1702
 
1703
- var version = "0.0.118";
1703
+ var version = "0.0.122";
1704
1704
 
1705
+ const CLOSE_TIMEOUT = 1e3;
1705
1706
  const cli = cac("vitest");
1706
- 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 UI", { default: false }).option("-t, --testNamePattern <pattern>", "run test names with the specified pattern").option("--api", "listen to port and serve API").option("--threads", "enabled threads", { default: true }).option("--silent", "silent console output from tests").option("--reporter <name>", "reporter").option("--coverage", "use c8 for coverage").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();
1707
+ 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 UI", { default: false }).option("-t, --testNamePattern <pattern>", "run test names with the specified pattern").option("--api", "listen to port and serve API").option("--threads", "enabled threads", { default: true }).option("--silent", "silent console output from tests").option("--reporter <name>", "reporter").option("--coverage", "use c8 for coverage").option("--run", "do not watch").option("--global", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--findRelatedTests <filepath>", "run only tests that import specified file").option("--environment <env>", "runner environment", { default: "node" }).option("--passWithNoTests", "pass when no tests found").help();
1707
1708
  cli.command("run [...filters]").action(run);
1708
1709
  cli.command("watch [...filters]").action(dev);
1709
1710
  cli.command("dev [...filters]").action(dev);
@@ -1751,18 +1752,35 @@ async function run(cliFilters, options) {
1751
1752
  await ctx.close();
1752
1753
  }
1753
1754
  if (!ctx.config.watch) {
1754
- setTimeout(() => process.exit(), 1e3).unref();
1755
+ setTimeout(() => process.exit(), CLOSE_TIMEOUT).unref();
1755
1756
  }
1756
1757
  }
1758
+ function closeServerAndExitProcess(ctx) {
1759
+ const closePromise = ctx.close();
1760
+ let timeout;
1761
+ const timeoutPromise = new Promise((resolve, reject) => {
1762
+ timeout = setTimeout(() => reject(new Error(`close timed out after ${CLOSE_TIMEOUT}ms`)), CLOSE_TIMEOUT);
1763
+ });
1764
+ Promise.race([closePromise, timeoutPromise]).then(() => {
1765
+ clearTimeout(timeout);
1766
+ process.exit(0);
1767
+ }, (err) => {
1768
+ clearTimeout(timeout);
1769
+ console.error("error during close", err);
1770
+ process.exit(1);
1771
+ });
1772
+ }
1757
1773
  function registerConsoleShortcuts(ctx) {
1758
1774
  require$$0$1.emitKeypressEvents(process.stdin);
1759
1775
  process.stdin.setRawMode(true);
1760
1776
  process.stdin.on("keypress", (str, key) => {
1761
- if (str === "" || str === "" || key && key.ctrl && key.name === "c")
1762
- process.exit();
1777
+ if (str === "" || str === "" || key && key.ctrl && key.name === "c") {
1778
+ closeServerAndExitProcess(ctx);
1779
+ return;
1780
+ }
1763
1781
  if (ctx.runningPromise)
1764
1782
  return;
1765
1783
  if (ctx.isFirstRun)
1766
- process.exit();
1784
+ closeServerAndExitProcess(ctx);
1767
1785
  });
1768
1786
  }
@@ -1,5 +1,5 @@
1
1
  import { fileURLToPath } from 'url';
2
- import { k as resolve } from './index-80671389.js';
2
+ import { k as resolve } from './index-090545ef.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}"];
@@ -1,5 +1,5 @@
1
1
  import { existsSync, promises } from 'fs';
2
- import { o as notNullish, c, r as relative } from './index-80671389.js';
2
+ import { o as notNullish, c, r as relative } from './index-090545ef.js';
3
3
 
4
4
  function Diff() {}
5
5
  Diff.prototype = {