vitest 0.2.3 → 0.2.4
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 +29 -0
- package/dist/{_commonjsHelpers-bdec4bbd.js → _commonjsHelpers-c9e3b764.js} +6 -2
- package/dist/cli.js +12 -11
- package/dist/client-f15310bf.js +9442 -0
- package/dist/{create-b3e0df3f.js → create-2c5e5720.js} +35 -39
- package/dist/{diff-abc9f1a4.js → diff-6be0541d.js} +3 -3
- package/dist/entry.js +20 -16
- package/dist/{globals-67f38862.js → globals-19399ded.js} +7 -7
- package/dist/{index-87602a5a.js → index-043440ae.js} +2 -2
- package/dist/{index-825cb54c.js → index-61c8686f.js} +2 -2
- package/dist/{index-0c3a317d.js → index-9f4b9905.js} +3 -3
- package/dist/{index-6102d563.js → index-bffba653.js} +2 -2
- package/dist/index.d.ts +28 -13
- package/dist/index.js +6 -6
- package/dist/node.d.ts +8 -2
- package/dist/node.js +9 -8
- package/dist/setup-d961d28c.js +4402 -0
- package/dist/{source-map-002462f4.js → source-map-1132e742.js} +2 -2
- package/dist/vi-ed2bce6b.js +5901 -0
- package/dist/worker.js +7 -159
- package/package.json +15 -14
- package/dist/index-1085cee5.js +0 -9288
- package/dist/setup-0edb4bff.js +0 -4389
- package/dist/vi-7f0c5d26.js +0 -5750
|
@@ -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-ed2bce6b.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,
|
|
42
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXgtYmZmYmE2NTMuanMiLCJzb3VyY2VzIjpbIi4uL3NyYy9ydW50aW1lL2hvb2tzLnRzIiwiLi4vc3JjL2ludGVncmF0aW9ucy9jaGFpL2luZGV4LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgU3VpdGVIb29rcyB9IGZyb20gJy4uL3R5cGVzJ1xuaW1wb3J0IHsgZ2V0RGVmYXVsdEhvb2tUaW1lb3V0LCB3aXRoVGltZW91dCB9IGZyb20gJy4vY29udGV4dCdcbmltcG9ydCB7IGdldEN1cnJlbnRTdWl0ZSB9IGZyb20gJy4vc3VpdGUnXG5cbi8vIHN1aXRlIGhvb2tzXG5leHBvcnQgY29uc3QgYmVmb3JlQWxsID0gKGZuOiBTdWl0ZUhvb2tzWydiZWZvcmVBbGwnXVswXSwgdGltZW91dD86IG51bWJlcikgPT4gZ2V0Q3VycmVudFN1aXRlKCkub24oJ2JlZm9yZUFsbCcsIHdpdGhUaW1lb3V0KGZuLCB0aW1lb3V0ID8/IGdldERlZmF1bHRIb29rVGltZW91dCgpKSlcbmV4cG9ydCBjb25zdCBhZnRlckFsbCA9IChmbjogU3VpdGVIb29rc1snYWZ0ZXJBbGwnXVswXSwgdGltZW91dD86IG51bWJlcikgPT4gZ2V0Q3VycmVudFN1aXRlKCkub24oJ2FmdGVyQWxsJywgd2l0aFRpbWVvdXQoZm4sIHRpbWVvdXQgPz8gZ2V0RGVmYXVsdEhvb2tUaW1lb3V0KCkpKVxuZXhwb3J0IGNvbnN0IGJlZm9yZUVhY2ggPSAoZm46IFN1aXRlSG9va3NbJ2J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0FBQ0YsTUFBTSxDQUFDLFFBQVEsR0FBRyxRQUFRLENBQUM7QUFDM0IsTUFBTSxDQUFDLFFBQVEsR0FBRyxRQUFRLENBQUM7QUFDM0IsTUFBTSxDQUFDLE1BQU0sQ0FBQyxNQUFNLEVBQUUsSUFBSSxDQUFDLE1BQU0sQ0FBQzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9
|
package/dist/index.d.ts
CHANGED
|
@@ -714,11 +714,20 @@ interface Test extends TaskBase {
|
|
|
714
714
|
declare type Task = Test | Suite | File;
|
|
715
715
|
declare type DoneCallback = (error?: any) => void;
|
|
716
716
|
declare type TestFunction = (done: DoneCallback) => Awaitable<void>;
|
|
717
|
-
declare type
|
|
717
|
+
declare type EachFunction = <T>(cases: T[]) => (name: string, fn: (...args: T extends any[] ? T : [T]) => void) => void;
|
|
718
|
+
declare type TestAPI = ChainableFunction<'concurrent' | 'only' | 'skip' | 'todo' | 'fails', [
|
|
718
719
|
name: string,
|
|
719
720
|
fn?: TestFunction,
|
|
720
721
|
timeout?: number
|
|
721
|
-
], void
|
|
722
|
+
], void> & {
|
|
723
|
+
each: EachFunction;
|
|
724
|
+
};
|
|
725
|
+
declare type SuiteAPI = ChainableFunction<'concurrent' | 'only' | 'skip' | 'todo', [
|
|
726
|
+
name: string,
|
|
727
|
+
factory?: SuiteFactory
|
|
728
|
+
], SuiteCollector> & {
|
|
729
|
+
each: EachFunction;
|
|
730
|
+
};
|
|
722
731
|
declare type HookListener<T extends any[]> = (...args: T) => Awaitable<void>;
|
|
723
732
|
interface SuiteHooks {
|
|
724
733
|
beforeAll: HookListener<[Suite]>[];
|
|
@@ -730,13 +739,13 @@ interface SuiteCollector {
|
|
|
730
739
|
readonly name: string;
|
|
731
740
|
readonly mode: RunMode;
|
|
732
741
|
type: 'collector';
|
|
733
|
-
test:
|
|
742
|
+
test: TestAPI;
|
|
734
743
|
tasks: (Suite | Test | SuiteCollector)[];
|
|
735
744
|
collect: (file?: File) => Promise<Suite>;
|
|
736
745
|
clear: () => void;
|
|
737
746
|
on: <T extends keyof SuiteHooks>(name: T, ...fn: SuiteHooks[T]) => void;
|
|
738
747
|
}
|
|
739
|
-
declare type
|
|
748
|
+
declare type SuiteFactory = (test: (name: string, fn: TestFunction) => void) => Awaitable<void>;
|
|
740
749
|
interface RuntimeContext {
|
|
741
750
|
tasks: (SuiteCollector | Test)[];
|
|
742
751
|
currentSuite: SuiteCollector | null;
|
|
@@ -990,10 +999,16 @@ interface InlineConfig {
|
|
|
990
999
|
*/
|
|
991
1000
|
api?: boolean | number | ApiConfig;
|
|
992
1001
|
/**
|
|
993
|
-
*
|
|
1002
|
+
* Enable Vitest UI
|
|
994
1003
|
* @internal WIP
|
|
995
1004
|
*/
|
|
996
1005
|
ui?: boolean;
|
|
1006
|
+
/**
|
|
1007
|
+
* Open UI automatically.
|
|
1008
|
+
*
|
|
1009
|
+
* @default true
|
|
1010
|
+
*/
|
|
1011
|
+
open?: boolean;
|
|
997
1012
|
/**
|
|
998
1013
|
* Base url for the UI
|
|
999
1014
|
*
|
|
@@ -1097,10 +1112,10 @@ interface WorkerRPC {
|
|
|
1097
1112
|
coverageCollected: (coverage: Profiler.TakePreciseCoverageReturnType) => void;
|
|
1098
1113
|
}
|
|
1099
1114
|
|
|
1100
|
-
declare const suite:
|
|
1101
|
-
declare const test:
|
|
1102
|
-
declare const describe:
|
|
1103
|
-
declare const it:
|
|
1115
|
+
declare const suite: SuiteAPI;
|
|
1116
|
+
declare const test: TestAPI;
|
|
1117
|
+
declare const describe: SuiteAPI;
|
|
1118
|
+
declare const it: TestAPI;
|
|
1104
1119
|
|
|
1105
1120
|
declare const beforeAll: (fn: SuiteHooks['beforeAll'][0], timeout?: number | undefined) => void;
|
|
1106
1121
|
declare const afterAll: (fn: SuiteHooks['afterAll'][0], timeout?: number | undefined) => void;
|
|
@@ -1385,14 +1400,14 @@ declare global {
|
|
|
1385
1400
|
toHaveNthReturnedWith<E>(nthCall: number, value: E): void;
|
|
1386
1401
|
nthReturnedWith<E>(nthCall: number, value: E): void;
|
|
1387
1402
|
}
|
|
1388
|
-
type
|
|
1389
|
-
[K in keyof A]: A[K] extends Chai.Assertion ? Assertion<any> : A[K] extends (...args: any[]) => any ? A[K] :
|
|
1403
|
+
type VitestAssertion<A> = {
|
|
1404
|
+
[K in keyof A]: A[K] extends Chai.Assertion ? Assertion<any> : A[K] extends (...args: any[]) => any ? A[K] : VitestAssertion<A[K]>;
|
|
1390
1405
|
};
|
|
1391
|
-
interface Assertion<T = any> extends
|
|
1406
|
+
interface Assertion<T = any> extends VitestAssertion<Chai.Assertion>, JestAssertion<T> {
|
|
1392
1407
|
resolves: Promisify<Assertion<T>>;
|
|
1393
1408
|
rejects: Promisify<Assertion<T>>;
|
|
1394
1409
|
}
|
|
1395
1410
|
}
|
|
1396
1411
|
}
|
|
1397
1412
|
|
|
1398
|
-
export { ApiConfig, ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, Constructable, DeepMerge, DoneCallback, EnhancedSpy, Environment, EnvironmentOptions, EnvironmentReturn, ErrorWithDiff, File, HookListener, InlineConfig, JSDOMOptions, JestMockCompatContext, 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, SpyInstance, SpyInstanceFn, StartOfSourceMap, Suite, SuiteCollector, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test,
|
|
1413
|
+
export { ApiConfig, ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, Constructable, DeepMerge, DoneCallback, EachFunction, EnhancedSpy, Environment, EnvironmentOptions, EnvironmentReturn, ErrorWithDiff, File, HookListener, InlineConfig, JSDOMOptions, JestMockCompatContext, 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, SpyInstance, SpyInstanceFn, StartOfSourceMap, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestAPI, 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,12 +1,12 @@
|
|
|
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-ed2bce6b.js';
|
|
2
|
+
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, e as expect } from './index-bffba653.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 '
|
|
5
|
+
import 'util';
|
|
6
|
+
import './index-043440ae.js';
|
|
6
7
|
import 'tty';
|
|
7
8
|
import 'local-pkg';
|
|
8
|
-
import './source-map-
|
|
9
|
-
import './_commonjsHelpers-
|
|
10
|
-
import 'util';
|
|
9
|
+
import './source-map-1132e742.js';
|
|
10
|
+
import './_commonjsHelpers-c9e3b764.js';
|
|
11
11
|
import 'tinyspy';
|
|
12
12
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OyJ9
|
package/dist/node.d.ts
CHANGED
|
@@ -698,10 +698,16 @@ interface InlineConfig {
|
|
|
698
698
|
*/
|
|
699
699
|
api?: boolean | number | ApiConfig;
|
|
700
700
|
/**
|
|
701
|
-
*
|
|
701
|
+
* Enable Vitest UI
|
|
702
702
|
* @internal WIP
|
|
703
703
|
*/
|
|
704
704
|
ui?: boolean;
|
|
705
|
+
/**
|
|
706
|
+
* Open UI automatically.
|
|
707
|
+
*
|
|
708
|
+
* @default true
|
|
709
|
+
*/
|
|
710
|
+
open?: boolean;
|
|
705
711
|
/**
|
|
706
712
|
* Base url for the UI
|
|
707
713
|
*
|
|
@@ -855,6 +861,6 @@ declare class Vitest {
|
|
|
855
861
|
|
|
856
862
|
declare function createVitest(options: UserConfig, viteOverrides?: UserConfig$1): Promise<Vitest>;
|
|
857
863
|
|
|
858
|
-
declare function VitestPlugin(options?: UserConfig,
|
|
864
|
+
declare function VitestPlugin(options?: UserConfig, ctx?: Vitest): Promise<Plugin$1[]>;
|
|
859
865
|
|
|
860
866
|
export { Vitest, VitestPlugin, createVitest };
|
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-2c5e5720.js';
|
|
2
2
|
import './index-1964368a.js';
|
|
3
3
|
import 'path';
|
|
4
4
|
import 'vite';
|
|
@@ -10,18 +10,19 @@ import 'os';
|
|
|
10
10
|
import 'util';
|
|
11
11
|
import 'stream';
|
|
12
12
|
import 'events';
|
|
13
|
-
import './index-
|
|
13
|
+
import './index-043440ae.js';
|
|
14
14
|
import 'tty';
|
|
15
15
|
import 'local-pkg';
|
|
16
|
-
import './
|
|
16
|
+
import './client-f15310bf.js';
|
|
17
17
|
import 'module';
|
|
18
18
|
import 'assert';
|
|
19
|
+
import 'vm';
|
|
19
20
|
import 'perf_hooks';
|
|
20
|
-
import './diff-
|
|
21
|
-
import './source-map-
|
|
22
|
-
import './index-
|
|
23
|
-
import './_commonjsHelpers-
|
|
21
|
+
import './diff-6be0541d.js';
|
|
22
|
+
import './source-map-1132e742.js';
|
|
23
|
+
import './index-61c8686f.js';
|
|
24
|
+
import './_commonjsHelpers-c9e3b764.js';
|
|
24
25
|
import 'worker_threads';
|
|
25
26
|
import 'tinypool';
|
|
26
27
|
import './magic-string.es-94000aea.js';
|
|
27
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
28
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZS5qcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9
|