vitest 0.12.5 → 0.12.8

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.
Files changed (27) hide show
  1. package/LICENSE.md +0 -72
  2. package/dist/{chunk-api-setup.62de6413.js → chunk-api-setup.9ccd19b5.js} +5 -4
  3. package/dist/{chunk-constants.153353ee.js → chunk-constants.3570739f.js} +1 -1
  4. package/dist/{chunk-defaults.374342ed.js → chunk-defaults.7d81a6ca.js} +1 -1
  5. package/dist/{chunk-install-pkg.eb979c48.js → chunk-install-pkg.fd8d1022.js} +9 -11
  6. package/dist/chunk-integrations-globals.23cc66c3.js +26 -0
  7. package/dist/{chunk-magic-string.d5e0e473.js → chunk-magic-string.41232190.js} +0 -4
  8. package/dist/{chunk-runtime-chain.eb563278.js → chunk-runtime-chain.5021a6b6.js} +44 -10
  9. package/dist/{chunk-runtime-mocker.efd6b7ac.js → chunk-runtime-mocker.d26f8110.js} +8 -7
  10. package/dist/{chunk-runtime-rpc.ef131645.js → chunk-runtime-rpc.47bae3f9.js} +1 -1
  11. package/dist/{chunk-utils-global.03413604.js → chunk-utils-global.2fab7e5c.js} +3 -9
  12. package/dist/{chunk-utils-timers.a0f0fe66.js → chunk-utils-timers.da6ac0a6.js} +3 -2
  13. package/dist/{chunk-vite-node-externalize.8560ca65.js → chunk-vite-node-externalize.fc385bba.js} +67 -58
  14. package/dist/{chunk-vite-node-utils.1064f66b.js → chunk-vite-node-utils.46e2a803.js} +8 -1064
  15. package/dist/cli.js +11 -9
  16. package/dist/config.d.ts +6 -3
  17. package/dist/entry.js +7 -6
  18. package/dist/index.d.ts +247 -249
  19. package/dist/index.js +5 -4
  20. package/dist/node.d.ts +215 -0
  21. package/dist/node.js +13 -11
  22. package/dist/vendor-_commonjsHelpers.addc3445.js +3 -0
  23. package/dist/{vendor-entry.5b810598.js → vendor-entry.ca05c118.js} +28 -83
  24. package/dist/{vendor-index.4e550a2c.js → vendor-index.6c69a0a8.js} +5 -5
  25. package/dist/worker.js +6 -5
  26. package/package.json +8 -7
  27. package/dist/chunk-integrations-globals.4fea033a.js +0 -25
package/dist/cli.js CHANGED
@@ -1,13 +1,14 @@
1
1
  import { EventEmitter } from 'events';
2
- import { p as picocolors } from './chunk-utils-global.03413604.js';
3
- import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.8560ca65.js';
2
+ import { p as picocolors } from './chunk-utils-global.2fab7e5c.js';
3
+ import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.fc385bba.js';
4
4
  import 'tty';
5
5
  import 'local-pkg';
6
6
  import 'path';
7
7
  import 'buffer';
8
8
  import 'child_process';
9
9
  import 'process';
10
- import './vendor-index.4e550a2c.js';
10
+ import './vendor-index.6c69a0a8.js';
11
+ import './vendor-_commonjsHelpers.addc3445.js';
11
12
  import 'fs';
12
13
  import 'assert';
13
14
  import 'stream';
@@ -15,17 +16,18 @@ import 'util';
15
16
  import 'url';
16
17
  import 'os';
17
18
  import 'vite';
18
- import './chunk-constants.153353ee.js';
19
+ import './chunk-constants.3570739f.js';
19
20
  import 'readline';
20
- import './chunk-vite-node-utils.1064f66b.js';
21
+ import './chunk-vite-node-utils.46e2a803.js';
21
22
  import 'module';
22
23
  import 'vm';
23
- import './chunk-defaults.374342ed.js';
24
+ import 'debug';
25
+ import './chunk-defaults.7d81a6ca.js';
24
26
  import 'worker_threads';
25
27
  import 'tinypool';
26
28
  import 'perf_hooks';
27
- import './chunk-utils-timers.a0f0fe66.js';
28
- import './chunk-magic-string.d5e0e473.js';
29
+ import './chunk-utils-timers.da6ac0a6.js';
30
+ import './chunk-magic-string.41232190.js';
29
31
  import './vendor-index.405e58ef.js';
30
32
 
31
33
  function toArr(any) {
@@ -642,7 +644,7 @@ class CAC extends EventEmitter {
642
644
  const cac = (name = "") => new CAC(name);
643
645
 
644
646
  const cli = cac("vitest");
645
- 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
+ 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("--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
648
  cli.command("run [...filters]").action(run);
647
649
  cli.command("related [...filters]").action(runRelated);
648
650
  cli.command("watch [...filters]").action(start);
package/dist/config.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { UserConfig as UserConfig$2 } from 'vite';
1
+ import { UserConfig as UserConfig$2, ConfigEnv } from 'vite';
2
+ export { ConfigEnv } from 'vite';
2
3
  import { UserConfig as UserConfig$1, ResolvedC8Options } from 'vitest';
3
4
 
4
5
  // Type definitions for @sinonjs/fake-timers 8.1
@@ -98,6 +99,8 @@ interface UserConfig extends UserConfig$2 {
98
99
  test?: UserConfig$2['test'];
99
100
  }
100
101
 
101
- declare function defineConfig(config: UserConfig): UserConfig;
102
+ declare type UserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
103
+ declare type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFn;
104
+ declare function defineConfig(config: UserConfigExport): UserConfigExport;
102
105
 
103
- export { UserConfig, configDefaults, defineConfig };
106
+ export { UserConfig, UserConfigExport, UserConfigFn, configDefaults, defineConfig };
package/dist/entry.js CHANGED
@@ -1,16 +1,17 @@
1
- export { r as run } from './vendor-entry.5b810598.js';
1
+ export { r as run } from './vendor-entry.ca05c118.js';
2
2
  import 'fs';
3
- import './chunk-utils-global.03413604.js';
3
+ import './chunk-utils-global.2fab7e5c.js';
4
4
  import 'tty';
5
5
  import 'local-pkg';
6
6
  import 'path';
7
- import './chunk-runtime-chain.eb563278.js';
7
+ import './chunk-runtime-chain.5021a6b6.js';
8
8
  import 'chai';
9
- import './chunk-runtime-rpc.ef131645.js';
10
- import './chunk-utils-timers.a0f0fe66.js';
9
+ import './vendor-_commonjsHelpers.addc3445.js';
10
+ import './chunk-runtime-rpc.47bae3f9.js';
11
+ import './chunk-utils-timers.da6ac0a6.js';
11
12
  import './chunk-integrations-spy.bee66426.js';
12
13
  import 'tinyspy';
13
14
  import 'util';
14
- import './chunk-defaults.374342ed.js';
15
+ import './chunk-defaults.7d81a6ca.js';
15
16
  import 'module';
16
17
  import 'url';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ViteDevServer, TransformResult, CommonServerOptions } from 'vite';
2
- import { MessagePort } from 'worker_threads';
3
2
  import { SpyImpl } from 'tinyspy';
3
+ import { MessagePort } from 'worker_threads';
4
4
  export { assert, default as chai, should } from 'chai';
5
5
 
6
6
  /**
@@ -90,112 +90,6 @@ declare type OldPlugin = {
90
90
  declare type Plugin = NewPlugin | OldPlugin;
91
91
  declare type Plugins = Array<Plugin>;
92
92
 
93
- declare type Formatter = (input: string | number | null | undefined) => string;
94
-
95
- declare const EXPECTED_COLOR: Formatter;
96
- declare const RECEIVED_COLOR: Formatter;
97
- declare const INVERTED_COLOR: Formatter;
98
- declare const BOLD_WEIGHT: Formatter;
99
- declare const DIM_COLOR: Formatter;
100
- interface MatcherHintOptions {
101
- comment?: string;
102
- expectedColor?: Formatter;
103
- isDirectExpectCall?: boolean;
104
- isNot?: boolean;
105
- promise?: string;
106
- receivedColor?: Formatter;
107
- secondArgument?: string;
108
- secondArgumentColor?: Formatter;
109
- }
110
- declare function matcherHint(matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions): string;
111
- declare function stringify(object: unknown, maxDepth?: number, options?: PrettyFormatOptions): string;
112
- declare const printReceived: (object: unknown) => string;
113
- declare const printExpected: (value: unknown) => string;
114
- interface DiffOptions {
115
- aAnnotation?: string;
116
- aColor?: Formatter;
117
- aIndicator?: string;
118
- bAnnotation?: string;
119
- bColor?: Formatter;
120
- bIndicator?: string;
121
- changeColor?: Formatter;
122
- changeLineTrailingSpaceColor?: Formatter;
123
- commonColor?: Formatter;
124
- commonIndicator?: string;
125
- commonLineTrailingSpaceColor?: Formatter;
126
- contextLines?: number;
127
- emptyFirstOrLastLinePlaceholder?: string;
128
- expand?: boolean;
129
- includeChangeCounts?: boolean;
130
- omitAnnotationLines?: boolean;
131
- patchColor?: Formatter;
132
- compareKeys?: any;
133
- }
134
- declare function diff(a: any, b: any, options?: DiffOptions): string;
135
-
136
- declare const jestMatcherUtils_EXPECTED_COLOR: typeof EXPECTED_COLOR;
137
- declare const jestMatcherUtils_RECEIVED_COLOR: typeof RECEIVED_COLOR;
138
- declare const jestMatcherUtils_INVERTED_COLOR: typeof INVERTED_COLOR;
139
- declare const jestMatcherUtils_BOLD_WEIGHT: typeof BOLD_WEIGHT;
140
- declare const jestMatcherUtils_DIM_COLOR: typeof DIM_COLOR;
141
- type jestMatcherUtils_MatcherHintOptions = MatcherHintOptions;
142
- declare const jestMatcherUtils_matcherHint: typeof matcherHint;
143
- declare const jestMatcherUtils_stringify: typeof stringify;
144
- declare const jestMatcherUtils_printReceived: typeof printReceived;
145
- declare const jestMatcherUtils_printExpected: typeof printExpected;
146
- type jestMatcherUtils_DiffOptions = DiffOptions;
147
- declare const jestMatcherUtils_diff: typeof diff;
148
- declare namespace jestMatcherUtils {
149
- export {
150
- jestMatcherUtils_EXPECTED_COLOR as EXPECTED_COLOR,
151
- jestMatcherUtils_RECEIVED_COLOR as RECEIVED_COLOR,
152
- jestMatcherUtils_INVERTED_COLOR as INVERTED_COLOR,
153
- jestMatcherUtils_BOLD_WEIGHT as BOLD_WEIGHT,
154
- jestMatcherUtils_DIM_COLOR as DIM_COLOR,
155
- jestMatcherUtils_MatcherHintOptions as MatcherHintOptions,
156
- jestMatcherUtils_matcherHint as matcherHint,
157
- jestMatcherUtils_stringify as stringify,
158
- jestMatcherUtils_printReceived as printReceived,
159
- jestMatcherUtils_printExpected as printExpected,
160
- jestMatcherUtils_DiffOptions as DiffOptions,
161
- jestMatcherUtils_diff as diff,
162
- };
163
- }
164
-
165
- declare type Tester = (a: any, b: any) => boolean | undefined;
166
- interface MatcherState {
167
- assertionCalls: number;
168
- currentTestName?: string;
169
- dontThrow?: () => void;
170
- error?: Error;
171
- equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean;
172
- expand?: boolean;
173
- expectedAssertionsNumber?: number | null;
174
- expectedAssertionsNumberErrorGen?: (() => Error) | null;
175
- isExpectingAssertions?: boolean;
176
- isExpectingAssertionsError?: Error | null;
177
- isNot: boolean;
178
- promise: string;
179
- suppressedErrors: Array<Error>;
180
- testPath?: string;
181
- utils: typeof jestMatcherUtils & {
182
- iterableEquality: Tester;
183
- subsetEquality: Tester;
184
- };
185
- }
186
- interface SyncExpectationResult {
187
- pass: boolean;
188
- message: () => string;
189
- actual?: any;
190
- expected?: any;
191
- }
192
- declare type AsyncExpectationResult = Promise<SyncExpectationResult>;
193
- declare type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;
194
- interface RawMatcherFn<T extends MatcherState = MatcherState> {
195
- (this: T, received: any, expected: any, options?: any): ExpectationResult;
196
- }
197
- declare type MatchersObject<T extends MatcherState = MatcherState> = Record<string, RawMatcherFn<T>>;
198
-
199
93
  // Type definitions for @sinonjs/fake-timers 8.1
200
94
  // Project: https://github.com/sinonjs/fake-timers
201
95
  // Definitions by: Wim Looman <https://github.com/Nemo157>
@@ -1292,6 +1186,218 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
1292
1186
  api?: ApiConfig;
1293
1187
  }
1294
1188
 
1189
+ declare type VitestInlineConfig = InlineConfig;
1190
+ declare module 'vite' {
1191
+ interface UserConfig {
1192
+ /**
1193
+ * Options for Vitest
1194
+ */
1195
+ test?: VitestInlineConfig;
1196
+ }
1197
+ }
1198
+
1199
+ declare type Formatter = (input: string | number | null | undefined) => string;
1200
+
1201
+ interface MatcherHintOptions {
1202
+ comment?: string;
1203
+ expectedColor?: Formatter;
1204
+ isDirectExpectCall?: boolean;
1205
+ isNot?: boolean;
1206
+ promise?: string;
1207
+ receivedColor?: Formatter;
1208
+ secondArgument?: string;
1209
+ secondArgumentColor?: Formatter;
1210
+ }
1211
+ interface DiffOptions {
1212
+ aAnnotation?: string;
1213
+ aColor?: Formatter;
1214
+ aIndicator?: string;
1215
+ bAnnotation?: string;
1216
+ bColor?: Formatter;
1217
+ bIndicator?: string;
1218
+ changeColor?: Formatter;
1219
+ changeLineTrailingSpaceColor?: Formatter;
1220
+ commonColor?: Formatter;
1221
+ commonIndicator?: string;
1222
+ commonLineTrailingSpaceColor?: Formatter;
1223
+ contextLines?: number;
1224
+ emptyFirstOrLastLinePlaceholder?: string;
1225
+ expand?: boolean;
1226
+ includeChangeCounts?: boolean;
1227
+ omitAnnotationLines?: boolean;
1228
+ patchColor?: Formatter;
1229
+ compareKeys?: any;
1230
+ }
1231
+
1232
+ declare const EXPECTED_COLOR: Formatter;
1233
+ declare const RECEIVED_COLOR: Formatter;
1234
+ declare const INVERTED_COLOR: Formatter;
1235
+ declare const BOLD_WEIGHT: Formatter;
1236
+ declare const DIM_COLOR: Formatter;
1237
+ declare function matcherHint(matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions): string;
1238
+ declare function stringify(object: unknown, maxDepth?: number, options?: PrettyFormatOptions): string;
1239
+ declare const printReceived: (object: unknown) => string;
1240
+ declare const printExpected: (value: unknown) => string;
1241
+ declare function diff(a: any, b: any, options?: DiffOptions): string;
1242
+
1243
+ declare const jestMatcherUtils_EXPECTED_COLOR: typeof EXPECTED_COLOR;
1244
+ declare const jestMatcherUtils_RECEIVED_COLOR: typeof RECEIVED_COLOR;
1245
+ declare const jestMatcherUtils_INVERTED_COLOR: typeof INVERTED_COLOR;
1246
+ declare const jestMatcherUtils_BOLD_WEIGHT: typeof BOLD_WEIGHT;
1247
+ declare const jestMatcherUtils_DIM_COLOR: typeof DIM_COLOR;
1248
+ declare const jestMatcherUtils_matcherHint: typeof matcherHint;
1249
+ declare const jestMatcherUtils_stringify: typeof stringify;
1250
+ declare const jestMatcherUtils_printReceived: typeof printReceived;
1251
+ declare const jestMatcherUtils_printExpected: typeof printExpected;
1252
+ declare const jestMatcherUtils_diff: typeof diff;
1253
+ declare namespace jestMatcherUtils {
1254
+ export {
1255
+ jestMatcherUtils_EXPECTED_COLOR as EXPECTED_COLOR,
1256
+ jestMatcherUtils_RECEIVED_COLOR as RECEIVED_COLOR,
1257
+ jestMatcherUtils_INVERTED_COLOR as INVERTED_COLOR,
1258
+ jestMatcherUtils_BOLD_WEIGHT as BOLD_WEIGHT,
1259
+ jestMatcherUtils_DIM_COLOR as DIM_COLOR,
1260
+ jestMatcherUtils_matcherHint as matcherHint,
1261
+ jestMatcherUtils_stringify as stringify,
1262
+ jestMatcherUtils_printReceived as printReceived,
1263
+ jestMatcherUtils_printExpected as printExpected,
1264
+ jestMatcherUtils_diff as diff,
1265
+ };
1266
+ }
1267
+
1268
+ declare type Tester = (a: any, b: any) => boolean | undefined;
1269
+ interface MatcherState {
1270
+ assertionCalls: number;
1271
+ currentTestName?: string;
1272
+ dontThrow?: () => void;
1273
+ error?: Error;
1274
+ equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean;
1275
+ expand?: boolean;
1276
+ expectedAssertionsNumber?: number | null;
1277
+ expectedAssertionsNumberErrorGen?: (() => Error) | null;
1278
+ isExpectingAssertions?: boolean;
1279
+ isExpectingAssertionsError?: Error | null;
1280
+ isNot: boolean;
1281
+ promise: string;
1282
+ suppressedErrors: Array<Error>;
1283
+ testPath?: string;
1284
+ utils: typeof jestMatcherUtils & {
1285
+ iterableEquality: Tester;
1286
+ subsetEquality: Tester;
1287
+ };
1288
+ }
1289
+ interface SyncExpectationResult {
1290
+ pass: boolean;
1291
+ message: () => string;
1292
+ actual?: any;
1293
+ expected?: any;
1294
+ }
1295
+ declare type AsyncExpectationResult = Promise<SyncExpectationResult>;
1296
+ declare type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;
1297
+ interface RawMatcherFn<T extends MatcherState = MatcherState> {
1298
+ (this: T, received: any, expected: any, options?: any): ExpectationResult;
1299
+ }
1300
+ declare type MatchersObject<T extends MatcherState = MatcherState> = Record<string, RawMatcherFn<T>>;
1301
+
1302
+ declare type Promisify<O> = {
1303
+ [K in keyof O]: O[K] extends (...args: infer A) => infer R ? O extends R ? Promisify<O[K]> : (...args: A) => Promise<R> : O[K];
1304
+ };
1305
+ declare global {
1306
+ namespace jest {
1307
+ interface Matchers<R, T = {}> {
1308
+ }
1309
+ }
1310
+ namespace Vi {
1311
+ interface ExpectStatic extends Chai.ExpectStatic, AsymmetricMatchersContaining {
1312
+ <T>(actual: T, message?: string): Vi.Assertion<T>;
1313
+ extend(expects: MatchersObject): void;
1314
+ assertions(expected: number): void;
1315
+ hasAssertions(): void;
1316
+ anything(): any;
1317
+ any(constructor: unknown): any;
1318
+ addSnapshotSerializer(plugin: Plugin): void;
1319
+ getState(): MatcherState;
1320
+ setState(state: Partial<MatcherState>): void;
1321
+ not: AsymmetricMatchersContaining;
1322
+ }
1323
+ interface AsymmetricMatchersContaining {
1324
+ stringContaining(expected: string): any;
1325
+ objectContaining(expected: any): any;
1326
+ arrayContaining<T = unknown>(expected: Array<T>): any;
1327
+ stringMatching(expected: string | RegExp): any;
1328
+ }
1329
+ interface JestAssertion<T = any> extends jest.Matchers<void, T> {
1330
+ toMatchSnapshot<U extends {
1331
+ [P in keyof T]: any;
1332
+ }>(snapshot: Partial<U>, message?: string): void;
1333
+ toMatchSnapshot(message?: string): void;
1334
+ matchSnapshot<U extends {
1335
+ [P in keyof T]: any;
1336
+ }>(snapshot: Partial<U>, message?: string): void;
1337
+ matchSnapshot(message?: string): void;
1338
+ toMatchInlineSnapshot<U extends {
1339
+ [P in keyof T]: any;
1340
+ }>(properties: Partial<U>, snapshot?: string, message?: string): void;
1341
+ toMatchInlineSnapshot(snapshot?: string, message?: string): void;
1342
+ toThrowErrorMatchingSnapshot(message?: string): void;
1343
+ toThrowErrorMatchingInlineSnapshot(snapshot?: string, message?: string): void;
1344
+ toEqual<E>(expected: E): void;
1345
+ toStrictEqual<E>(expected: E): void;
1346
+ toBe<E>(expected: E): void;
1347
+ toMatch(expected: string | RegExp): void;
1348
+ toMatchObject<E extends {} | any[]>(expected: E): void;
1349
+ toContain<E>(item: E): void;
1350
+ toContainEqual<E>(item: E): void;
1351
+ toBeTruthy(): void;
1352
+ toBeFalsy(): void;
1353
+ toBeGreaterThan(num: number | bigint): void;
1354
+ toBeGreaterThanOrEqual(num: number | bigint): void;
1355
+ toBeLessThan(num: number | bigint): void;
1356
+ toBeLessThanOrEqual(num: number | bigint): void;
1357
+ toBeNaN(): void;
1358
+ toBeUndefined(): void;
1359
+ toBeNull(): void;
1360
+ toBeDefined(): void;
1361
+ toBeTypeOf(expected: 'bigint' | 'boolean' | 'function' | 'number' | 'object' | 'string' | 'symbol' | 'undefined'): void;
1362
+ toBeInstanceOf<E>(expected: E): void;
1363
+ toBeCalledTimes(times: number): void;
1364
+ toHaveLength(length: number): void;
1365
+ toHaveProperty<E>(property: string | string[], value?: E): void;
1366
+ toBeCloseTo(number: number, numDigits?: number): void;
1367
+ toHaveBeenCalledTimes(times: number): void;
1368
+ toHaveBeenCalledOnce(): void;
1369
+ toHaveBeenCalled(): void;
1370
+ toBeCalled(): void;
1371
+ toHaveBeenCalledWith<E extends any[]>(...args: E): void;
1372
+ toBeCalledWith<E extends any[]>(...args: E): void;
1373
+ toHaveBeenNthCalledWith<E extends any[]>(n: number, ...args: E): void;
1374
+ nthCalledWith<E extends any[]>(nthCall: number, ...args: E): void;
1375
+ toHaveBeenLastCalledWith<E extends any[]>(...args: E): void;
1376
+ lastCalledWith<E extends any[]>(...args: E): void;
1377
+ toThrow(expected?: string | Constructable | RegExp | Error): void;
1378
+ toThrowError(expected?: string | Constructable | RegExp | Error): void;
1379
+ toReturn(): void;
1380
+ toHaveReturned(): void;
1381
+ toReturnTimes(times: number): void;
1382
+ toHaveReturnedTimes(times: number): void;
1383
+ toReturnWith<E>(value: E): void;
1384
+ toHaveReturnedWith<E>(value: E): void;
1385
+ toHaveLastReturnedWith<E>(value: E): void;
1386
+ lastReturnedWith<E>(value: E): void;
1387
+ toHaveNthReturnedWith<E>(nthCall: number, value: E): void;
1388
+ nthReturnedWith<E>(nthCall: number, value: E): void;
1389
+ toSatisfy<E>(matcher: (value: E) => boolean, message?: string): void;
1390
+ }
1391
+ type VitestAssertion<A, T> = {
1392
+ [K in keyof A]: A[K] extends Chai.Assertion ? Assertion<T> : A[K] extends (...args: any[]) => any ? A[K] : VitestAssertion<A[K], T>;
1393
+ } & ((type: string, message?: string) => Assertion);
1394
+ interface Assertion<T = any> extends VitestAssertion<Chai.Assertion, T>, JestAssertion<T> {
1395
+ resolves: Promisify<Assertion<T>>;
1396
+ rejects: Promisify<Assertion<T>>;
1397
+ }
1398
+ }
1399
+ }
1400
+
1295
1401
  declare type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
1296
1402
  declare type ReturnType$1<T> = T extends (...args: any) => infer R ? R : never;
1297
1403
  interface BirpcFn<T> {
@@ -1339,40 +1445,6 @@ interface WorkerGlobalState {
1339
1445
  mockMap: MockMap;
1340
1446
  }
1341
1447
 
1342
- declare const suite: SuiteAPI<{}>;
1343
- declare const test: TestAPI<{}>;
1344
- declare const describe: SuiteAPI<{}>;
1345
- declare const it: TestAPI<{}>;
1346
-
1347
- declare const beforeAll: (fn: SuiteHooks['beforeAll'][0], timeout?: number | undefined) => void;
1348
- declare const afterAll: (fn: SuiteHooks['afterAll'][0], timeout?: number | undefined) => void;
1349
- declare const beforeEach: (fn: SuiteHooks['beforeEach'][0], timeout?: number | undefined) => void;
1350
- declare const afterEach: (fn: SuiteHooks['afterEach'][0], timeout?: number | undefined) => void;
1351
-
1352
- /**
1353
- * A simple wrapper for converting callback style to promise
1354
- */
1355
- declare function withCallback(fn: (done: DoneCallback) => void): Promise<void>;
1356
-
1357
- /**
1358
- * This utils allows computational intensive tasks to only be ran once
1359
- * across test reruns to improve the watch mode performance.
1360
- *
1361
- * Currently only works with `isolate: false`
1362
- *
1363
- * @experimental
1364
- */
1365
- declare function runOnce<T>(fn: (() => T), key?: string): T;
1366
- /**
1367
- * Get a boolean indicates whether the task is running in the first time.
1368
- * Could only be `false` in watch mode.
1369
- *
1370
- * Currently only works with `isolate: false`
1371
- *
1372
- * @experimental
1373
- */
1374
- declare function isFirstRun(): boolean;
1375
-
1376
1448
  interface MockResultReturn<T> {
1377
1449
  type: 'return';
1378
1450
  value: T;
@@ -1453,6 +1525,40 @@ declare function spyOn<T, M extends (Methods<Required<T>> | Classes<Required<T>>
1453
1525
  declare function fn<TArgs extends any[] = any[], R = any>(): SpyInstanceFn<TArgs, R>;
1454
1526
  declare function fn<TArgs extends any[] = any[], R = any>(implementation: (...args: TArgs) => R): SpyInstanceFn<TArgs, R>;
1455
1527
 
1528
+ declare const suite: SuiteAPI<{}>;
1529
+ declare const test: TestAPI<{}>;
1530
+ declare const describe: SuiteAPI<{}>;
1531
+ declare const it: TestAPI<{}>;
1532
+
1533
+ declare const beforeAll: (fn: SuiteHooks['beforeAll'][0], timeout?: number | undefined) => void;
1534
+ declare const afterAll: (fn: SuiteHooks['afterAll'][0], timeout?: number | undefined) => void;
1535
+ declare const beforeEach: (fn: SuiteHooks['beforeEach'][0], timeout?: number | undefined) => void;
1536
+ declare const afterEach: (fn: SuiteHooks['afterEach'][0], timeout?: number | undefined) => void;
1537
+
1538
+ /**
1539
+ * A simple wrapper for converting callback style to promise
1540
+ */
1541
+ declare function withCallback(fn: (done: DoneCallback) => void): Promise<void>;
1542
+
1543
+ /**
1544
+ * This utils allows computational intensive tasks to only be ran once
1545
+ * across test reruns to improve the watch mode performance.
1546
+ *
1547
+ * Currently only works with `isolate: false`
1548
+ *
1549
+ * @experimental
1550
+ */
1551
+ declare function runOnce<T>(fn: (() => T), key?: string): T;
1552
+ /**
1553
+ * Get a boolean indicates whether the task is running in the first time.
1554
+ * Could only be `false` in watch mode.
1555
+ *
1556
+ * Currently only works with `isolate: false`
1557
+ *
1558
+ * @experimental
1559
+ */
1560
+ declare function isFirstRun(): boolean;
1561
+
1456
1562
  declare function createExpect(test?: Test): Vi.ExpectStatic;
1457
1563
  declare const expect: Vi.ExpectStatic;
1458
1564
 
@@ -1568,112 +1674,4 @@ interface WebSocketHandlers {
1568
1674
  interface WebSocketEvents extends Pick<Reporter, 'onCollected' | 'onFinished' | 'onTaskUpdate' | 'onUserConsoleLog'> {
1569
1675
  }
1570
1676
 
1571
- declare type VitestInlineConfig = InlineConfig;
1572
- declare module 'vite' {
1573
- interface UserConfig {
1574
- /**
1575
- * Options for Vitest
1576
- */
1577
- test?: VitestInlineConfig;
1578
- }
1579
- }
1580
- declare type Promisify<O> = {
1581
- [K in keyof O]: O[K] extends (...args: infer A) => infer R ? O extends R ? Promisify<O[K]> : (...args: A) => Promise<R> : O[K];
1582
- };
1583
- declare global {
1584
- namespace jest {
1585
- interface Matchers<R, T = {}> {
1586
- }
1587
- }
1588
- namespace Vi {
1589
- interface ExpectStatic extends Chai.ExpectStatic, AsymmetricMatchersContaining {
1590
- <T>(actual: T, message?: string): Vi.Assertion<T>;
1591
- extend(expects: MatchersObject): void;
1592
- assertions(expected: number): void;
1593
- hasAssertions(): void;
1594
- anything(): any;
1595
- any(constructor: unknown): any;
1596
- addSnapshotSerializer(plugin: Plugin): void;
1597
- getState(): MatcherState;
1598
- setState(state: Partial<MatcherState>): void;
1599
- not: AsymmetricMatchersContaining;
1600
- }
1601
- interface AsymmetricMatchersContaining {
1602
- stringContaining(expected: string): any;
1603
- objectContaining(expected: any): any;
1604
- arrayContaining<T = unknown>(expected: Array<T>): any;
1605
- stringMatching(expected: string | RegExp): any;
1606
- }
1607
- interface JestAssertion<T = any> extends jest.Matchers<void, T> {
1608
- toMatchSnapshot<U extends {
1609
- [P in keyof T]: any;
1610
- }>(snapshot: Partial<U>, message?: string): void;
1611
- toMatchSnapshot(message?: string): void;
1612
- matchSnapshot<U extends {
1613
- [P in keyof T]: any;
1614
- }>(snapshot: Partial<U>, message?: string): void;
1615
- matchSnapshot(message?: string): void;
1616
- toMatchInlineSnapshot<U extends {
1617
- [P in keyof T]: any;
1618
- }>(properties: Partial<U>, snapshot?: string, message?: string): void;
1619
- toMatchInlineSnapshot(snapshot?: string, message?: string): void;
1620
- toThrowErrorMatchingSnapshot(message?: string): void;
1621
- toThrowErrorMatchingInlineSnapshot(snapshot?: string, message?: string): void;
1622
- toEqual<E>(expected: E): void;
1623
- toStrictEqual<E>(expected: E): void;
1624
- toBe<E>(expected: E): void;
1625
- toMatch(expected: string | RegExp): void;
1626
- toMatchObject<E extends {} | any[]>(expected: E): void;
1627
- toContain<E>(item: E): void;
1628
- toContainEqual<E>(item: E): void;
1629
- toBeTruthy(): void;
1630
- toBeFalsy(): void;
1631
- toBeGreaterThan(num: number | bigint): void;
1632
- toBeGreaterThanOrEqual(num: number | bigint): void;
1633
- toBeLessThan(num: number | bigint): void;
1634
- toBeLessThanOrEqual(num: number | bigint): void;
1635
- toBeNaN(): void;
1636
- toBeUndefined(): void;
1637
- toBeNull(): void;
1638
- toBeDefined(): void;
1639
- toBeTypeOf(expected: 'bigint' | 'boolean' | 'function' | 'number' | 'object' | 'string' | 'symbol' | 'undefined'): void;
1640
- toBeInstanceOf<E>(expected: E): void;
1641
- toBeCalledTimes(times: number): void;
1642
- toHaveLength(length: number): void;
1643
- toHaveProperty<E>(property: string | string[], value?: E): void;
1644
- toBeCloseTo(number: number, numDigits?: number): void;
1645
- toHaveBeenCalledTimes(times: number): void;
1646
- toHaveBeenCalledOnce(): void;
1647
- toHaveBeenCalled(): void;
1648
- toBeCalled(): void;
1649
- toHaveBeenCalledWith<E extends any[]>(...args: E): void;
1650
- toBeCalledWith<E extends any[]>(...args: E): void;
1651
- toHaveBeenNthCalledWith<E extends any[]>(n: number, ...args: E): void;
1652
- nthCalledWith<E extends any[]>(nthCall: number, ...args: E): void;
1653
- toHaveBeenLastCalledWith<E extends any[]>(...args: E): void;
1654
- lastCalledWith<E extends any[]>(...args: E): void;
1655
- toThrow(expected?: string | Constructable | RegExp | Error): void;
1656
- toThrowError(expected?: string | Constructable | RegExp | Error): void;
1657
- toReturn(): void;
1658
- toHaveReturned(): void;
1659
- toReturnTimes(times: number): void;
1660
- toHaveReturnedTimes(times: number): void;
1661
- toReturnWith<E>(value: E): void;
1662
- toHaveReturnedWith<E>(value: E): void;
1663
- toHaveLastReturnedWith<E>(value: E): void;
1664
- lastReturnedWith<E>(value: E): void;
1665
- toHaveNthReturnedWith<E>(nthCall: number, value: E): void;
1666
- nthReturnedWith<E>(nthCall: number, value: E): void;
1667
- toSatisfy<E>(matcher: (value: E) => boolean, message?: string): void;
1668
- }
1669
- type VitestAssertion<A, T> = {
1670
- [K in keyof A]: A[K] extends Chai.Assertion ? Assertion<T> : A[K] extends (...args: any[]) => any ? A[K] : VitestAssertion<A[K], T>;
1671
- } & ((type: string, message?: string) => Assertion);
1672
- interface Assertion<T = any> extends VitestAssertion<Chai.Assertion, T>, JestAssertion<T> {
1673
- resolves: Promisify<Assertion<T>>;
1674
- rejects: Promisify<Assertion<T>>;
1675
- }
1676
- }
1677
- }
1678
-
1679
1677
  export { ApiConfig, ArgumentsType$1 as ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, C8Options, Constructable, CoverageReporter, DeepMerge, DoneCallback, EnhancedSpy, Environment, EnvironmentOptions, EnvironmentReturn, ErrorWithDiff, File, HookCleanupCallback, 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, TestContext, TestFunction, TransformResultWithSource, UncheckedSnapshot, UserConfig, UserConsoleLog, Vitest, WebSocketEvents, WebSocketHandlers, WorkerContext, WorkerGlobalState, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, createExpect, describe, expect, getRunningMode, isFirstRun, isWatchMode, it, runOnce, suite, test, vi, vitest, withCallback };
package/dist/index.js CHANGED
@@ -1,12 +1,13 @@
1
- export { c as afterAll, f as afterEach, b as beforeAll, e as beforeEach, g as createExpect, d as describe, h as expect, k as getRunningMode, a as isFirstRun, l as isWatchMode, i as it, r as runOnce, s as suite, t as test, j as vi, v as vitest, w as withCallback } from './chunk-runtime-chain.eb563278.js';
1
+ export { c as afterAll, f as afterEach, b as beforeAll, e as beforeEach, g as createExpect, d as describe, h as expect, k as getRunningMode, a as isFirstRun, l as isWatchMode, i as it, r as runOnce, s as suite, t as test, j as vi, v as vitest, w as withCallback } from './chunk-runtime-chain.5021a6b6.js';
2
2
  export { assert, default as chai, should } from 'chai';
3
- import './chunk-utils-global.03413604.js';
3
+ import './vendor-_commonjsHelpers.addc3445.js';
4
+ import './chunk-runtime-rpc.47bae3f9.js';
5
+ import './chunk-utils-global.2fab7e5c.js';
4
6
  import 'tty';
5
7
  import 'local-pkg';
6
8
  import 'path';
7
- import './chunk-runtime-rpc.ef131645.js';
8
9
  import 'fs';
9
- import './chunk-utils-timers.a0f0fe66.js';
10
+ import './chunk-utils-timers.da6ac0a6.js';
10
11
  import './chunk-integrations-spy.bee66426.js';
11
12
  import 'tinyspy';
12
13
  import 'util';