Socket
Socket
Sign inDemoInstall

vitest

Package Overview
Dependencies
32
Maintainers
3
Versions
356
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.32.2 to 0.32.3

dist/chunk-api-setup.8f785c4a.js

12

./dist/index.js
export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
export { e as bench, c as createExpect, d as expect, s as setupChaiConfig, v as vi, f as vitest } from './vendor-vi.74cf3ef7.js';
export { i as isFirstRun, a as runOnce } from './vendor-run-once.69ce7172.js';
import { d as dist } from './vendor-index.0f133dbe.js';
export { b as assertType, g as getRunningMode, a as isWatchMode } from './vendor-index.0f133dbe.js';
export { e as bench, c as createExpect, d as expect, s as setupChaiConfig, v as vi, f as vitest } from './vendor-vi.dd6706cb.js';
export { i as isFirstRun, r as runOnce } from './vendor-run-once.1fa85ba7.js';
import { d as dist } from './vendor-index.2af39fbb.js';
export { b as assertType, g as getRunningMode, a as isWatchMode } from './vendor-index.2af39fbb.js';
import * as chai from 'chai';

@@ -11,7 +11,7 @@ export { chai };

import '@vitest/utils';
import './vendor-index.fad2598b.js';
import './vendor-index.23ac4e13.js';
import 'pathe';
import 'std-env';
import './vendor-global.6795f91f.js';
import './vendor-_commonjsHelpers.76cdd49e.js';
import './vendor-_commonjsHelpers.7d1333e8.js';
import '@vitest/expect';

@@ -18,0 +18,0 @@ import '@vitest/snapshot';

export { startTests } from '@vitest/runner';
import { a as ResolvedConfig, a0 as CoverageOptions, Y as CoverageProvider, _ as CoverageProviderModule } from './types-2b1c412e.js';
import { R as ResolvedConfig, C as CoverageOptions, a as CoverageProvider, b as CoverageProviderModule } from './types-198fd1d9.js';
import '@vitest/snapshot';

@@ -4,0 +4,0 @@ import '@vitest/expect';

export { startTests } from '@vitest/runner';
export { s as setupCommonEnv } from './vendor-setup.common.f1cf2231.js';
export { g as getCoverageProvider, a as startCoverageInsideWorker, s as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './vendor-coverage.de2180ed.js';
import '@vitest/utils';
import './vendor-run-once.69ce7172.js';
import './vendor-index.fad2598b.js';
import { setSafeTimers } from '@vitest/utils';
import { a as resetRunOnceCounter } from './vendor-run-once.1fa85ba7.js';
export { g as getCoverageProvider, s as startCoverageInsideWorker, a as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './vendor-coverage.2e41927a.js';
import './vendor-index.23ac4e13.js';
import 'pathe';

@@ -11,1 +10,19 @@ import 'std-env';

import './vendor-global.6795f91f.js';
let globalSetup = false;
async function setupCommonEnv(config) {
resetRunOnceCounter();
setupDefines(config.defines);
if (globalSetup)
return;
globalSetup = true;
setSafeTimers();
if (config.globals)
(await import('./chunk-integrations-globals.0093e2ed.js')).registerApiGlobally();
}
function setupDefines(defines) {
for (const key in defines)
globalThis[key] = defines[key];
}
export { setupCommonEnv };
import { performance } from 'node:perf_hooks';
import v8 from 'node:v8';
import { c as createBirpc } from './vendor-index.87ab04c3.js';
import { c as createBirpc } from './vendor-index.cc463d9e.js';
import { parseRegexp } from '@vitest/utils';
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.001ae440.js';
import { a as rpcDone } from './vendor-rpc.4d3d7a54.js';
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.3576af13.js';
import { r as rpcDone } from './vendor-rpc.ad5b08c7.js';
import { s as setupInspect } from './vendor-inspector.47fc8cbb.js';

@@ -8,0 +8,0 @@ import 'node:url';

import { fileURLToPath } from 'node:url';
import c from 'picocolors';
import { e as execa } from './vendor-index.c1e09929.js';
import { e as execa } from './vendor-index.1f85e5f1.js';
import { E as EXIT_CODE_RESTART } from './vendor-constants.538d9b49.js';

@@ -9,5 +9,5 @@ import 'node:buffer';

import 'node:process';
import './vendor-_commonjsHelpers.7d1333e8.js';
import 'child_process';
import 'path';
import './vendor-_commonjsHelpers.76cdd49e.js';
import 'fs';

@@ -14,0 +14,0 @@ import 'node:os';

import { normalize } from 'pathe';
import cac from 'cac';
import c from 'picocolors';
import { v as version, s as startVitest, d as divider } from './vendor-cli-api.f9adf98c.js';
import './vendor-index.fad2598b.js';
import { t as toArray } from './vendor-index.87ab04c3.js';
import { v as version, s as startVitest, d as divider } from './vendor-cli-api.ff679aa2.js';
import './vendor-index.23ac4e13.js';
import { t as toArray } from './vendor-index.cc463d9e.js';
import './vendor-constants.538d9b49.js';
import './vendor-coverage.de2180ed.js';
import './vendor-index.75f2b63d.js';
import './vendor-coverage.2e41927a.js';
import './vendor-environments.75f2b63d.js';
import 'node:console';

@@ -18,2 +18,3 @@ import 'local-pkg';

import 'node:fs';
import './vendor-_commonjsHelpers.7d1333e8.js';
import 'path';

@@ -25,3 +26,2 @@ import 'os';

import 'fs';
import './vendor-_commonjsHelpers.76cdd49e.js';
import 'vite-node/utils';

@@ -43,3 +43,3 @@ import 'vite-node/client';

import 'node:crypto';
import './vendor-index.c1e09929.js';
import './vendor-index.1f85e5f1.js';
import 'node:buffer';

@@ -61,3 +61,3 @@ import 'child_process';

const cli = cac("vitest");
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", "Enable watch mode").option("-t, --testNamePattern <pattern>", "Run tests with full names matching the specified regexp 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("--single-thread", "Run tests inside a single thread, requires --threads (default: false)").option("--silent", "Silent console output from tests").option("--hideSkippedTests", "Hide logs for skipped tests").option("--isolate", "Isolate environment for each test file (default: true)").option("--reporter <name>", "Specify reporters").option("--outputFile <filename/-s>", "Write test results to a file when supporter reporter is also specified, use cac's dot notation for individual outputs of multiple reporters").option("--coverage", "Enable coverage report").option("--run", "Disable watch mode").option("--mode <name>", "Override Vite mode (default: test)").option("--globals", "Inject apis globally").option("--dom", "Mock browser api with happy-dom").option("--browser [options]", "Run tests in the browser (default: false)").option("--environment <env>", "Specify runner environment, if not running in the browser (default: node)").option("--passWithNoTests", "Pass when no tests found").option("--logHeapUsage", "Show the size of heap for each test").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--dangerouslyIgnoreUnhandledErrors", "Ignore any unhandled errors that occur").option("--shard <shard>", "Test suite shard to execute in a format of <index>/<count>").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").option("--sequence <options>", "Define in what order to run tests (use --sequence.shuffle to run tests in random order)").option("--segfaultRetry <times>", "Return tests on segment fault (default: 0)", { default: 0 }).option("--no-color", "Removes colors from the console output").option("--inspect", "Enable Node.js inspector").option("--inspect-brk", "Enable Node.js inspector with break").option("--test-timeout <time>", "Default timeout of a test in milliseconds (default: 5000)").option("--bail <number>", "Stop test execution when given number of tests have failed", { default: 0 }).help();
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", "Enable watch mode").option("-t, --testNamePattern <pattern>", "Run tests with full names matching the specified regexp 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("--single-thread", "Run tests inside a single thread, requires --threads (default: false)").option("--silent", "Silent console output from tests").option("--hideSkippedTests", "Hide logs for skipped tests").option("--isolate", "Isolate environment for each test file (default: true)").option("--reporter <name>", "Specify reporters").option("--outputFile <filename/-s>", "Write test results to a file when supporter reporter is also specified, use cac's dot notation for individual outputs of multiple reporters").option("--coverage", "Enable coverage report").option("--run", "Disable watch mode").option("--mode <name>", "Override Vite mode (default: test)").option("--globals", "Inject apis globally").option("--dom", "Mock browser api with happy-dom").option("--browser [options]", "Run tests in the browser (default: false)").option("--environment <env>", "Specify runner environment, if not running in the browser (default: node)").option("--passWithNoTests", "Pass when no tests found").option("--logHeapUsage", "Show the size of heap for each test").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--dangerouslyIgnoreUnhandledErrors", "Ignore any unhandled errors that occur").option("--shard <shard>", "Test suite shard to execute in a format of <index>/<count>").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").option("--sequence <options>", "Define in what order to run tests (use --sequence.shuffle to run tests in random order, use --sequence.concurrent to run tests in parallel)").option("--segfaultRetry <times>", "Return tests on segment fault (default: 0)", { default: 0 }).option("--no-color", "Removes colors from the console output").option("--inspect", "Enable Node.js inspector").option("--inspect-brk", "Enable Node.js inspector with break").option("--test-timeout <time>", "Default timeout of a test in milliseconds (default: 5000)").option("--bail <number>", "Stop test execution when given number of tests have failed", { default: 0 }).option("--retry <times>", "Retry the test specific number of times if it fails", { default: 0 }).help();
cli.command("run [...filters]").action(run);

@@ -64,0 +64,0 @@ cli.command("related [...filters]").action(runRelated);

import { UserConfig as UserConfig$1, ConfigEnv } from 'vite';
export { ConfigEnv, UserConfig, mergeConfig } from 'vite';
import { a1 as ResolvedCoverageOptions, q as UserConfig, a5 as CoverageV8Options, a4 as CoverageC8Options, a6 as CustomProviderOptions, a3 as CoverageIstanbulOptions, aj as HtmlOptions, ak as FileOptions, al as CloverOptions, am as CoberturaOptions, an as HtmlSpaOptions, ao as LcovOptions, ap as LcovOnlyOptions, aq as TeamcityOptions, ar as TextOptions, as as ProjectOptions, F as FakeTimerInstallOpts, P as ProjectConfig } from './types-2b1c412e.js';
import { c as ResolvedCoverageOptions, U as UserConfig, d as CoverageV8Options, e as CoverageC8Options, f as CustomProviderOptions, g as CoverageIstanbulOptions, H as HtmlOptions, F as FileOptions, h as CloverOptions, i as CoberturaOptions, j as HtmlSpaOptions, L as LcovOptions, k as LcovOnlyOptions, T as TeamcityOptions, l as TextOptions, P as ProjectOptions, m as FakeTimerInstallOpts, n as ProjectConfig } from './types-198fd1d9.js';
import '@vitest/snapshot';

@@ -5,0 +5,0 @@ import '@vitest/expect';

@@ -1,2 +0,2 @@

import { a2 as BaseCoverageOptions, a1 as ResolvedCoverageOptions } from './types-2b1c412e.js';
import { B as BaseCoverageOptions, c as ResolvedCoverageOptions } from './types-198fd1d9.js';
import '@vitest/snapshot';

@@ -3,0 +3,0 @@ import '@vitest/expect';

import { performance } from 'node:perf_hooks';
import { startTests } from '@vitest/runner';
import { resolve } from 'pathe';
import { c as resetModules } from './vendor-index.fad2598b.js';
import { R as RealDate, d as globalExpect, s as setupChaiConfig, v as vi } from './vendor-vi.74cf3ef7.js';
import { r as resetModules } from './vendor-index.23ac4e13.js';
import { R as RealDate, d as globalExpect, s as setupChaiConfig, v as vi } from './vendor-vi.dd6706cb.js';
import { d as distDir } from './vendor-paths.84fc7a99.js';
import { a as startCoverageInsideWorker, t as takeCoverageInsideWorker, s as stopCoverageInsideWorker } from './vendor-coverage.de2180ed.js';
import { s as startCoverageInsideWorker, t as takeCoverageInsideWorker, a as stopCoverageInsideWorker } from './vendor-coverage.2e41927a.js';
import { createRequire } from 'node:module';

@@ -12,7 +12,7 @@ import { isatty } from 'node:tty';

import { setupColors, createColors, getSafeTimers } from '@vitest/utils';
import { e as environments } from './vendor-index.75f2b63d.js';
import { e as environments } from './vendor-environments.75f2b63d.js';
import { NodeSnapshotEnvironment } from '@vitest/snapshot/environment';
import { r as rpc } from './vendor-rpc.4d3d7a54.js';
import { i as index } from './vendor-index.0f133dbe.js';
import { s as setupCommonEnv } from './vendor-setup.common.f1cf2231.js';
import { a as rpc } from './vendor-rpc.ad5b08c7.js';
import { i as index } from './vendor-index.2af39fbb.js';
import { setupCommonEnv } from './browser.js';
import { g as getWorkerState } from './vendor-global.6795f91f.js';

@@ -22,3 +22,3 @@ import 'std-env';

import 'chai';
import './vendor-_commonjsHelpers.76cdd49e.js';
import './vendor-_commonjsHelpers.7d1333e8.js';
import '@vitest/expect';

@@ -33,3 +33,3 @@ import '@vitest/snapshot';

import 'local-pkg';
import './vendor-run-once.69ce7172.js';
import './vendor-run-once.1fa85ba7.js';

