Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vitest

Package Overview
Dependencies
Maintainers
1
Versions
383
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vitest - npm Package Compare versions

Comparing version 0.0.68 to 0.0.69

dist/cli.js

309

dist/index.d.ts

@@ -1,10 +0,298 @@

import { R as ResolvedConfig, F as File, T as TaskResultPack, S as SnapshotResult, a as TestFactory, b as SuiteCollector, c as TestFunction, d as SuiteHooks, U as UserOptions } from './options-63a726fa';
export { u as Arrayable, A as Awaitable, C as CliOptions, g as ComputeMode, v as Environment, E as EnvironmentReturn, F as File, G as GlobalContext, H as HookListener, M as ModuleCache, N as Nullable, n as Reporter, R as ResolvedConfig, e as RunMode, o as SnapshotData, r as SnapshotMatchOptions, S as SnapshotResult, q as SnapshotStateOptions, t as SnapshotSummary, p as SnapshotUpdateState, j as Suite, b as SuiteCollector, d as SuiteHooks, l as Task, h as TaskBase, i as TaskResult, T as TaskResultPack, f as TaskState, k as Test, m as TestCollector, a as TestFactory, c as TestFunction, s as UncheckedSnapshot, U as UserOptions, V as VitestContext } from './options-63a726fa';
import { TransformResult, ViteDevServer } from 'vite';
import { OptionsReceived } from 'pretty-format';
import { MessagePort } from 'worker_threads';
import { TransformResult } from 'vite';
export { assert, default as chai, expect, should } from 'chai';
import sinon from 'sinon';
export { default as sinon } from 'sinon';
import 'pretty-format';
declare class StateManager {
filesMap: Record<string, File>;
idMap: Record<string, Task>;
taskFileMap: WeakMap<Task, File>;
getFiles(keys?: string[]): File[];
collectFiles(files: File[]): void;
updateId(task: Task): void;
updateTasks(packs: TaskResultPack[]): void;
}
declare class SnapshotManager {
config: ResolvedConfig;
summary: SnapshotSummary;
constructor(config: ResolvedConfig);
clear(): void;
add(result: SnapshotResult): void;
}
declare type Awaitable<T> = T | PromiseLike<T>;
declare type Nullable<T> = T | null | undefined;
declare type Arrayable<T> = T | Array<T>;
interface ModuleCache {
promise?: Promise<any>;
exports?: any;
transformResult?: TransformResult;
}
interface EnvironmentReturn {
teardown: (global: any) => Awaitable<void>;
}
interface Environment {
name: string;
setup(global: any): Awaitable<EnvironmentReturn>;
}
interface VitestContext {
config: ResolvedConfig;
server: ViteDevServer;
state: StateManager;
snapshot: SnapshotManager;
reporter: Reporter;
}
declare type RunMode = 'run' | 'skip' | 'only' | 'todo';
declare type TaskState = RunMode | 'pass' | 'fail';
declare type ComputeMode = 'serial' | 'concurrent';
interface TaskBase {
id: string;
name: string;
mode: RunMode;
computeMode: ComputeMode;
suite?: Suite;
file?: File;
result?: TaskResult;
}
interface TaskResult {
state: TaskState;
start: number;
end?: number;
error?: unknown;
}
declare type TaskResultPack = [id: string, result: TaskResult | undefined];
interface Suite extends TaskBase {
type: 'suite';
tasks: Task[];
}
interface File extends Suite {
filepath: string;
}
interface Test extends TaskBase {
type: 'test';
suite: Suite;
result?: TaskResult;
}
declare type Task = Test | Suite | File;
declare type TestFunction = () => Awaitable<void>;
declare type TestCollectorFn = (name: string, fn: TestFunction, timeout?: number) => void;
interface ConcurrentCollector {
(name: string, fn: TestFunction, timeout?: number): void;
only: TestCollectorFn;
skip: TestCollectorFn;
todo: (name: string) => void;
}
interface OnlyCollector {
(name: string, fn: TestFunction, timeout?: number): void;
concurrent: TestCollectorFn;
}
interface SkipCollector {
(name: string, fn: TestFunction, timeout?: number): void;
concurrent: TestCollectorFn;
}
interface TodoCollector {
(name: string): void;
concurrent: (name: string) => void;
}
interface TestCollector {
(name: string, fn: TestFunction, timeout?: number): void;
concurrent: ConcurrentCollector;
only: OnlyCollector;
skip: SkipCollector;
todo: TodoCollector;
}
declare type HookListener<T extends any[]> = (...args: T) => Awaitable<void>;
interface SuiteHooks {
beforeAll: HookListener<[Suite]>[];
afterAll: HookListener<[Suite]>[];
beforeEach: HookListener<[Test, Suite]>[];
afterEach: HookListener<[Test, Suite]>[];
}
interface SuiteCollector {
readonly name: string;
readonly mode: RunMode;
type: 'collector';
test: TestCollector;
tasks: (Suite | Test | SuiteCollector)[];
collect: (file?: File) => Promise<Suite>;
clear: () => void;
on: <T extends keyof SuiteHooks>(name: T, ...fn: SuiteHooks[T]) => void;
}
declare type TestFactory = (test: (name: string, fn: TestFunction) => void) => Awaitable<void>;
interface GlobalContext {
tasks: (SuiteCollector | Test)[];
currentSuite: SuiteCollector | null;
}
interface Reporter {
onStart?: (files?: string[]) => Awaitable<void>;
onFinished?: (files?: File[]) => Awaitable<void>;
onTaskUpdate?: (pack: TaskResultPack) => Awaitable<void>;
onWatcherStart?: () => Awaitable<void>;
onWatcherRerun?: (files: string[], trigger: string) => Awaitable<void>;
}
declare type SnapshotData = Record<string, string>;
declare type SnapshotUpdateState = 'all' | 'new' | 'none';
declare type SnapshotStateOptions = {
updateSnapshot: SnapshotUpdateState;
expand?: boolean;
snapshotFormat?: OptionsReceived;
};
declare type SnapshotMatchOptions = {
testName: string;
received: unknown;
key?: string;
inlineSnapshot?: string;
isInline: boolean;
error?: Error;
};
interface SnapshotResult {
filepath: string;
added: number;
fileDeleted: boolean;
matched: number;
unchecked: number;
uncheckedKeys: Array<string>;
unmatched: number;
updated: number;
}
interface UncheckedSnapshot {
filePath: string;
keys: Array<string>;
}
interface SnapshotSummary {
added: number;
didUpdate: boolean;
failure: boolean;
filesAdded: number;
filesRemoved: number;
filesRemovedList: Array<string>;
filesUnmatched: number;
filesUpdated: number;
matched: number;
total: number;
unchecked: number;
uncheckedKeysByFile: Array<UncheckedSnapshot>;
unmatched: number;
updated: number;
}
interface UserOptions {
/**
* Include globs for test files
*
* @default ['**\/*.test.ts']
*/
includes?: string[];
/**
* Exclude globs for test files
* @default ['**\/node_modules\/**']
*/
excludes?: string[];
/**
* Handling for dependencies inlining or externalizing
*/
deps?: {
/**
* Externalize means that Vite will bypass the package to native Node.
*
* Externaled dependencies will not be applied Vite's transformers and resolvers.
* And does not support HMR on reload.
*
* Typically, packages under `node_modules` are externalized.
*/
external?: (string | RegExp)[];
/**
* Vite will process inlined modules.
*
* This could be helpful to handle packages that ship `.js` in ESM format (that Node can't handle).
*/
inline?: (string | RegExp)[];
};
/**
* Register apis globally
*
* @default false
*/
global?: boolean;
/**
* Running environment
*
* Supports 'node', 'jsdom', 'happy-dom'
*
* @default 'node'
*/
environment?: 'node' | 'jsdom' | 'happy-dom';
/**
* Update snapshot files
*
* @default false
*/
update?: boolean;
/**
* Watch mode
*
* @default false
*/
watch?: boolean;
/**
* Project root
*/
root?: string;
/**
* Custom reporter for output
*/
reporter?: Reporter;
/**
* Enable multi-threading
*
* @default true
*/
threads?: boolean;
/**
* Maximum number of threads
*
* @default available CPUs
*/
maxThreads?: number;
/**
* Minimum number of threads
*
* @default available CPUs
*/
minThreads?: number;
interpretDefault?: boolean;
testTimeout?: number;
hookTimeout?: number;
}
interface CliOptions extends UserOptions {
/**
* Filters by name
*/
cliFilters?: string[];
/**
* Path to the config file.
*
* Default resolving to one of:
* - `vitest.config.js`
* - `vitest.config.ts`
* - `vite.config.js`
* - `vite.config.ts`
*/
config?: string | undefined;
dom?: boolean;
}
interface ResolvedConfig extends Omit<Required<CliOptions>, 'config' | 'filters'> {
config?: string;
filters?: string[];
depsInline: (string | RegExp)[];
depsExternal: (string | RegExp)[];
snapshotOptions: SnapshotStateOptions;
}
interface WorkerContext {

@@ -130,2 +418,13 @@ port: MessagePort;

declare function clearContext(): void;
declare global {
namespace NodeJS {
interface Process {
__vitest_worker__: {
config: ResolvedConfig;
rpc: RpcCall;
send: RpcSend;
};
}
}
}

@@ -196,2 +495,2 @@ declare const mock: sinon.SinonMockStatic;

export { RpcCall, RpcMap, RpcPayload, RpcSend, WorkerContext, afterAll, afterEach, beforeAll, beforeEach, clearContext, createSuiteHooks, defaultSuite, describe, it, mock, spy, stub, suite, test };
export { Arrayable, Awaitable, CliOptions, ComputeMode, Environment, EnvironmentReturn, File, GlobalContext, HookListener, ModuleCache, Nullable, Reporter, ResolvedConfig, RpcCall, RpcMap, RpcPayload, RpcSend, RunMode, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, Suite, SuiteCollector, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestCollector, TestFactory, TestFunction, UncheckedSnapshot, UserOptions, VitestContext, WorkerContext, afterAll, afterEach, beforeAll, beforeEach, clearContext, createSuiteHooks, defaultSuite, describe, it, mock, spy, stub, suite, test };

51

dist/index.js

@@ -1,46 +0,5 @@

import {
assert,
chai,
expect,
mock,
should,
sinon,
spy,
stub
} from "./chunk-YPKHVZRP.js";
import {
afterAll,
afterEach,
beforeAll,
beforeEach,
clearContext,
createSuiteHooks,
defaultSuite,
describe,
it,
suite,
test
} from "./chunk-ANPMHBIF.js";
import "./chunk-APGELTDH.js";
import "./chunk-R2SMNEBL.js";
export {
afterAll,
afterEach,
assert,
beforeAll,
beforeEach,
chai,
clearContext,
createSuiteHooks,
defaultSuite,
describe,
expect,
it,
mock,
should,
sinon,
spy,
stub,
suite,
test
};
export { e as afterAll, g as afterEach, b as beforeAll, f as beforeEach, h as clearContext, c as createSuiteHooks, d as defaultSuite, a as describe, i as it, s as suite, t as test } from './suite-819c135e.js';
export { assert, default as chai, expect, should } from 'chai';
export { m as mock, s as spy, a as stub } from './index-e37648e9.js';
export { default as sinon } from 'sinon';
import './index-6427e0f2.js';
{
"name": "vitest",
"version": "0.0.68",
"version": "0.0.69",
"description": "A blazing fast unit test framework powered by Vite",

@@ -42,5 +42,5 @@ "keywords": [

"scripts": {
"build": "tsup --dts",
"build": "rimraf dist && rollup -c",
"coverage": "node bin/vitest.mjs -r test/core --coverage",
"dev": "tsup --watch src",
"dev": "rollup -c -w src",
"docs": "npm -C docs run dev",

@@ -64,5 +64,3 @@ "docs:build": "npm -C docs run build",

"fast-glob": "^3.2.7",
"log-update": "^5.0.0",
"micromatch": "^4.0.4",
"picocolors": "^1.0.0",
"piscina": "^3.2.0",

@@ -74,4 +72,10 @@ "sinon": "^12.0.1",

"devDependencies": {
"log-update": "^5.0.0",
"picocolors": "^1.0.0",
"@antfu/eslint-config": "^0.13.1",
"@antfu/ni": "^0.12.0",
"@rollup/plugin-alias": "^3.1.8",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.6",
"@types/chai-subset": "^1.3.3",

@@ -101,2 +105,4 @@ "@types/diff": "^5.0.1",

"rimraf": "^3.0.2",
"rollup-plugin-dts": "^4.0.1",
"rollup-plugin-esbuild": "^4.7.2",
"strip-ansi": "^7.0.1",

@@ -103,0 +109,0 @@ "tsup": "^5.11.1",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc