vitest 0.9.0 → 0.9.3

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.
@@ -5,26 +5,26 @@ import process$2 from 'process';
5
5
  import { o as onExit, m as mergeStream, g as getStream, c as crossSpawn, a as onetime$1 } from './vendor-index.87b2fc14.js';
6
6
  import url, { fileURLToPath, pathToFileURL } from 'url';
7
7
  import require$$0, { constants as constants$8, hostname, cpus } from 'os';
8
- import { j as join, h as basename, k as dirname, d as c, s as slash$2, l as isAbsolute, m as relative, o as getTests, p as getFullName, q as hasFailed, u as hasFailedSnapshot, v as getSuites, w as resolve, t as toArray, n as noop$1, x as deepMerge, y as toNamespacedPath, b as getCallLastIndex, f as notNullish, z as ensurePackageInstalled } from './chunk-utils-global.35d3b35d.js';
8
+ import { j as join, h as basename, k as dirname, e as c, s as slash$2, l as isAbsolute, m as relative, o as getTests, p as getFullName, q as hasFailed, u as hasFailedSnapshot, v as getSuites, w as resolve, t as toArray, n as noop$1, x as deepMerge, y as toNamespacedPath, b as getCallLastIndex, f as notNullish, z as ensurePackageInstalled } from './chunk-utils-global.46331799.js';
9
9
  import { createServer, mergeConfig } from 'vite';
10
10
  import fs$8, { promises, existsSync } from 'fs';
11
- import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.596ee4d5.js';
11
+ import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.a6ce1057.js';
12
+ import readline from 'readline';
12
13
  import require$$0$1 from 'util';
13
14
  import require$$0$2 from 'stream';
14
15
  import require$$2 from 'events';
15
- import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.5fa30ee7.js';
16
- import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.731639a8.js';
16
+ import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.3400d522.js';
17
+ import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.aecec9d4.js';
17
18
  import { performance } from 'perf_hooks';
18
- import { b as stripAnsi, d as stringWidth, e as ansiStyles, f as sliceAnsi, h as setInterval, i as clearInterval, j as cliTruncate, s as setTimeout$1, a as parseStacktrace, k as interpretSourcePos, u as unifiedDiff, p as posToNumber, l as lineSplitRE, c as clearTimeout$1 } from './chunk-utils-timers.73950dcb.js';
19
+ import { e as stripAnsi, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as setInterval, o as clearInterval, q as cliTruncate, s as setTimeout$1, b as parseStacktrace, r as interpretSourcePos, d as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE, c as clearTimeout$1 } from './chunk-utils-timers.6cfeb494.js';
19
20
  import { a as commonjsGlobal } from './vendor-_commonjsHelpers.34b404ce.js';
20
21
  import assert$1 from 'assert';
21
22
  import { MessageChannel } from 'worker_threads';
22
23
  import { Tinypool } from 'tinypool';
23
24
  import MagicString from './chunk-magic-string.d5e0e473.js';
24
- import require$$0$3 from 'readline';
25
- import { p as prompts } from './vendor-index.ee829ed6.js';
25
+ import { p as prompts } from './vendor-index.13468339.js';
26
26
 
27
- var version = "0.9.0";
27
+ var version = "0.9.3";
28
28
 
29
29
  function stripFinalNewline(input) {
30
30
  const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
@@ -10822,9 +10822,10 @@ class BaseReporter {
10822
10822
  }
10823
10823
  async onWatcherRerun(files, trigger) {
10824
10824
  this.watchFilters = files;
10825
- this.ctx.console.clear();
10826
- this.ctx.log(c.blue("Re-running tests...") + (trigger ? c.dim(` [ ${this.relative(trigger)} ]
10827
- `) : ""));
10825
+ this.ctx.clearScreen();
10826
+ this.ctx.log(`
10827
+ ${c.inverse(c.bold(c.blue(" RERUN ")))}${trigger ? c.dim(` ${this.relative(trigger)}
10828
+ `) : ""}`);
10828
10829
  this.start = performance.now();
10829
10830
  }
10830
10831
  onUserConsoleLog(log) {
@@ -11776,7 +11777,7 @@ class DefaultReporter extends BaseReporter {
11776
11777
  }
11777
11778
  async onTestRemoved(trigger) {
11778
11779
  await this.stopListRender();
11779
- this.ctx.console.clear();
11780
+ this.ctx.clearScreen();
11780
11781
  this.ctx.log(c.yellow("Test removed...") + (trigger ? c.dim(` [ ${this.relative(trigger)} ]
11781
11782
  `) : ""));
11782
11783
  const files = this.ctx.state.getFiles(this.watchFilters);
@@ -11911,6 +11912,14 @@ class DotReporter extends BaseReporter {
11911
11912
  }
11912
11913
  }
11913
11914
 
11915
+ const getOutputFile = ({ config }, reporter) => {
11916
+ if (!config.outputFile)
11917
+ return;
11918
+ if (typeof config.outputFile === "string")
11919
+ return config.outputFile;
11920
+ return config.outputFile[reporter];
11921
+ };
11922
+
11914
11923
  const StatusMap = {
11915
11924
  fail: "failed",
11916
11925
  only: "pending",
@@ -12022,8 +12031,9 @@ class JsonReporter {
12022
12031
  await this.logTasks(files);
12023
12032
  }
12024
12033
  async writeReport(report) {
12025
- if (this.ctx.config.outputFile) {
12026
- const reportFile = resolve(this.ctx.config.root, this.ctx.config.outputFile);
12034
+ const outputFile = getOutputFile(this.ctx, "json");
12035
+ if (outputFile) {
12036
+ const reportFile = resolve(this.ctx.config.root, outputFile);
12027
12037
  const outputDirectory = dirname(reportFile);
12028
12038
  if (!existsSync(outputDirectory))
12029
12039
  await promises.mkdir(outputDirectory, { recursive: true });
@@ -12182,8 +12192,9 @@ function getDuration(task) {
12182
12192
  class JUnitReporter {
12183
12193
  async onInit(ctx) {
12184
12194
  this.ctx = ctx;
12185
- if (this.ctx.config.outputFile) {
12186
- this.reportFile = resolve(this.ctx.config.root, this.ctx.config.outputFile);
12195
+ const outputFile = getOutputFile(this.ctx, "junit");
12196
+ if (outputFile) {
12197
+ this.reportFile = resolve(this.ctx.config.root, outputFile);
12187
12198
  const outputDirectory = dirname(this.reportFile);
12188
12199
  if (!existsSync(outputDirectory))
12189
12200
  await promises.mkdir(outputDirectory, { recursive: true });
@@ -12652,7 +12663,7 @@ async function printError(error, ctx) {
12652
12663
  });
12653
12664
  handleImportOutsideModuleError(e.stack || e.stackStr || "", ctx);
12654
12665
  if (e.showDiff)
12655
- displayDiff(e.actual, e.expected, ctx.console, ctx.config.outputTruncateLength);
12666
+ displayDiff(stringify$5(e.actual), stringify$5(e.expected), ctx.console, ctx.config.outputTruncateLength);
12656
12667
  }
12657
12668
  const esmErrors = [
12658
12669
  "Cannot use import statement outside a module",
@@ -12886,21 +12897,17 @@ class Vitest {
12886
12897
  const files = await this.filterTestsBySource(await this.globTestFiles(filters));
12887
12898
  if (!files.length) {
12888
12899
  const exitCode = this.config.passWithNoTests ? 0 : 1;
12889
- if (this.config.passWithNoTests) {
12890
- this.log(`No test files found, exiting code with ${exitCode}
12891
- `);
12892
- } else {
12893
- this.error(c.red(`No test files found, exiting code with ${exitCode}
12894
- Run with \`--passWithNoTests\`to exit with code 0
12895
- `));
12896
- console.error(`In ${c.bold(this.config.root)}`);
12897
- if (filters == null ? void 0 : filters.length)
12898
- this.console.error(` filter: ${c.yellow(filters.join(", "))}`);
12899
- if (this.config.include)
12900
- this.console.error(` include: ${c.yellow(this.config.include.join(", "))}`);
12901
- if (this.config.watchIgnore)
12902
- this.console.error(` watchIgnore: ${c.yellow(this.config.watchIgnore.join(", "))}`);
12903
- }
12900
+ const comma = c.dim(", ");
12901
+ if (filters == null ? void 0 : filters.length)
12902
+ this.console.error(c.dim("filter: ") + c.yellow(filters.join(comma)));
12903
+ if (this.config.include)
12904
+ this.console.error(c.dim("include: ") + c.yellow(this.config.include.join(comma)));
12905
+ if (this.config.watchIgnore)
12906
+ this.console.error(c.dim("ignore: ") + c.yellow(this.config.watchIgnore.join(comma)));
12907
+ if (this.config.passWithNoTests)
12908
+ this.log("No test files found, exiting with code 0\n");
12909
+ else
12910
+ this.error(c.red("\nNo test files found, exiting with code 1"));
12904
12911
  process.exit(exitCode);
12905
12912
  }
12906
12913
  await this.runFiles(files);
@@ -13003,6 +13010,15 @@ Run with \`--passWithNoTests\`to exit with code 0
13003
13010
  error(...args) {
13004
13011
  this.console.error(...args);
13005
13012
  }
13013
+ clearScreen() {
13014
+ if (this.server.config.clearScreen === false)
13015
+ return;
13016
+ const repeatCount = process.stdout.rows - 2;
13017
+ const blank = repeatCount > 0 ? "\n".repeat(repeatCount) : "";
13018
+ this.console.log(blank);
13019
+ readline.cursorTo(process.stdout, 0, 0);
13020
+ readline.clearScreenDown(process.stdout);
13021
+ }
13006
13022
  async scheduleRerun(triggerId) {
13007
13023
  const currentCount = this.restartsCount;
13008
13024
  clearTimeout$1(this._rerunTimer);
@@ -13021,7 +13037,6 @@ Run with \`--passWithNoTests\`to exit with code 0
13021
13037
  this.snapshot.clear();
13022
13038
  const files = Array.from(this.changedTests);
13023
13039
  this.changedTests.clear();
13024
- this.log("return");
13025
13040
  if (this.config.coverage.enabled && this.config.coverage.cleanOnRerun)
13026
13041
  await cleanCoverage(this.config.coverage);
13027
13042
  await this.report("onWatcherRerun", files, triggerId);
@@ -13447,7 +13462,6 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
13447
13462
  }
13448
13463
  options.defines = defines;
13449
13464
  return {
13450
- clearScreen: false,
13451
13465
  resolve: {
13452
13466
  mainFields: []
13453
13467
  },
@@ -13481,7 +13495,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
13481
13495
  await ctx.setServer(options, server);
13482
13496
  haveStarted = true;
13483
13497
  if (options.api && options.watch)
13484
- (await import('./chunk-api-setup.e8071f5b.js')).setup(ctx);
13498
+ (await import('./chunk-api-setup.d764f144.js')).setup(ctx);
13485
13499
  if (!options.watch)
13486
13500
  await server.watcher.close();
13487
13501
  }
@@ -13561,8 +13575,8 @@ function registerConsoleShortcuts(ctx) {
13561
13575
  let rl;
13562
13576
  function on() {
13563
13577
  off();
13564
- rl = require$$0$3.createInterface({ input: process.stdin, escapeCodeTimeout: 50 });
13565
- require$$0$3.emitKeypressEvents(process.stdin, rl);
13578
+ rl = readline.createInterface({ input: process.stdin, escapeCodeTimeout: 50 });
13579
+ readline.emitKeypressEvents(process.stdin, rl);
13566
13580
  if (process.stdin.isTTY)
13567
13581
  process.stdin.setRawMode(true);
13568
13582
  process.stdin.on("keypress", keypressHandler);
@@ -1,7 +1,7 @@
1
1
  import { builtinModules, createRequire } from 'module';
2
2
  import { pathToFileURL, fileURLToPath as fileURLToPath$2, URL as URL$1 } from 'url';
3
3
  import vm from 'vm';
4
- import { l as isAbsolute$2, w as resolve, j as join$2, A as extname$2, k as dirname$2 } from './chunk-utils-global.35d3b35d.js';
4
+ import { l as isAbsolute$2, w as resolve, j as join$2, A as extname$2, k as dirname$2 } from './chunk-utils-global.46331799.js';
5
5
  import path from 'path';
6
6
  import fs, { realpathSync, statSync, Stats, promises, existsSync } from 'fs';
7
7
  import assert from 'assert';
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'events';
2
- import { d as c } from './chunk-utils-global.35d3b35d.js';
3
- import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.2004587d.js';
2
+ import { e as c } from './chunk-utils-global.46331799.js';
3
+ import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.9aaddc2d.js';
4
4
  import 'path';
5
5
  import 'tty';
6
6
  import 'local-pkg';
@@ -16,18 +16,18 @@ import 'util';
16
16
  import 'url';
17
17
  import 'os';
18
18
  import 'vite';
19
- import './chunk-constants.596ee4d5.js';
20
- import './chunk-vite-node-utils.5fa30ee7.js';
19
+ import './chunk-constants.a6ce1057.js';
20
+ import 'readline';
21
+ import './chunk-vite-node-utils.3400d522.js';
21
22
  import 'module';
22
23
  import 'vm';
23
- import './chunk-defaults.731639a8.js';
24
+ import './chunk-defaults.aecec9d4.js';
24
25
  import 'perf_hooks';
25
- import './chunk-utils-timers.73950dcb.js';
26
+ import './chunk-utils-timers.6cfeb494.js';
26
27
  import 'worker_threads';
27
28
  import 'tinypool';
28
29
  import './chunk-magic-string.d5e0e473.js';
29
- import 'readline';
30
- import './vendor-index.ee829ed6.js';
30
+ import './vendor-index.13468339.js';
31
31
 
32
32
  function toArr(any) {
33
33
  return any == null ? [] : Array.isArray(any) ? any : [any];
@@ -643,7 +643,7 @@ class CAC extends EventEmitter {
643
643
  const cac = (name = "") => new CAC(name);
644
644
 
645
645
  const cli = cac("vitest");
646
- 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("-t, --testNamePattern <pattern>", "run tests with full names matching the specified pattern").option("--dir <path>", "base directory to scan for the test files").option("--ui", "enable UI").option("--open", "open UI automatically (default: !process.env.CI))").option("--api [api]", "serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--threads", "enabled threads (default: true)").option("--silent", "silent console output from tests").option("--isolate", "isolate environment for each test file (default: true)").option("--reporter <name>", "reporter").option("--outputTruncateLength <length>", "diff output length").option("--outputFile <filename>", "write test results to a file when the --reporter=json or --reporter=junit option is also specified").option("--coverage", "use c8 for coverage").option("--run", "do not watch").option("--mode <name>", "override Vite mode (default: test)").option("--globals", "inject apis globally").option("--global", "deprecated, use --globals").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment (default: node)").option("--passWithNoTests", "pass when no tests found").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").help();
646
+ 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("-t, --testNamePattern <pattern>", "run tests with full names matching the specified pattern").option("--dir <path>", "base directory to scan for the test files").option("--ui", "enable UI").option("--open", "open UI automatically (default: !process.env.CI))").option("--api [api]", "serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--threads", "enabled threads (default: true)").option("--silent", "silent console output from tests").option("--isolate", "isolate environment for each test file (default: true)").option("--reporter <name>", "reporter").option("--outputTruncateLength <length>", "diff output length").option("--outputFile <filename/-s>", "write test results to a file when the --reporter=json or --reporter=junit option is also specified, use cac's dot notation for individual outputs of mutliple reporters").option("--coverage", "use c8 for coverage").option("--run", "do not watch").option("--mode <name>", "override Vite mode (default: test)").option("--globals", "inject apis globally").option("--global", "deprecated, use --globals").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment (default: node)").option("--passWithNoTests", "pass when no tests found").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").help();
647
647
  cli.command("run [...filters]").action(run);
648
648
  cli.command("related [...filters]").action(runRelated);
649
649
  cli.command("watch [...filters]").action(start);
package/dist/entry.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { promises } from 'fs';
2
- import { g as getWorkerState, t as toArray, m as relative, D as partitionSuiteChildren, E as hasTests, q as hasFailed, p as getFullName, r as resetModules } from './chunk-utils-global.35d3b35d.js';
2
+ import { g as getWorkerState, t as toArray, m as relative, D as partitionSuiteChildren, E as hasTests, q as hasFailed, p as getFullName, r as resetModules } from './chunk-utils-global.46331799.js';
3
3
  import { Console } from 'console';
4
4
  import { Writable } from 'stream';
5
5
  import { importModule } from 'local-pkg';
6
- import { r as resetRunOnceCounter, i as index, R as RealDate, s as stringify, c as clearContext, d as defaultSuite, a as setHooks, g as getHooks, b as context, e as getSnapshotClient, f as setState, h as getFn, j as getState, v as vi } from './chunk-runtime-chain.a5280da7.js';
7
- import { r as rpc } from './chunk-runtime-rpc.3f693817.js';
8
- import { c as clearTimeout, s as setTimeout } from './chunk-utils-timers.73950dcb.js';
9
- import { t as takeCoverage } from './chunk-defaults.731639a8.js';
6
+ import { r as resetRunOnceCounter, i as index, R as RealDate, c as clearContext, d as defaultSuite, s as setHooks, g as getHooks, a as context, b as getSnapshotClient, e as setState, f as getFn, h as getState, v as vi } from './chunk-runtime-chain.e17b859e.js';
7
+ import { r as rpc } from './chunk-runtime-rpc.9e81f15b.js';
8
+ import { c as clearTimeout, s as setTimeout, d as stringify } from './chunk-utils-timers.6cfeb494.js';
9
+ import { t as takeCoverage } from './chunk-defaults.aecec9d4.js';
10
10
  import { createHash } from 'crypto';
11
11
  import { format } from 'util';
12
12
  import 'path';
@@ -402,7 +402,7 @@ async function setupGlobalEnv(config) {
402
402
  globalSetup = true;
403
403
  setupConsoleLogSpy();
404
404
  if (config.globals)
405
- (await import('./chunk-integrations-globals.d1145578.js')).registerApiGlobally();
405
+ (await import('./chunk-integrations-globals.5686bfb8.js')).registerApiGlobally();
406
406
  }
407
407
  function setupDefines(defines) {
408
408
  for (const key in defines)
package/dist/index.d.ts CHANGED
@@ -108,7 +108,7 @@ interface MatcherHintOptions {
108
108
  secondArgumentColor?: Formatter;
109
109
  }
110
110
  declare function matcherHint(matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions): string;
111
- declare const stringify: (object: unknown, maxDepth?: number, options?: PrettyFormatOptions | undefined) => string;
111
+ declare function stringify(object: unknown, maxDepth?: number, options?: PrettyFormatOptions): string;
112
112
  declare const printReceived: (object: unknown) => string;
113
113
  declare const printExpected: (value: unknown) => string;
114
114
  interface DiffOptions {
@@ -345,6 +345,7 @@ declare class Vitest {
345
345
  updateSnapshot(files?: string[]): Promise<void>;
346
346
  log(...args: any[]): void;
347
347
  error(...args: any[]): void;
348
+ clearScreen(): void;
348
349
  private _rerunTimer;
349
350
  private scheduleRerun;
350
351
  private unregisterWatcher;
@@ -700,6 +701,7 @@ interface TaskResult {
700
701
  duration?: number;
701
702
  startTime?: number;
702
703
  error?: ErrorWithDiff;
704
+ htmlError?: string;
703
705
  hooks?: Partial<Record<keyof SuiteHooks, TaskState>>;
704
706
  }
705
707
  declare type TaskResultPack = [id: string, result: TaskResult | undefined];
@@ -946,8 +948,9 @@ interface InlineConfig {
946
948
  outputTruncateLength?: number;
947
949
  /**
948
950
  * Write test results to a file when the --reporter=json` or `--reporter=junit` option is also specified.
951
+ * Also definable individually per reporter by using an object instead.
949
952
  */
950
- outputFile?: string;
953
+ outputFile?: string | (Partial<Record<BuiltinReporters, string>> & Record<string, string>);
951
954
  /**
952
955
  * Enable multi-threading
953
956
  *
@@ -1233,13 +1236,13 @@ interface SpyContext<TArgs, TReturns> {
1233
1236
  declare type Procedure = (...args: any[]) => any;
1234
1237
  declare type Methods<T> = {
1235
1238
  [K in keyof T]: T[K] extends Procedure ? K : never;
1236
- }[keyof T] & string;
1239
+ }[keyof T] & (string | symbol);
1237
1240
  declare type Properties<T> = {
1238
1241
  [K in keyof T]: T[K] extends Procedure ? never : K;
1239
- }[keyof T] & string;
1242
+ }[keyof T] & (string | symbol);
1240
1243
  declare type Classes<T> = {
1241
1244
  [K in keyof T]: T[K] extends new (...args: any[]) => any ? K : never;
1242
- }[keyof T] & string;
1245
+ }[keyof T] & (string | symbol);
1243
1246
  interface SpyInstance<TArgs extends any[] = any[], TReturns = any> {
1244
1247
  getMockName(): string;
1245
1248
  mockName(n: string): this;
@@ -1509,4 +1512,4 @@ declare global {
1509
1512
  }
1510
1513
  }
1511
1514
 
1512
- export { ApiConfig, ArgumentsType$1 as ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, C8Options, Constructable, CoverageReporter, DeepMerge, DoneCallback, EnhancedSpy, Environment, EnvironmentOptions, EnvironmentReturn, ErrorWithDiff, File, HookListener, InlineConfig, JSDOMOptions, MergeInsertions, ModuleCache, ModuleGraphData, MutableArray, Nullable, ParsedStack, Position, Reporter, ResolveIdFunction, ResolvedC8Options, ResolvedConfig, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, SpyContext, SpyInstance, SpyInstanceFn, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestFunction, TransformResultWithSource, UncheckedSnapshot, UserConfig, UserConsoleLog, Vitest, WebSocketEvents, WebSocketHandlers, WorkerContext, WorkerGlobalState, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, describe, expect, getRunningMode, isFirstRun, isWatchMode, it, runOnce, suite, test, vi, vitest };
1515
+ export { ApiConfig, ArgumentsType$1 as ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, C8Options, Constructable, CoverageReporter, DeepMerge, DoneCallback, EnhancedSpy, Environment, EnvironmentOptions, EnvironmentReturn, ErrorWithDiff, File, HookListener, InlineConfig, JSDOMOptions, MergeInsertions, MockedFunction, MockedObject, ModuleCache, ModuleGraphData, MutableArray, Nullable, ParsedStack, Position, Reporter, ResolveIdFunction, ResolvedC8Options, ResolvedConfig, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, SpyContext, SpyInstance, SpyInstanceFn, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestFunction, TransformResultWithSource, UncheckedSnapshot, UserConfig, UserConsoleLog, Vitest, WebSocketEvents, WebSocketHandlers, WorkerContext, WorkerGlobalState, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, describe, expect, getRunningMode, isFirstRun, isWatchMode, it, runOnce, suite, test, vi, vitest };
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
- export { q as afterAll, w as afterEach, p as beforeAll, u as beforeEach, l as describe, x as expect, z as getRunningMode, o as isFirstRun, A as isWatchMode, m as it, n as runOnce, k as suite, t as test, v as vi, y as vitest } from './chunk-runtime-chain.a5280da7.js';
1
+ export { p as afterAll, u as afterEach, o as beforeAll, q as beforeEach, k as describe, w as expect, y as getRunningMode, n as isFirstRun, z as isWatchMode, l as it, m as runOnce, j as suite, t as test, v as vi, x as vitest } from './chunk-runtime-chain.e17b859e.js';
2
2
  export { assert, default as chai, should } from 'chai';
3
3
  import 'util';
4
- import './chunk-utils-global.35d3b35d.js';
4
+ import './chunk-utils-global.46331799.js';
5
5
  import 'path';
6
6
  import 'tty';
7
7
  import 'local-pkg';
8
- import './chunk-utils-timers.73950dcb.js';
8
+ import './chunk-utils-timers.6cfeb494.js';
9
9
  import './vendor-_commonjsHelpers.34b404ce.js';
10
- import './chunk-runtime-rpc.3f693817.js';
10
+ import './chunk-runtime-rpc.9e81f15b.js';
11
11
  import 'fs';
12
12
  import './spy.js';
13
13
  import 'tinyspy';
package/dist/node.d.ts CHANGED
@@ -510,6 +510,7 @@ interface TaskResult {
510
510
  duration?: number;
511
511
  startTime?: number;
512
512
  error?: ErrorWithDiff;
513
+ htmlError?: string;
513
514
  hooks?: Partial<Record<keyof SuiteHooks, TaskState>>;
514
515
  }
515
516
  declare type TaskResultPack = [id: string, result: TaskResult | undefined];
@@ -699,8 +700,9 @@ interface InlineConfig {
699
700
  outputTruncateLength?: number;
700
701
  /**
701
702
  * Write test results to a file when the --reporter=json` or `--reporter=junit` option is also specified.
703
+ * Also definable individually per reporter by using an object instead.
702
704
  */
703
- outputFile?: string;
705
+ outputFile?: string | (Partial<Record<BuiltinReporters, string>> & Record<string, string>);
704
706
  /**
705
707
  * Enable multi-threading
706
708
  *
@@ -954,6 +956,7 @@ declare class Vitest {
954
956
  updateSnapshot(files?: string[]): Promise<void>;
955
957
  log(...args: any[]): void;
956
958
  error(...args: any[]): void;
959
+ clearScreen(): void;
957
960
  private _rerunTimer;
958
961
  private scheduleRerun;
959
962
  private unregisterWatcher;
package/dist/node.js CHANGED
@@ -1,5 +1,5 @@
1
- export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.2004587d.js';
2
- export { V as VitestRunner } from './chunk-runtime-mocker.ff55be7d.js';
1
+ export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.9aaddc2d.js';
2
+ export { V as VitestRunner } from './chunk-runtime-mocker.d325f149.js';
3
3
  import 'buffer';
4
4
  import 'path';
5
5
  import 'child_process';
@@ -13,19 +13,19 @@ import 'stream';
13
13
  import 'util';
14
14
  import 'url';
15
15
  import 'os';
16
- import './chunk-utils-global.35d3b35d.js';
16
+ import './chunk-utils-global.46331799.js';
17
17
  import 'tty';
18
18
  import 'local-pkg';
19
19
  import 'vite';
20
- import './chunk-constants.596ee4d5.js';
21
- import './chunk-vite-node-utils.5fa30ee7.js';
20
+ import './chunk-constants.a6ce1057.js';
21
+ import 'readline';
22
+ import './chunk-vite-node-utils.3400d522.js';
22
23
  import 'module';
23
24
  import 'vm';
24
- import './chunk-defaults.731639a8.js';
25
+ import './chunk-defaults.aecec9d4.js';
25
26
  import 'perf_hooks';
26
- import './chunk-utils-timers.73950dcb.js';
27
+ import './chunk-utils-timers.6cfeb494.js';
27
28
  import 'worker_threads';
28
29
  import 'tinypool';
29
30
  import './chunk-magic-string.d5e0e473.js';
30
- import 'readline';
31
- import './vendor-index.ee829ed6.js';
31
+ import './vendor-index.13468339.js';
@@ -1,4 +1,4 @@
1
- import require$$0 from 'readline';
1
+ import readline$2 from 'readline';
2
2
  import require$$2 from 'events';
3
3
 
4
4
  function _mergeNamespaces(n, m) {
@@ -404,7 +404,7 @@ var util$1 = {
404
404
  entriesToDisplay: entriesToDisplay$7
405
405
  };
406
406
 
407
- const readline$1 = require$$0;
407
+ const readline$1 = readline$2;
408
408
 
409
409
  const _require$9 = util$1,
410
410
  action$2 = _require$9.action;
@@ -3283,7 +3283,7 @@ var util = {
3283
3283
  entriesToDisplay: entriesToDisplay$3
3284
3284
  };
3285
3285
 
3286
- const readline = require$$0;
3286
+ const readline = readline$2;
3287
3287
  const { action } = util;
3288
3288
  const EventEmitter = require$$2;
3289
3289
  const { beep, cursor: cursor$9 } = src;
package/dist/worker.js CHANGED
@@ -1,8 +1,8 @@
1
- import { w as resolve, g as getWorkerState } from './chunk-utils-global.35d3b35d.js';
2
- import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.5fa30ee7.js';
3
- import { d as distDir } from './chunk-constants.596ee4d5.js';
4
- import { e as executeInViteNode } from './chunk-runtime-mocker.ff55be7d.js';
5
- import { r as rpc } from './chunk-runtime-rpc.3f693817.js';
1
+ import { w as resolve, g as getWorkerState } from './chunk-utils-global.46331799.js';
2
+ import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.3400d522.js';
3
+ import { d as distDir } from './chunk-constants.a6ce1057.js';
4
+ import { e as executeInViteNode } from './chunk-runtime-mocker.d325f149.js';
5
+ import { r as rpc } from './chunk-runtime-rpc.9e81f15b.js';
6
6
  import 'path';
7
7
  import 'tty';
8
8
  import 'local-pkg';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "0.9.0",
4
+ "version": "0.9.3",
5
5
  "description": "A blazing fast unit test framework powered by Vite",
6
6
  "keywords": [
7
7
  "vite",
@@ -80,7 +80,7 @@
80
80
  "chai": "^4.3.6",
81
81
  "local-pkg": "^0.4.1",
82
82
  "tinypool": "^0.1.2",
83
- "tinyspy": "^0.3.0",
83
+ "tinyspy": "^0.3.2",
84
84
  "vite": "^2.9.1"
85
85
  },
86
86
  "devDependencies": {
@@ -93,7 +93,7 @@
93
93
  "@types/node": "^17.0.23",
94
94
  "@types/prompts": "^2.4.0",
95
95
  "@types/sinonjs__fake-timers": "^8.1.2",
96
- "@vitest/ui": "0.9.0",
96
+ "@vitest/ui": "0.9.3",
97
97
  "birpc": "^0.2.2",
98
98
  "c8": "^7.11.0",
99
99
  "cac": "^6.7.12",
@@ -120,7 +120,7 @@
120
120
  "source-map-js": "^1.0.2",
121
121
  "strip-ansi": "^7.0.1",
122
122
  "typescript": "^4.6.3",
123
- "vite-node": "0.9.0",
123
+ "vite-node": "0.9.3",
124
124
  "ws": "^8.5.0"
125
125
  },
126
126
  "engines": {