@@ -36,0 +36,0 @@ class VitestSnapshotEnvironment extends NodeSnapshotEnvironment {

@@ -1,2 +0,2 @@

import { S as Environment } from './types-2b1c412e.js';
import { E as Environment } from './types-198fd1d9.js';
import '@vitest/snapshot';

@@ -3,0 +3,0 @@ import '@vitest/expect';

@@ -1,3 +0,3 @@

export { e as builtinEnvironments, p as populateGlobal } from './vendor-index.75f2b63d.js';
export { e as builtinEnvironments, p as populateGlobal } from './vendor-environments.75f2b63d.js';
import 'node:console';
import 'local-pkg';
import { File, TaskResultPack, CancelReason } from '@vitest/runner';
export { DoneCallback, File, HookCleanupCallback, HookListener, OnTestFailedHandler, RunMode, RuntimeContext, SequenceHooks, SequenceSetupFiles, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskMeta, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestContext, TestFunction, TestOptions, afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
import { B as BenchmarkAPI, F as FakeTimerInstallOpts, M as MockFactoryWithHelper, R as RuntimeConfig, A as AfterSuiteRunMeta, U as UserConsoleLog, a as ResolvedConfig, b as ModuleGraphData, c as Reporter } from './types-2b1c412e.js';
export { n as ApiConfig, H as ArgumentsType, G as Arrayable, z as Awaitable, a2 as BaseCoverageOptions, aa as BenchFunction, a8 as Benchmark, a9 as BenchmarkResult, a7 as BenchmarkUserOptions, k as BuiltinEnvironment, m as CSSModuleScopeStrategy, C as ChaiConfig, f as CollectLineNumbers, h as CollectLines, L as Constructable, j as Context, v as ContextRPC, u as ContextTestEnvironment, a4 as CoverageC8Options, a3 as CoverageIstanbulOptions, a0 as CoverageOptions, Y as CoverageProvider, _ as CoverageProviderModule, $ as CoverageReporter, a5 as CoverageV8Options, a6 as CustomProviderOptions, D as DepsOptimizationOptions, S as Environment, E as EnvironmentOptions, Q as EnvironmentReturn, I as InlineConfig, J as JSDOMOptions, O as ModuleCache, K as MutableArray, N as Nullable, X as OnServerRestartHandler, P as ProjectConfig, e as RawErrsMap, Z as ReportContext, x as ResolveIdFunction, a1 as ResolvedCoverageOptions, i as RootAndTarget, t as RunnerRPC, r as RuntimeRPC, T as TscErrorInfo, p as TypecheckConfig, q as UserConfig, w as Vitest, V as VitestEnvironment, l as VitestPool, o as VitestRunMode, W as WorkerContext, y as WorkerGlobalState, d as createExpect, g as expect, s as setupChaiConfig } from './types-2b1c412e.js';
import { v as BenchmarkAPI, m as FakeTimerInstallOpts, w as MockFactoryWithHelper, x as RuntimeConfig, A as AfterSuiteRunMeta, y as UserConsoleLog, R as ResolvedConfig, z as ModuleGraphData, D as Reporter } from './types-198fd1d9.js';
export { a2 as ApiConfig, ah as ArgumentsType, ag as Arrayable, ae as Awaitable, B as BaseCoverageOptions, as as BenchFunction, aq as Benchmark, ar as BenchmarkResult, ap as BenchmarkUserOptions, _ as BuiltinEnvironment, a1 as CSSModuleScopeStrategy, K as ChaiConfig, Q as CollectLineNumbers, S as CollectLines, aj as Constructable, Y as Context, aa as ContextRPC, a9 as ContextTestEnvironment, e as CoverageC8Options, g as CoverageIstanbulOptions, C as CoverageOptions, a as CoverageProvider, b as CoverageProviderModule, ao as CoverageReporter, d as CoverageV8Options, f as CustomProviderOptions, a4 as DepsOptimizationOptions, E as Environment, a3 as EnvironmentOptions, al as EnvironmentReturn, a5 as InlineConfig, Z as JSDOMOptions, ak as ModuleCache, ai as MutableArray, af as Nullable, am as OnServerRestartHandler, n as ProjectConfig, N as RawErrsMap, an as ReportContext, ac as ResolveIdFunction, c as ResolvedCoverageOptions, X as RootAndTarget, a8 as RunnerRPC, a7 as RuntimeRPC, O as TscErrorInfo, a6 as TypecheckConfig, U as UserConfig, o as Vitest, $ as VitestEnvironment, a0 as VitestPool, V as VitestRunMode, ab as WorkerContext, ad as WorkerGlobalState, I as createExpect, G as expect, J as setupChaiConfig } from './types-198fd1d9.js';
import { spyOn, fn, MaybeMockedDeep, MaybeMocked, MaybePartiallyMocked, MaybePartiallyMockedDeep, EnhancedSpy } from '@vitest/spy';

@@ -59,2 +59,3 @@ export { EnhancedSpy, Mock, MockContext, MockInstance, Mocked, MockedClass, MockedFunction, MockedObject, SpyInstance } from '@vitest/spy';

return: DeepBrand<R>;
this: DeepBrand<ThisParameterType<T>>;
} : T extends any[] ? {

@@ -89,48 +90,67 @@ type: 'array';

declare type StrictExtends<L, R> = Extends<DeepBrand<L>, DeepBrand<R>>;
declare type Equal<Left, Right> = And<[StrictExtends<Left, Right>, StrictExtends<Right, Left>]>;
declare type StrictEqual<L, R> = (<T>() => T extends (L & T) | T ? true : false) extends <T>() => T extends (R & T) | T ? true : false ? IsNever<L> extends IsNever<R> ? true : false : false;
declare type Equal<Left, Right, Branded = true> = Branded extends true ? And<[StrictExtends<Left, Right>, StrictExtends<Right, Left>]> : StrictEqual<Left, Right>;
declare type Params<Actual> = Actual extends (...args: infer P) => any ? P : never;
declare type ConstructorParams<Actual> = Actual extends new (...args: infer P) => any ? Actual extends new () => any ? P | [] : P : never;
declare type MismatchArgs<B extends boolean, C extends boolean> = Eq<B, C> extends true ? [] : [never];
interface ExpectTypeOf<Actual, B extends boolean> {
toBeAny: (...MISMATCH: MismatchArgs<IsAny<Actual>, B>) => true;
toBeUnknown: (...MISMATCH: MismatchArgs<IsUnknown<Actual>, B>) => true;
toBeNever: (...MISMATCH: MismatchArgs<IsNever<Actual>, B>) => true;
toBeFunction: (...MISMATCH: MismatchArgs<Extends<Actual, (...args: any[]) => any>, B>) => true;
toBeObject: (...MISMATCH: MismatchArgs<Extends<Actual, object>, B>) => true;
toBeArray: (...MISMATCH: MismatchArgs<Extends<Actual, any[]>, B>) => true;
toBeNumber: (...MISMATCH: MismatchArgs<Extends<Actual, number>, B>) => true;
toBeString: (...MISMATCH: MismatchArgs<Extends<Actual, string>, B>) => true;
toBeBoolean: (...MISMATCH: MismatchArgs<Extends<Actual, boolean>, B>) => true;
toBeVoid: (...MISMATCH: MismatchArgs<Extends<Actual, void>, B>) => true;
toBeSymbol: (...MISMATCH: MismatchArgs<Extends<Actual, symbol>, B>) => true;
toBeNull: (...MISMATCH: MismatchArgs<Extends<Actual, null>, B>) => true;
toBeUndefined: (...MISMATCH: MismatchArgs<Extends<Actual, undefined>, B>) => true;
toBeNullable: (...MISMATCH: MismatchArgs<Not<Equal<Actual, NonNullable<Actual>>>, B>) => true;
declare type MismatchArgs<ActualResult extends boolean, ExpectedResult extends boolean> = Eq<ActualResult, ExpectedResult> extends true ? [] : [never];
interface ExpectTypeOfOptions {
positive: boolean;
branded: boolean;
}
interface ExpectTypeOf<Actual, Options extends ExpectTypeOfOptions> {
toBeAny: (...MISMATCH: MismatchArgs<IsAny<Actual>, Options['positive']>) => true;
toBeUnknown: (...MISMATCH: MismatchArgs<IsUnknown<Actual>, Options['positive']>) => true;
toBeNever: (...MISMATCH: MismatchArgs<IsNever<Actual>, Options['positive']>) => true;
toBeFunction: (...MISMATCH: MismatchArgs<Extends<Actual, (...args: any[]) => any>, Options['positive']>) => true;
toBeObject: (...MISMATCH: MismatchArgs<Extends<Actual, object>, Options['positive']>) => true;
toBeArray: (...MISMATCH: MismatchArgs<Extends<Actual, any[]>, Options['positive']>) => true;
toBeNumber: (...MISMATCH: MismatchArgs<Extends<Actual, number>, Options['positive']>) => true;
toBeString: (...MISMATCH: MismatchArgs<Extends<Actual, string>, Options['positive']>) => true;
toBeBoolean: (...MISMATCH: MismatchArgs<Extends<Actual, boolean>, Options['positive']>) => true;
toBeVoid: (...MISMATCH: MismatchArgs<Extends<Actual, void>, Options['positive']>) => true;
toBeSymbol: (...MISMATCH: MismatchArgs<Extends<Actual, symbol>, Options['positive']>) => true;
toBeNull: (...MISMATCH: MismatchArgs<Extends<Actual, null>, Options['positive']>) => true;
toBeUndefined: (...MISMATCH: MismatchArgs<Extends<Actual, undefined>, Options['positive']>) => true;
toBeNullable: (...MISMATCH: MismatchArgs<Not<Equal<Actual, NonNullable<Actual>, Options['branded']>>, Options['positive']>) => true;
toMatchTypeOf: {
<Expected>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, B>): true;
<Expected>(expected: Expected, ...MISMATCH: MismatchArgs<Extends<Actual, Expected>, B>): true;
<Expected>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, Options['positive']>): true;
<Expected>(expected: Expected, ...MISMATCH: MismatchArgs<Extends<Actual, Expected>, Options['positive']>): true;
};
toEqualTypeOf: {
<Expected>(...MISMATCH: MismatchArgs<Equal<Actual, Expected>, B>): true;
<Expected>(expected: Expected, ...MISMATCH: MismatchArgs<Equal<Actual, Expected>, B>): true;
<Expected>(...MISMATCH: MismatchArgs<Equal<Actual, Expected, Options['branded']>, Options['positive']>): true;
<Expected>(expected: Expected, ...MISMATCH: MismatchArgs<Equal<Actual, Expected, Options['branded']>, Options['positive']>): true;
};
toBeCallableWith: B extends true ? (...args: Params<Actual>) => true : never;
toBeConstructibleWith: B extends true ? (...args: ConstructorParams<Actual>) => true : never;
toHaveProperty: <K extends string>(key: K, ...MISMATCH: MismatchArgs<Extends<K, keyof Actual>, B>) => K extends keyof Actual ? ExpectTypeOf<Actual[K], B> : true;
extract: <V>(v?: V) => ExpectTypeOf<Extract<Actual, V>, B>;
exclude: <V>(v?: V) => ExpectTypeOf<Exclude<Actual, V>, B>;
parameter: <K extends keyof Params<Actual>>(number: K) => ExpectTypeOf<Params<Actual>[K], B>;
parameters: ExpectTypeOf<Params<Actual>, B>;
constructorParameters: ExpectTypeOf<ConstructorParams<Actual>, B>;
instance: Actual extends new (...args: any[]) => infer I ? ExpectTypeOf<I, B> : never;
returns: Actual extends (...args: any[]) => infer R ? ExpectTypeOf<R, B> : never;
resolves: Actual extends PromiseLike<infer R> ? ExpectTypeOf<R, B> : never;
items: Actual extends ArrayLike<infer R> ? ExpectTypeOf<R, B> : never;
guards: Actual extends (v: any, ...args: any[]) => v is infer T ? ExpectTypeOf<T, B> : never;
asserts: Actual extends (v: any, ...args: any[]) => asserts v is infer T ? unknown extends T ? never : ExpectTypeOf<T, B> : never;
not: ExpectTypeOf<Actual, Not<B>>;
toBeCallableWith: Options['positive'] extends true ? (...args: Params<Actual>) => true : never;
toBeConstructibleWith: Options['positive'] extends true ? (...args: ConstructorParams<Actual>) => true : never;
toHaveProperty: <K extends string>(key: K, ...MISMATCH: MismatchArgs<Extends<K, keyof Actual>, Options['positive']>) => K extends keyof Actual ? ExpectTypeOf<Actual[K], Options> : true;
extract: <V>(v?: V) => ExpectTypeOf<Extract<Actual, V>, Options>;
exclude: <V>(v?: V) => ExpectTypeOf<Exclude<Actual, V>, Options>;
parameter: <K extends keyof Params<Actual>>(number: K) => ExpectTypeOf<Params<Actual>[K], Options>;
parameters: ExpectTypeOf<Params<Actual>, Options>;
constructorParameters: ExpectTypeOf<ConstructorParams<Actual>, Options>;
thisParameter: ExpectTypeOf<ThisParameterType<Actual>, Options>;
instance: Actual extends new (...args: any[]) => infer I ? ExpectTypeOf<I, Options> : never;
returns: Actual extends (...args: any[]) => infer R ? ExpectTypeOf<R, Options> : never;
resolves: Actual extends PromiseLike<infer R> ? ExpectTypeOf<R, Options> : never;
items: Actual extends ArrayLike<infer R> ? ExpectTypeOf<R, Options> : never;
guards: Actual extends (v: any, ...args: any[]) => v is infer T ? ExpectTypeOf<T, Options> : never;
asserts: Actual extends (v: any, ...args: any[]) => asserts v is infer T ? unknown extends T ? never : ExpectTypeOf<T, Options> : never;
branded: Omit<ExpectTypeOf<Actual, {
positive: Options['positive'];
branded: true;
}>, 'branded'>;
not: Omit<ExpectTypeOf<Actual, {
positive: Not<Options['positive']>;
branded: Options['branded'];
}>, 'not'>;
}
declare type _ExpectTypeOf = {
<Actual>(actual: Actual): ExpectTypeOf<Actual, true>;
<Actual>(): ExpectTypeOf<Actual, true>;
<Actual>(actual: Actual): ExpectTypeOf<Actual, {
positive: true;
branded: false;
}>;
<Actual>(): ExpectTypeOf<Actual, {
positive: true;
branded: false;
}>;
};

@@ -137,0 +157,0 @@ /**

export { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
export { e as bench, c as createExpect, d as expect, s as setupChaiConfig, v as vi, f as vitest } from './vendor-vi.74cf3ef7.js';
export { i as isFirstRun, a as runOnce } from './vendor-run-once.69ce7172.js';
import { d as dist } from './vendor-index.0f133dbe.js';
export { b as assertType, g as getRunningMode, a as isWatchMode } from './vendor-index.0f133dbe.js';
export { e as bench, c as createExpect, d as expect, s as setupChaiConfig, v as vi, f as vitest } from './vendor-vi.dd6706cb.js';
export { i as isFirstRun, r as runOnce } from './vendor-run-once.1fa85ba7.js';
import { d as dist } from './vendor-index.2af39fbb.js';
export { b as assertType, g as getRunningMode, a as isWatchMode } from './vendor-index.2af39fbb.js';
import * as chai from 'chai';

@@ -11,7 +11,7 @@ export { chai };

import '@vitest/utils';
import './vendor-index.fad2598b.js';
import './vendor-index.23ac4e13.js';
import 'pathe';
import 'std-env';
import './vendor-global.6795f91f.js';
import './vendor-_commonjsHelpers.76cdd49e.js';
import './vendor-_commonjsHelpers.7d1333e8.js';
import '@vitest/expect';

@@ -18,0 +18,0 @@ import '@vitest/snapshot';

@@ -13,3 +13,3 @@ import { pathToFileURL, fileURLToPath } from 'node:url';

import { normalizeModuleId } from 'vite-node/utils';
import './vendor-index.fad2598b.js';
import './vendor-index.23ac4e13.js';
import { g as getWorkerState } from './vendor-global.6795f91f.js';

@@ -33,2 +33,3 @@ import 'std-env';

const isWindows = process$1.platform === 'win32';

@@ -38,2 +39,17 @@

const classRegExp = /^([A-Z][a-z\d]*)+$/;
// Sorted by a rough estimate on most frequently used entries.
const kTypes = new Set([
'string',
'function',
'number',
'object',
// Accept 'Function' and 'Object' as alternative to the lower cased version.
'Function',
'Object',
'boolean',
'bigint',
'symbol'
]);
/**

@@ -56,3 +72,3 @@ * Create a list string in the form like 'A and B' or 'A, B, ..., and Z'.

/** @type {Map<string, MessageFunction|string>} */
/** @type {Map<string, MessageFunction | string>} */
const messages = new Map();

@@ -64,2 +80,91 @@ const nodeInternalPrefix = '__node_internal_';

createError(
'ERR_INVALID_ARG_TYPE',
/**
* @param {string} name
* @param {Array<string> | string} expected
* @param {unknown} actual
*/
(name, expected, actual) => {
assert(typeof name === 'string', "'name' must be a string");
if (!Array.isArray(expected)) {
expected = [expected];
}
let message = 'The ';
if (name.endsWith(' argument')) {
// For cases like 'first argument'
message += `${name} `;
} else {
const type = name.includes('.') ? 'property' : 'argument';
message += `"${name}" ${type} `;
}
message += 'must be ';
/** @type {Array<string>} */
const types = [];
/** @type {Array<string>} */
const instances = [];
/** @type {Array<string>} */
const other = [];
for (const value of expected) {
assert(
typeof value === 'string',
'All expected entries have to be of type string'
);
if (kTypes.has(value)) {
types.push(value.toLowerCase());
} else if (classRegExp.exec(value) === null) {
assert(
value !== 'object',
'The value "object" should be written as "Object"'
);
other.push(value);
} else {
instances.push(value);
}
}
// Special handle `object` in case other instances are allowed to outline
// the differences between each other.
if (instances.length > 0) {
const pos = types.indexOf('object');
if (pos !== -1) {
types.slice(pos, 1);
instances.push('Object');
}
}
if (types.length > 0) {
message += `${types.length > 1 ? 'one of type' : 'of type'} ${formatList(
types,
'or'
)}`;
if (instances.length > 0 || other.length > 0) message += ' or ';
}
if (instances.length > 0) {
message += `an instance of ${formatList(instances, 'or')}`;
if (other.length > 0) message += ' or ';
}
if (other.length > 0) {
if (other.length > 1) {
message += `one of ${formatList(other, 'or')}`;
} else {
if (other[0].toLowerCase() !== other[0]) message += 'an ';
message += `${other[0]}`;
}
}
message += `. Received ${determineSpecificType(actual)}`;
return message
},
TypeError
);
createError(
'ERR_INVALID_MODULE_SPECIFIER',

@@ -250,3 +355,3 @@ /**

* @param {string} sym
* @param {MessageFunction|string} value
* @param {MessageFunction | string} value
* @param {ErrorConstructor} def

@@ -375,3 +480,3 @@ * @returns {new (...args: Array<any>) => Error}

const message = messages.get(key);
assert(typeof message !== 'undefined', 'expected `message` to be found');
assert(message !== undefined, 'expected `message` to be found');

@@ -400,2 +505,33 @@ if (typeof message === 'function') {

}
/**
* Determine the specific type of a value for type-mismatch errors.
* @param {unknown} value
* @returns {string}
*/
function determineSpecificType(value) {
if (value === null || value === undefined) {
return String(value)
}
if (typeof value === 'function' && value.name) {
return `function ${value.name}`
}
if (typeof value === 'object') {
if (value.constructor && value.constructor.name) {
return `an instance of ${value.constructor.name}`
}
return `${inspect(value, {depth: -1})}`
}
let inspected = inspect(value, {colors: false});
if (inspected.length > 28) {
inspected = `${inspected.slice(0, 25)}...`;
}
return `type ${typeof value} (${inspected})`
}
function isNodeBuiltin(id = "") {

@@ -402,0 +538,0 @@ id = id.replace(/^node:/, "").split("/")[0];

@@ -1,3 +0,3 @@

import { o as VitestRunMode, q as UserConfig, w as Vitest, ab as PendingSuiteMock, ac as MockFactory, ad as MockMap, ae as TestSequencer, af as WorkspaceSpec } from './types-2b1c412e.js';
export { ai as TestSequencerConstructor, ag as VitestWorkspace, ah as startVitest } from './types-2b1c412e.js';
import { V as VitestRunMode, U as UserConfig, o as Vitest, p as PendingSuiteMock, M as MockFactory, q as MockMap, r as TestSequencer, W as WorkspaceSpec } from './types-198fd1d9.js';
export { u as TestSequencerConstructor, s as VitestWorkspace, t as startVitest } from './types-198fd1d9.js';
import { UserConfig as UserConfig$1, Plugin } from 'vite';

@@ -22,3 +22,3 @@ import { ViteNodeRunner } from 'vite-node/client';

declare function registerConsoleShortcuts(ctx: Vitest): void;
declare function registerConsoleShortcuts(ctx: Vitest): () => void;

@@ -25,0 +25,0 @@ type Key = string | symbol;

@@ -1,7 +0,7 @@

export { B as BaseSequencer, V as VitestPlugin, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor-cli-api.f9adf98c.js';
export { V as VitestExecutor } from './vendor-execute.001ae440.js';
export { B as BaseSequencer, V as VitestPlugin, c as createVitest, r as registerConsoleShortcuts, s as startVitest } from './vendor-cli-api.ff679aa2.js';
export { V as VitestExecutor } from './vendor-execute.3576af13.js';
import 'pathe';
import './vendor-constants.538d9b49.js';
import './vendor-coverage.de2180ed.js';
import './vendor-index.75f2b63d.js';
import './vendor-coverage.2e41927a.js';
import './vendor-environments.75f2b63d.js';
import 'node:console';

@@ -11,3 +11,3 @@ import 'local-pkg';

import 'picocolors';
import './vendor-index.fad2598b.js';
import './vendor-index.23ac4e13.js';
import 'std-env';

@@ -21,2 +21,3 @@ import '@vitest/runner/utils';

import 'node:fs';
import './vendor-_commonjsHelpers.7d1333e8.js';
import 'path';

@@ -28,3 +29,2 @@ import 'os';

import 'fs';
import './vendor-_commonjsHelpers.76cdd49e.js';
import 'vite-node/utils';

@@ -37,3 +37,3 @@ import 'vite-node/client';

import 'node:child_process';
import './vendor-index.87ab04c3.js';
import './vendor-index.cc463d9e.js';
import 'node:worker_threads';

@@ -46,3 +46,3 @@ import 'node:os';

import 'node:crypto';
import './vendor-index.c1e09929.js';
import './vendor-index.1f85e5f1.js';
import 'node:buffer';

@@ -63,2 +63,2 @@ import 'child_process';

import '@vitest/spy';
import './vendor-rpc.4d3d7a54.js';
import './vendor-rpc.ad5b08c7.js';
import { VitestRunner, VitestRunnerImportSource, Suite, Test, CancelReason, TestContext } from '@vitest/runner';
import { a as ResolvedConfig } from './types-2b1c412e.js';
import { R as ResolvedConfig } from './types-198fd1d9.js';
import '@vitest/snapshot';

@@ -4,0 +4,0 @@ import '@vitest/expect';

import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
import { g as getSnapshotClient, c as createExpect, v as vi, a as getBenchOptions, b as getBenchFn } from './vendor-vi.74cf3ef7.js';
import './vendor-index.fad2598b.js';
import { r as rpc } from './vendor-rpc.4d3d7a54.js';
import { g as getSnapshotClient, c as createExpect, v as vi, a as getBenchOptions, b as getBenchFn } from './vendor-vi.dd6706cb.js';
import './vendor-index.23ac4e13.js';
import { a as rpc } from './vendor-rpc.ad5b08c7.js';
import { g as getFullName } from './vendor-tasks.f9d75aed.js';

@@ -12,3 +12,3 @@ import { g as getWorkerState } from './vendor-global.6795f91f.js';

import 'chai';
import './vendor-_commonjsHelpers.76cdd49e.js';
import './vendor-_commonjsHelpers.7d1333e8.js';
import '@vitest/snapshot';

@@ -24,6 +24,7 @@ import '@vitest/utils/error';

this.config = config;
this.snapshotClient = getSnapshotClient();
this.workerState = getWorkerState();
this.cancelRun = false;
}
snapshotClient = getSnapshotClient();
workerState = getWorkerState();
__vitest_executor;
cancelRun = false;
importFile(filepath, source) {

@@ -131,3 +132,3 @@ if (source === "setup")

if (!globalThis.EventTarget)
await import('./vendor-index.fc98d30f.js').then(function (n) { return n.i; });
await import('./vendor-index.98139333.js').then(function (n) { return n.i; });
return await import('tinybench');

@@ -143,2 +144,3 @@ }

}
const benchmarkTasks = /* @__PURE__ */ new WeakMap();
async function runBenchmarkSuite(suite, runner) {

@@ -181,11 +183,12 @@ var _a;

const task = new Task(benchmarkInstance, id, benchmarkFn);
benchmark.meta.task = task;
benchmarkTasks.set(benchmark, task);
updateTask$1(benchmark);
});
benchmarkGroup.forEach((benchmark) => {
benchmark.meta.task.addEventListener("complete", (e) => {
const task = e.task;
const _benchmark = benchmarkMap[task.name || ""];
const task = benchmarkTasks.get(benchmark);
task.addEventListener("complete", (e) => {
const task2 = e.task;
const _benchmark = benchmarkMap[task2.name || ""];
if (_benchmark) {
const taskRes = task.result;
const taskRes = task2.result;
const result = _benchmark.result.benchmark;

@@ -196,6 +199,6 @@ Object.assign(result, taskRes);

});
benchmark.meta.task.addEventListener("error", (e) => {
const task = e.task;
const _benchmark = benchmarkMap[task.name || ""];
defer.reject(_benchmark ? task.result.error : e);
task.addEventListener("error", (e) => {
const task2 = e.task;
const _benchmark = benchmarkMap[task2.name || ""];
defer.reject(_benchmark ? task2.result.error : e);
});

@@ -205,6 +208,7 @@ });

for (const benchmark of benchmarkGroup) {
await benchmark.meta.task.warmup();
const task = benchmarkTasks.get(benchmark);
await task.warmup();
const { setTimeout } = getSafeTimers();
tasks.push(await new Promise((resolve) => setTimeout(async () => {
resolve(await benchmark.meta.task.run());
resolve(await task.run());
})));

@@ -235,2 +239,3 @@ }

}
__vitest_executor;
importFile(filepath, source) {

@@ -237,0 +242,0 @@ if (source === "setup")

export { getCurrentSuite, getFn, setFn } from '@vitest/runner';
export { createChainable } from '@vitest/runner/utils';
import '@vitest/utils';
import { performance } from 'node:perf_hooks';
import { c as createBirpc } from './vendor-index.87ab04c3.js';
import { c as createBirpc } from './vendor-index.cc463d9e.js';
import { workerId } from 'tinypool';
import { g as getWorkerState } from './vendor-global.6795f91f.js';
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.001ae440.js';
import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.3576af13.js';
import { s as setupInspect } from './vendor-inspector.47fc8cbb.js';
import { a as rpcDone } from './vendor-rpc.4d3d7a54.js';
import { r as rpcDone } from './vendor-rpc.ad5b08c7.js';
import '@vitest/utils';

@@ -9,0 +9,0 @@ import 'node:url';

{
"name": "vitest",
"type": "module",
"version": "0.32.2",
"version": "0.32.3",
"description": "A blazing fast unit test framework powered by Vite",

@@ -135,13 +135,12 @@ "author": "Anthony Fu <anthonyfu117@hotmail.com>",

"@types/node": "*",
"acorn": "^8.8.2",
"acorn": "^8.9.0",
"acorn-walk": "^8.2.0",
"cac": "^6.7.14",
"chai": "^4.3.7",
"concordance": "^5.0.4",
"debug": "^4.3.4",
"local-pkg": "^0.4.3",
"magic-string": "^0.30.0",
"pathe": "^1.1.0",
"pathe": "^1.1.1",
"picocolors": "^1.0.0",
"std-env": "^3.3.2",
"std-env": "^3.3.3",
"strip-literal": "^1.0.1",

@@ -152,8 +151,8 @@ "tinybench": "^2.5.0",

"why-is-node-running": "^2.2.2",
"@vitest/expect": "0.32.2",
"@vitest/runner": "0.32.2",
"vite-node": "0.32.2",
"@vitest/snapshot": "0.32.2",
"@vitest/spy": "0.32.2",
"@vitest/utils": "0.32.2"
"@vitest/runner": "0.32.3",
"@vitest/utils": "0.32.3",
"vite-node": "0.32.3",
"@vitest/snapshot": "0.32.3",
"@vitest/spy": "0.32.3",
"@vitest/expect": "0.32.3"
},

@@ -163,5 +162,5 @@ "devDependencies": {

"@antfu/install-pkg": "^0.1.1",
"@edge-runtime/vm": "3.0.1",
"@edge-runtime/vm": "3.0.3",
"@jridgewell/trace-mapping": "^0.3.18",
"@sinonjs/fake-timers": "^10.0.2",
"@sinonjs/fake-timers": "^11.0.0",
"@types/diff": "^5.0.3",

@@ -180,20 +179,20 @@ "@types/estree": "^1.0.1",

"execa": "^7.1.1",
"expect-type": "^0.15.0",
"expect-type": "^0.16.0",
"fast-glob": "^3.2.12",
"find-up": "^6.3.0",
"flatted": "^3.2.7",
"get-tsconfig": "^4.5.0",
"happy-dom": "^9.10.7",
"get-tsconfig": "^4.6.2",
"happy-dom": "^9.20.3",
"jsdom": "^22.1.0",
"log-update": "^5.0.1",
"micromatch": "^4.0.5",
"mlly": "^1.2.0",
"mlly": "^1.4.0",
"p-limit": "^4.0.0",
"pkg-types": "^1.0.3",
"playwright": "^1.33.0",
"pretty-format": "^27.5.1",
"playwright": "^1.35.1",
"pretty-format": "^29.5.0",
"prompts": "^2.4.2",
"safaridriver": "^0.0.4",
"strip-ansi": "^7.0.1",
"webdriverio": "^8.9.0",
"safaridriver": "^0.0.5",
"strip-ansi": "^7.1.0",
"webdriverio": "^8.11.2",
"ws": "^8.13.0"

@@ -200,0 +199,0 @@ },

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc