vitest 0.1.20 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/dist/cli.js +10 -11
- package/dist/create-59a8f7ed.js +9150 -0
- package/dist/diff-1f9491ae.js +1367 -0
- package/dist/entry.js +47 -12
- package/dist/{globals-862e8d31.js → globals-7409dbab.js} +5 -4
- package/dist/{index-34e48ae9.js → index-80a227f0.js} +2 -2
- package/dist/index-ba307c22.js +9255 -0
- package/dist/{index-32c8ccbd.js → index-cd6f3933.js} +2 -2
- package/dist/index.d.ts +18 -16
- package/dist/index.js +5 -4
- package/dist/node.d.ts +13 -15
- package/dist/node.js +6 -5
- package/dist/{setup-bd3957d1.js → setup-c3de8512.js} +4 -4
- package/dist/source-map-6a5e2318.js +3407 -0
- package/dist/{vi-a1478189.js → vi-15ee265f.js} +24 -7
- package/dist/worker.js +231 -187
- package/package.json +10 -11
- package/dist/create-3bc3fb6a.js +0 -9160
- package/dist/diff-cec3bc6d.js +0 -4749
- package/dist/index-058a289b.js +0 -9255
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, b as getState, s as setState, c as suite, t as test, d as describe, i as it, v as vitest, e as vi } from './vi-
|
|
1
|
+
import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, b as getState, s as setState, c as suite, t as test, d as describe, i as it, v as vitest, e as vi } from './vi-15ee265f.js';
|
|
2
2
|
import chai, { assert, should } from 'chai';
|
|
3
3
|
import { s as spies, i as isMockFunction, a as spyOn, f as fn } from './jest-mock-113430de.js';
|
|
4
4
|
|
|
@@ -39,4 +39,4 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
export { afterAll as a, beforeAll as b, beforeEach as c, afterEach as d, expect as e, index as i };
|
|
42
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
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BQyxNQUFNLENBQUM7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsifQ==
|
package/dist/index.d.ts
CHANGED
|
@@ -228,19 +228,6 @@ declare class Any extends AsymmetricMatcher<any> {
|
|
|
228
228
|
toAsymmetricMatcher(): string;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
interface StartOfSourceMap {
|
|
232
|
-
file?: string;
|
|
233
|
-
sourceRoot?: string;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
interface RawSourceMap extends StartOfSourceMap {
|
|
237
|
-
version: string;
|
|
238
|
-
sources: string[];
|
|
239
|
-
names: string[];
|
|
240
|
-
sourcesContent?: string[];
|
|
241
|
-
mappings: string;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
231
|
interface DepsHandlingOptions {
|
|
245
232
|
external?: (string | RegExp)[];
|
|
246
233
|
inline?: (string | RegExp)[];
|
|
@@ -365,7 +352,7 @@ declare class Vitest {
|
|
|
365
352
|
private registerWatcher;
|
|
366
353
|
private handleFileChanged;
|
|
367
354
|
close(): Promise<void>;
|
|
368
|
-
exit(): Promise<void>;
|
|
355
|
+
exit(force?: boolean): Promise<void>;
|
|
369
356
|
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
|
|
370
357
|
globTestFiles(filters?: string[]): Promise<string[]>;
|
|
371
358
|
isTargetFile(id: string): boolean;
|
|
@@ -669,6 +656,17 @@ interface ModuleGraphData {
|
|
|
669
656
|
externalized: string[];
|
|
670
657
|
inlined: string[];
|
|
671
658
|
}
|
|
659
|
+
interface StartOfSourceMap {
|
|
660
|
+
file?: string;
|
|
661
|
+
sourceRoot?: string;
|
|
662
|
+
}
|
|
663
|
+
interface RawSourceMap extends StartOfSourceMap {
|
|
664
|
+
version: string;
|
|
665
|
+
sources: string[];
|
|
666
|
+
names: string[];
|
|
667
|
+
sourcesContent?: string[];
|
|
668
|
+
mappings: string;
|
|
669
|
+
}
|
|
672
670
|
|
|
673
671
|
declare type ChainableFunction<T extends string, Args extends any[], R = any> = {
|
|
674
672
|
(...args: Args): R;
|
|
@@ -841,7 +839,7 @@ interface InlineConfig {
|
|
|
841
839
|
*
|
|
842
840
|
* @default true
|
|
843
841
|
*/
|
|
844
|
-
|
|
842
|
+
interopDefault?: boolean;
|
|
845
843
|
/**
|
|
846
844
|
* When a dependency is a valid ESM package, try to guess the cjs version based on the path.
|
|
847
845
|
* This will significantly improve the performance in huge repo, but might potentially
|
|
@@ -1187,6 +1185,7 @@ declare function fn<TArgs extends any[] = any[], R = any>(implementation: (...ar
|
|
|
1187
1185
|
declare class VitestUtils {
|
|
1188
1186
|
private _timers;
|
|
1189
1187
|
private _mockedDate;
|
|
1188
|
+
private _mocker;
|
|
1190
1189
|
constructor();
|
|
1191
1190
|
useFakeTimers(): void;
|
|
1192
1191
|
useRealTimers(): void;
|
|
@@ -1200,6 +1199,7 @@ declare class VitestUtils {
|
|
|
1200
1199
|
getMockedDate(): string | number | Date | null;
|
|
1201
1200
|
spyOn: typeof spyOn;
|
|
1202
1201
|
fn: typeof fn;
|
|
1202
|
+
private getImporter;
|
|
1203
1203
|
/**
|
|
1204
1204
|
* Makes all `imports` to passed module to be mocked.
|
|
1205
1205
|
* - If there is a factory, will return it's result. The call to `vi.mock` is hoisted to the top of the file,
|
|
@@ -1218,6 +1218,8 @@ declare class VitestUtils {
|
|
|
1218
1218
|
* @param path Path to the module. Can be aliased, if your config suppors it
|
|
1219
1219
|
*/
|
|
1220
1220
|
unmock(path: string): void;
|
|
1221
|
+
doMock(path: string, factory?: () => any): void;
|
|
1222
|
+
doUnmock(path: string): void;
|
|
1221
1223
|
/**
|
|
1222
1224
|
* Imports module, bypassing all checks if it should be mocked.
|
|
1223
1225
|
* Can be useful if you want to mock module partially.
|
|
@@ -1384,4 +1386,4 @@ declare global {
|
|
|
1384
1386
|
}
|
|
1385
1387
|
}
|
|
1386
1388
|
|
|
1387
|
-
export { ApiConfig, ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, Constructable, DeepMerge, DoneCallback, EnhancedSpy, Environment, EnvironmentOptions, EnvironmentReturn, ErrorWithDiff, FetchFunction, File, HookListener, InlineConfig, JSDOMOptions, JestMockCompat, JestMockCompatContext, JestMockCompatFn, MaybeMocked, MaybeMockedConstructor, MaybeMockedDeep, MergeInsertions, MockWithArgs, MockedFunction, MockedFunctionDeep, MockedObject, MockedObjectDeep, ModuleCache, ModuleGraphData, Nullable, ParsedStack, Position, Reporter, ResolveIdFunction, ResolvedConfig, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, Suite, SuiteCollector, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestCollector, TestFactory, TestFunction, TransformResultWithSource, UncheckedSnapshot, UserConfig, UserConsoleLog, WebSocketEvents, WebSocketHandlers, WorkerContext, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, describe, expect, fn, isMockFunction, it, spies, spyOn, suite, test, vi, vitest };
|
|
1389
|
+
export { ApiConfig, ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, Constructable, DeepMerge, DoneCallback, EnhancedSpy, Environment, EnvironmentOptions, EnvironmentReturn, ErrorWithDiff, FetchFunction, File, HookListener, InlineConfig, JSDOMOptions, JestMockCompat, JestMockCompatContext, JestMockCompatFn, MaybeMocked, MaybeMockedConstructor, MaybeMockedDeep, MergeInsertions, MockWithArgs, MockedFunction, MockedFunctionDeep, MockedObject, MockedObjectDeep, ModuleCache, ModuleGraphData, Nullable, ParsedStack, Position, RawSourceMap, Reporter, ResolveIdFunction, ResolvedConfig, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, StartOfSourceMap, Suite, SuiteCollector, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestCollector, TestFactory, TestFunction, TransformResultWithSource, UncheckedSnapshot, UserConfig, UserConsoleLog, WebSocketEvents, WebSocketHandlers, WorkerContext, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, describe, expect, fn, isMockFunction, it, spies, spyOn, suite, test, vi, vitest };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export { d as describe, i as it, c as suite, t as test, e as vi, v as vitest } from './vi-
|
|
2
|
-
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, e as expect } from './index-
|
|
1
|
+
export { d as describe, i as it, c as suite, t as test, e as vi, v as vitest } from './vi-15ee265f.js';
|
|
2
|
+
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, e as expect } from './index-cd6f3933.js';
|
|
3
3
|
export { f as fn, i as isMockFunction, s as spies, a as spyOn } from './jest-mock-113430de.js';
|
|
4
4
|
export { assert, default as chai, should } from 'chai';
|
|
5
|
-
import './index-
|
|
5
|
+
import './index-80a227f0.js';
|
|
6
6
|
import 'tty';
|
|
7
7
|
import 'local-pkg';
|
|
8
8
|
import './_commonjsHelpers-c9e3b764.js';
|
|
9
|
+
import './source-map-6a5e2318.js';
|
|
9
10
|
import 'tinyspy';
|
|
10
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
11
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7In0=
|
package/dist/node.d.ts
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
import { ViteDevServer, TransformResult, CommonServerOptions, UserConfig as UserConfig$1, Plugin as Plugin$1 } from 'vite';
|
|
2
2
|
|
|
3
|
-
interface StartOfSourceMap {
|
|
4
|
-
file?: string;
|
|
5
|
-
sourceRoot?: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
interface RawSourceMap extends StartOfSourceMap {
|
|
9
|
-
version: string;
|
|
10
|
-
sources: string[];
|
|
11
|
-
names: string[];
|
|
12
|
-
sourcesContent?: string[];
|
|
13
|
-
mappings: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
3
|
interface DepsHandlingOptions {
|
|
17
4
|
external?: (string | RegExp)[];
|
|
18
5
|
inline?: (string | RegExp)[];
|
|
@@ -424,6 +411,17 @@ interface ErrorWithDiff extends Error {
|
|
|
424
411
|
expected?: any;
|
|
425
412
|
operator?: string;
|
|
426
413
|
}
|
|
414
|
+
interface StartOfSourceMap {
|
|
415
|
+
file?: string;
|
|
416
|
+
sourceRoot?: string;
|
|
417
|
+
}
|
|
418
|
+
interface RawSourceMap extends StartOfSourceMap {
|
|
419
|
+
version: string;
|
|
420
|
+
sources: string[];
|
|
421
|
+
names: string[];
|
|
422
|
+
sourcesContent?: string[];
|
|
423
|
+
mappings: string;
|
|
424
|
+
}
|
|
427
425
|
|
|
428
426
|
declare type RunMode = 'run' | 'skip' | 'only' | 'todo';
|
|
429
427
|
declare type TaskState = RunMode | 'pass' | 'fail';
|
|
@@ -552,7 +550,7 @@ interface InlineConfig {
|
|
|
552
550
|
*
|
|
553
551
|
* @default true
|
|
554
552
|
*/
|
|
555
|
-
|
|
553
|
+
interopDefault?: boolean;
|
|
556
554
|
/**
|
|
557
555
|
* When a dependency is a valid ESM package, try to guess the cjs version based on the path.
|
|
558
556
|
* This will significantly improve the performance in huge repo, but might potentially
|
|
@@ -842,7 +840,7 @@ declare class Vitest {
|
|
|
842
840
|
private registerWatcher;
|
|
843
841
|
private handleFileChanged;
|
|
844
842
|
close(): Promise<void>;
|
|
845
|
-
exit(): Promise<void>;
|
|
843
|
+
exit(force?: boolean): Promise<void>;
|
|
846
844
|
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
|
|
847
845
|
globTestFiles(filters?: string[]): Promise<string[]>;
|
|
848
846
|
isTargetFile(id: string): boolean;
|
package/dist/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { V as VitestPlugin, c as createVitest } from './create-
|
|
1
|
+
export { V as VitestPlugin, c as createVitest } from './create-59a8f7ed.js';
|
|
2
2
|
import './index-1964368a.js';
|
|
3
3
|
import 'path';
|
|
4
4
|
import 'vite';
|
|
@@ -10,17 +10,18 @@ import 'os';
|
|
|
10
10
|
import 'util';
|
|
11
11
|
import 'stream';
|
|
12
12
|
import 'events';
|
|
13
|
-
import './index-
|
|
13
|
+
import './index-80a227f0.js';
|
|
14
14
|
import 'tty';
|
|
15
15
|
import 'local-pkg';
|
|
16
|
-
import './index-
|
|
16
|
+
import './index-ba307c22.js';
|
|
17
17
|
import 'module';
|
|
18
18
|
import 'assert';
|
|
19
19
|
import 'perf_hooks';
|
|
20
|
-
import './diff-
|
|
20
|
+
import './diff-1f9491ae.js';
|
|
21
|
+
import './source-map-6a5e2318.js';
|
|
21
22
|
import './index-648e7ab2.js';
|
|
22
23
|
import './_commonjsHelpers-c9e3b764.js';
|
|
23
24
|
import 'worker_threads';
|
|
24
25
|
import 'tinypool';
|
|
25
26
|
import './magic-string.es-94000aea.js';
|
|
26
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
27
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZS5qcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7In0=
|