vitest 0.0.114 → 0.0.115
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 +5 -5
- package/dist/cli.js +1107 -31
- package/dist/{constants-9c7f06df.js → constants-5968a78c.js} +1 -1
- package/dist/{diff-3cfdad26.js → diff-67678e1f.js} +1 -1
- package/dist/entry.js +11 -11
- package/dist/{global-12653c72.js → global-bc40af7c.js} +4 -4
- package/dist/{index-61c8686f.js → index-648e7ab2.js} +62 -62
- package/dist/index-6e709f57.js +781 -0
- package/dist/{index-ea5153a0.js → index-7c024e16.js} +27 -2
- package/dist/{index-ebf35a56.js → index-7f57c252.js} +1 -1
- package/dist/{index-36694964.js → index-b4f86684.js} +143 -93
- package/dist/{index-9f4b9905.js → index-ce49e384.js} +33 -800
- package/dist/{index-7889832e.js → index-e909c175.js} +25 -16
- package/dist/index.d.ts +72 -9
- package/dist/index.js +3 -3
- package/dist/{middleware-85ff8fbf.js → middleware-647438b9.js} +2 -2
- package/dist/node.d.ts +70 -7
- package/dist/node.js +8 -7
- package/dist/rpc-8c7cc374.js +5 -0
- package/dist/utils.js +1 -1
- package/dist/{vi-67e478ef.js → vi-2115c609.js} +1 -2
- package/dist/worker.js +8 -7
- package/package.json +3 -2
- package/vitest.mjs +1 -20
- package/dist/rpc-85fe6402.js +0 -10
|
@@ -2,24 +2,25 @@ function createBirpc({
|
|
|
2
2
|
functions,
|
|
3
3
|
post,
|
|
4
4
|
on,
|
|
5
|
+
eventNames = [],
|
|
5
6
|
serialize = (i) => i,
|
|
6
7
|
deserialize = (i) => i
|
|
7
8
|
}) {
|
|
8
9
|
const rpcPromiseMap = /* @__PURE__ */ new Map();
|
|
9
10
|
on(async (data) => {
|
|
10
11
|
const msg = deserialize(data);
|
|
11
|
-
if (msg.
|
|
12
|
-
const { method, args
|
|
12
|
+
if (msg.t === "q") {
|
|
13
|
+
const { m: method, a: args } = msg;
|
|
13
14
|
let result, error;
|
|
14
15
|
try {
|
|
15
16
|
result = await functions[method](...args);
|
|
16
17
|
} catch (e) {
|
|
17
18
|
error = e;
|
|
18
19
|
}
|
|
19
|
-
if (
|
|
20
|
-
|
|
20
|
+
if (msg.i)
|
|
21
|
+
post(serialize({ t: "s", i: msg.i, r: result, e: error }));
|
|
21
22
|
} else {
|
|
22
|
-
const { ack, result, error } = msg;
|
|
23
|
+
const { i: ack, r: result, e: error } = msg;
|
|
23
24
|
const promise = rpcPromiseMap.get(ack);
|
|
24
25
|
if (error)
|
|
25
26
|
promise?.reject(error);
|
|
@@ -28,18 +29,26 @@ function createBirpc({
|
|
|
28
29
|
rpcPromiseMap.delete(ack);
|
|
29
30
|
}
|
|
30
31
|
});
|
|
31
|
-
return {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
return new Proxy({}, {
|
|
33
|
+
get(_, method) {
|
|
34
|
+
const sendEvent = (...args) => {
|
|
35
|
+
post(serialize({ m: method, a: args, t: "q" }));
|
|
36
|
+
};
|
|
37
|
+
if (eventNames.includes(method)) {
|
|
38
|
+
sendEvent.asEvent = sendEvent;
|
|
39
|
+
return sendEvent;
|
|
40
|
+
}
|
|
41
|
+
const sendCall = (...args) => {
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
const id = nanoid();
|
|
44
|
+
rpcPromiseMap.set(id, { resolve, reject });
|
|
45
|
+
post(serialize({ m: method, a: args, i: id, t: "q" }));
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
sendCall.asEvent = sendEvent;
|
|
49
|
+
return sendCall;
|
|
41
50
|
}
|
|
42
|
-
};
|
|
51
|
+
});
|
|
43
52
|
}
|
|
44
53
|
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
45
54
|
function nanoid(size = 21) {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Formatter } from 'picocolors/types';
|
|
|
2
2
|
import { ViteDevServer } from 'vite';
|
|
3
3
|
import { RawSourceMap } from 'source-map-js';
|
|
4
4
|
import { OptionsReceived } from 'pretty-format';
|
|
5
|
+
import { Arrayable as Arrayable$1 } from 'vitest';
|
|
5
6
|
import { MessagePort } from 'worker_threads';
|
|
6
7
|
export { Spy, SpyFn } from 'tinyspy';
|
|
7
8
|
export { assert, default as chai, should } from 'chai';
|
|
@@ -194,6 +195,12 @@ declare class Vitest {
|
|
|
194
195
|
reporters: Reporter[];
|
|
195
196
|
console: Console;
|
|
196
197
|
pool: WorkerPool | undefined;
|
|
198
|
+
outputStream: NodeJS.WriteStream & {
|
|
199
|
+
fd: 1;
|
|
200
|
+
};
|
|
201
|
+
errorStream: NodeJS.WriteStream & {
|
|
202
|
+
fd: 2;
|
|
203
|
+
};
|
|
197
204
|
invalidates: Set<string>;
|
|
198
205
|
changedTests: Set<string>;
|
|
199
206
|
visitedFilesMap: Map<string, RawSourceMap>;
|
|
@@ -202,7 +209,7 @@ declare class Vitest {
|
|
|
202
209
|
restartsCount: number;
|
|
203
210
|
private _onRestartListeners;
|
|
204
211
|
constructor();
|
|
205
|
-
setServer(options: UserConfig, server: ViteDevServer): void
|
|
212
|
+
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
206
213
|
start(filters?: string[]): Promise<void>;
|
|
207
214
|
runFiles(files: string[]): Promise<void>;
|
|
208
215
|
log(...args: any[]): void;
|
|
@@ -215,18 +222,17 @@ declare class Vitest {
|
|
|
215
222
|
close(): Promise<void>;
|
|
216
223
|
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
|
|
217
224
|
globTestFiles(filters?: string[]): Promise<string[]>;
|
|
218
|
-
writeC8Sourcemap(): Promise<void>;
|
|
219
225
|
isTargetFile(id: string): boolean;
|
|
220
226
|
onServerRestarted(fn: () => void): void;
|
|
221
227
|
}
|
|
222
228
|
|
|
223
229
|
declare abstract class BaseReporter implements Reporter {
|
|
224
|
-
ctx: Vitest;
|
|
225
230
|
start: number;
|
|
226
231
|
end: number;
|
|
227
232
|
watchFilters?: string[];
|
|
228
233
|
isTTY: boolean;
|
|
229
|
-
|
|
234
|
+
ctx: Vitest;
|
|
235
|
+
onInit(ctx: Vitest): void;
|
|
230
236
|
relative(path: string): string;
|
|
231
237
|
onFinished(files?: File[]): Promise<void>;
|
|
232
238
|
onTaskUpdate(pack: TaskResultPack): void;
|
|
@@ -241,8 +247,9 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
241
247
|
|
|
242
248
|
interface ListRendererOptions {
|
|
243
249
|
renderSucceed?: boolean;
|
|
250
|
+
outputStream: NodeJS.WritableStream;
|
|
244
251
|
}
|
|
245
|
-
declare const createListRenderer: (_tasks: Task[], options
|
|
252
|
+
declare const createListRenderer: (_tasks: Task[], options: ListRendererOptions) => {
|
|
246
253
|
start(): any;
|
|
247
254
|
update(_tasks: Task[]): any;
|
|
248
255
|
stop(): Promise<any>;
|
|
@@ -271,7 +278,7 @@ declare class DotReporter extends BaseReporter {
|
|
|
271
278
|
}
|
|
272
279
|
|
|
273
280
|
declare class VerboseReporter extends DefaultReporter {
|
|
274
|
-
constructor(
|
|
281
|
+
constructor();
|
|
275
282
|
}
|
|
276
283
|
|
|
277
284
|
declare const ReportersMap: {
|
|
@@ -281,6 +288,56 @@ declare const ReportersMap: {
|
|
|
281
288
|
};
|
|
282
289
|
declare type BuiltinReporters = keyof typeof ReportersMap;
|
|
283
290
|
|
|
291
|
+
declare type Reporter$1 = 'clover' | 'cobertura' | 'html-spa' | 'html' | 'json-summary' | 'json' | 'lcov' | 'lcovonly' | 'none' | 'teamcity' | 'text-lcov' | 'text-summary' | 'text';
|
|
292
|
+
interface C8Options {
|
|
293
|
+
/**
|
|
294
|
+
* Enable coverage, pass `--coverage` to enable
|
|
295
|
+
*
|
|
296
|
+
* @default false
|
|
297
|
+
*/
|
|
298
|
+
enabled?: boolean;
|
|
299
|
+
/**
|
|
300
|
+
* Directory to write coverage report to
|
|
301
|
+
*/
|
|
302
|
+
reportsDirectory?: string;
|
|
303
|
+
/**
|
|
304
|
+
* Clean coverage before running tests
|
|
305
|
+
*
|
|
306
|
+
* @default true
|
|
307
|
+
*/
|
|
308
|
+
clean?: boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Clean coverage report on watch rerun
|
|
311
|
+
*
|
|
312
|
+
* @default false
|
|
313
|
+
*/
|
|
314
|
+
cleanOnRerun?: boolean;
|
|
315
|
+
/**
|
|
316
|
+
* Allow files from outside of your cwd.
|
|
317
|
+
*
|
|
318
|
+
* @default false
|
|
319
|
+
*/
|
|
320
|
+
allowExternal?: any;
|
|
321
|
+
/**
|
|
322
|
+
* Reporters
|
|
323
|
+
*
|
|
324
|
+
* @default 'text'
|
|
325
|
+
*/
|
|
326
|
+
reporter?: Arrayable$1<Reporter$1>;
|
|
327
|
+
/**
|
|
328
|
+
* Exclude coverage under /node_modules/
|
|
329
|
+
*
|
|
330
|
+
* @default true
|
|
331
|
+
*/
|
|
332
|
+
excludeNodeModules?: boolean;
|
|
333
|
+
exclude?: string[];
|
|
334
|
+
include?: string[];
|
|
335
|
+
skipFull?: boolean;
|
|
336
|
+
}
|
|
337
|
+
interface ResolvedC8Options extends Required<C8Options> {
|
|
338
|
+
tempDirectory: string;
|
|
339
|
+
}
|
|
340
|
+
|
|
284
341
|
declare type Awaitable<T> = T | PromiseLike<T>;
|
|
285
342
|
declare type Nullable<T> = T | null | undefined;
|
|
286
343
|
declare type Arrayable<T> = T | Array<T>;
|
|
@@ -383,6 +440,7 @@ interface RuntimeContext {
|
|
|
383
440
|
}
|
|
384
441
|
|
|
385
442
|
interface Reporter {
|
|
443
|
+
onInit(ctx: Vitest): void;
|
|
386
444
|
onStart?: (files?: string[]) => Awaitable<void>;
|
|
387
445
|
onFinished?: (files?: File[]) => Awaitable<void>;
|
|
388
446
|
onTaskUpdate?: (pack: TaskResultPack) => Awaitable<void>;
|
|
@@ -558,6 +616,10 @@ interface InlineConfig {
|
|
|
558
616
|
* @default true
|
|
559
617
|
*/
|
|
560
618
|
isolate?: boolean;
|
|
619
|
+
/**
|
|
620
|
+
* Coverage options
|
|
621
|
+
*/
|
|
622
|
+
coverage?: C8Options;
|
|
561
623
|
/**
|
|
562
624
|
* Open Vitest UI
|
|
563
625
|
* @internal WIP
|
|
@@ -612,11 +674,12 @@ interface UserConfig extends InlineConfig {
|
|
|
612
674
|
*/
|
|
613
675
|
passWithNoTests?: boolean;
|
|
614
676
|
}
|
|
615
|
-
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'> {
|
|
677
|
+
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage'> {
|
|
616
678
|
config?: string;
|
|
617
679
|
filters?: string[];
|
|
618
680
|
depsInline: (string | RegExp)[];
|
|
619
681
|
depsExternal: (string | RegExp)[];
|
|
682
|
+
coverage: ResolvedC8Options;
|
|
620
683
|
snapshotOptions: SnapshotStateOptions;
|
|
621
684
|
}
|
|
622
685
|
|
|
@@ -629,8 +692,8 @@ interface WorkerContext {
|
|
|
629
692
|
interface WorkerRPC {
|
|
630
693
|
fetch: (id: string) => Promise<string | undefined>;
|
|
631
694
|
getSourceMap: (id: string, force?: boolean) => Promise<RawSourceMap | undefined>;
|
|
632
|
-
|
|
633
|
-
|
|
695
|
+
onWorkerExit: (code?: number) => void;
|
|
696
|
+
onUserLog: (log: UserConsoleLog) => void;
|
|
634
697
|
onCollected: (files: File[]) => void;
|
|
635
698
|
onTaskUpdate: (pack: TaskResultPack) => void;
|
|
636
699
|
snapshotSaved: (snapshot: SnapshotResult) => void;
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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-2115c609.js';
|
|
2
|
+
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, e as expect } from './index-7f57c252.js';
|
|
3
3
|
export { f as fn, s as spies, a as spyOn } from './jest-mock-4a754991.js';
|
|
4
4
|
export { assert, default as chai, should } from 'chai';
|
|
5
|
-
import './index-
|
|
5
|
+
import './index-7c024e16.js';
|
|
6
6
|
import 'url';
|
|
7
7
|
import 'tty';
|
|
8
8
|
import 'local-pkg';
|
package/dist/node.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { ViteDevServer, UserConfig as UserConfig$1 } from 'vite';
|
|
2
2
|
import { RawSourceMap } from 'source-map-js';
|
|
3
|
+
import { Arrayable as Arrayable$1 } from 'vitest';
|
|
3
4
|
import { OptionsReceived } from 'pretty-format';
|
|
4
5
|
|
|
5
6
|
declare abstract class BaseReporter implements Reporter {
|
|
6
|
-
ctx: Vitest;
|
|
7
7
|
start: number;
|
|
8
8
|
end: number;
|
|
9
9
|
watchFilters?: string[];
|
|
10
10
|
isTTY: boolean;
|
|
11
|
-
|
|
11
|
+
ctx: Vitest;
|
|
12
|
+
onInit(ctx: Vitest): void;
|
|
12
13
|
relative(path: string): string;
|
|
13
14
|
onFinished(files?: File[]): Promise<void>;
|
|
14
15
|
onTaskUpdate(pack: TaskResultPack): void;
|
|
@@ -23,8 +24,9 @@ declare abstract class BaseReporter implements Reporter {
|
|
|
23
24
|
|
|
24
25
|
interface ListRendererOptions {
|
|
25
26
|
renderSucceed?: boolean;
|
|
27
|
+
outputStream: NodeJS.WritableStream;
|
|
26
28
|
}
|
|
27
|
-
declare const createListRenderer: (_tasks: Task[], options
|
|
29
|
+
declare const createListRenderer: (_tasks: Task[], options: ListRendererOptions) => {
|
|
28
30
|
start(): any;
|
|
29
31
|
update(_tasks: Task[]): any;
|
|
30
32
|
stop(): Promise<any>;
|
|
@@ -53,7 +55,7 @@ declare class DotReporter extends BaseReporter {
|
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
declare class VerboseReporter extends DefaultReporter {
|
|
56
|
-
constructor(
|
|
58
|
+
constructor();
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
declare const ReportersMap: {
|
|
@@ -63,6 +65,56 @@ declare const ReportersMap: {
|
|
|
63
65
|
};
|
|
64
66
|
declare type BuiltinReporters = keyof typeof ReportersMap;
|
|
65
67
|
|
|
68
|
+
declare type Reporter$1 = 'clover' | 'cobertura' | 'html-spa' | 'html' | 'json-summary' | 'json' | 'lcov' | 'lcovonly' | 'none' | 'teamcity' | 'text-lcov' | 'text-summary' | 'text';
|
|
69
|
+
interface C8Options {
|
|
70
|
+
/**
|
|
71
|
+
* Enable coverage, pass `--coverage` to enable
|
|
72
|
+
*
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
enabled?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Directory to write coverage report to
|
|
78
|
+
*/
|
|
79
|
+
reportsDirectory?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Clean coverage before running tests
|
|
82
|
+
*
|
|
83
|
+
* @default true
|
|
84
|
+
*/
|
|
85
|
+
clean?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Clean coverage report on watch rerun
|
|
88
|
+
*
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
cleanOnRerun?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Allow files from outside of your cwd.
|
|
94
|
+
*
|
|
95
|
+
* @default false
|
|
96
|
+
*/
|
|
97
|
+
allowExternal?: any;
|
|
98
|
+
/**
|
|
99
|
+
* Reporters
|
|
100
|
+
*
|
|
101
|
+
* @default 'text'
|
|
102
|
+
*/
|
|
103
|
+
reporter?: Arrayable$1<Reporter$1>;
|
|
104
|
+
/**
|
|
105
|
+
* Exclude coverage under /node_modules/
|
|
106
|
+
*
|
|
107
|
+
* @default true
|
|
108
|
+
*/
|
|
109
|
+
excludeNodeModules?: boolean;
|
|
110
|
+
exclude?: string[];
|
|
111
|
+
include?: string[];
|
|
112
|
+
skipFull?: boolean;
|
|
113
|
+
}
|
|
114
|
+
interface ResolvedC8Options extends Required<C8Options> {
|
|
115
|
+
tempDirectory: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
66
118
|
declare type Awaitable<T> = T | PromiseLike<T>;
|
|
67
119
|
declare type Arrayable<T> = T | Array<T>;
|
|
68
120
|
declare type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
|
|
@@ -107,6 +159,7 @@ interface Test extends TaskBase {
|
|
|
107
159
|
declare type Task = Test | Suite | File;
|
|
108
160
|
|
|
109
161
|
interface Reporter {
|
|
162
|
+
onInit(ctx: Vitest): void;
|
|
110
163
|
onStart?: (files?: string[]) => Awaitable<void>;
|
|
111
164
|
onFinished?: (files?: File[]) => Awaitable<void>;
|
|
112
165
|
onTaskUpdate?: (pack: TaskResultPack) => Awaitable<void>;
|
|
@@ -273,6 +326,10 @@ interface InlineConfig {
|
|
|
273
326
|
* @default true
|
|
274
327
|
*/
|
|
275
328
|
isolate?: boolean;
|
|
329
|
+
/**
|
|
330
|
+
* Coverage options
|
|
331
|
+
*/
|
|
332
|
+
coverage?: C8Options;
|
|
276
333
|
/**
|
|
277
334
|
* Open Vitest UI
|
|
278
335
|
* @internal WIP
|
|
@@ -327,11 +384,12 @@ interface UserConfig extends InlineConfig {
|
|
|
327
384
|
*/
|
|
328
385
|
passWithNoTests?: boolean;
|
|
329
386
|
}
|
|
330
|
-
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'> {
|
|
387
|
+
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage'> {
|
|
331
388
|
config?: string;
|
|
332
389
|
filters?: string[];
|
|
333
390
|
depsInline: (string | RegExp)[];
|
|
334
391
|
depsExternal: (string | RegExp)[];
|
|
392
|
+
coverage: ResolvedC8Options;
|
|
335
393
|
snapshotOptions: SnapshotStateOptions;
|
|
336
394
|
}
|
|
337
395
|
|
|
@@ -368,6 +426,12 @@ declare class Vitest {
|
|
|
368
426
|
reporters: Reporter[];
|
|
369
427
|
console: Console;
|
|
370
428
|
pool: WorkerPool | undefined;
|
|
429
|
+
outputStream: NodeJS.WriteStream & {
|
|
430
|
+
fd: 1;
|
|
431
|
+
};
|
|
432
|
+
errorStream: NodeJS.WriteStream & {
|
|
433
|
+
fd: 2;
|
|
434
|
+
};
|
|
371
435
|
invalidates: Set<string>;
|
|
372
436
|
changedTests: Set<string>;
|
|
373
437
|
visitedFilesMap: Map<string, RawSourceMap>;
|
|
@@ -376,7 +440,7 @@ declare class Vitest {
|
|
|
376
440
|
restartsCount: number;
|
|
377
441
|
private _onRestartListeners;
|
|
378
442
|
constructor();
|
|
379
|
-
setServer(options: UserConfig, server: ViteDevServer): void
|
|
443
|
+
setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
|
|
380
444
|
start(filters?: string[]): Promise<void>;
|
|
381
445
|
runFiles(files: string[]): Promise<void>;
|
|
382
446
|
log(...args: any[]): void;
|
|
@@ -389,7 +453,6 @@ declare class Vitest {
|
|
|
389
453
|
close(): Promise<void>;
|
|
390
454
|
report<T extends keyof Reporter>(name: T, ...args: ArgumentsType<Reporter[T]>): Promise<void>;
|
|
391
455
|
globTestFiles(filters?: string[]): Promise<string[]>;
|
|
392
|
-
writeC8Sourcemap(): Promise<void>;
|
|
393
456
|
isTargetFile(id: string): boolean;
|
|
394
457
|
onServerRestarted(fn: () => void): void;
|
|
395
458
|
}
|
package/dist/node.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
export { c as createVitest } from './index-
|
|
2
|
-
import '
|
|
1
|
+
export { c as createVitest } from './index-b4f86684.js';
|
|
2
|
+
import './index-7c024e16.js';
|
|
3
3
|
import 'url';
|
|
4
|
-
import './index-ea5153a0.js';
|
|
5
4
|
import 'tty';
|
|
6
5
|
import 'local-pkg';
|
|
7
6
|
import 'path';
|
|
8
7
|
import 'vite';
|
|
9
8
|
import 'process';
|
|
9
|
+
import 'fs';
|
|
10
10
|
import 'os';
|
|
11
11
|
import 'util';
|
|
12
12
|
import 'stream';
|
|
13
13
|
import 'events';
|
|
14
|
-
import './constants-
|
|
14
|
+
import './constants-5968a78c.js';
|
|
15
15
|
import './magic-string.es-94000aea.js';
|
|
16
16
|
import 'perf_hooks';
|
|
17
|
-
import './diff-
|
|
18
|
-
import './index-
|
|
17
|
+
import './diff-67678e1f.js';
|
|
18
|
+
import './index-648e7ab2.js';
|
|
19
19
|
import './_commonjsHelpers-c9e3b764.js';
|
|
20
20
|
import 'assert';
|
|
21
|
+
import 'module';
|
|
21
22
|
import 'worker_threads';
|
|
22
23
|
import 'tinypool';
|
|
23
|
-
import './index-
|
|
24
|
+
import './index-e909c175.js';
|
package/dist/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { e as ensurePackageInstalled, g as getFullName,
|
|
1
|
+
export { l as deepMerge, e as ensurePackageInstalled, g as getFullName, u as getNames, f as getSuites, z as getTasks, j as getTests, h as hasFailed, x as hasTests, v as interpretOnlyMode, i as isObject, y as isWindows, p as mergeSlashes, n as noop, o as notNullish, w as partitionSuiteChildren, k as resolvePath, s as slash, t as toArray, m as toFilePath } from './index-7c024e16.js';
|
|
2
2
|
import 'url';
|
|
3
3
|
import 'tty';
|
|
4
4
|
import 'local-pkg';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as noop } from './index-
|
|
1
|
+
import { n as noop, i as isObject } from './index-7c024e16.js';
|
|
2
2
|
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-c9e3b764.js';
|
|
3
3
|
import { a as spyOn, f as fn, s as spies } from './jest-mock-4a754991.js';
|
|
4
4
|
|
|
@@ -210,7 +210,6 @@ function createSuite() {
|
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
const isObject = (val) => toString.call(val) === "[object Object]";
|
|
214
213
|
function equals(a, b, customTesters, strictCheck) {
|
|
215
214
|
customTesters = customTesters || [];
|
|
216
215
|
return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
|
package/dist/worker.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as createBirpc } from './index-
|
|
3
|
-
import { c as distDir } from './constants-
|
|
1
|
+
import { k as resolve, d as dirname$2, b as basename$2, p as mergeSlashes, s as slash, m as toFilePath } from './index-7c024e16.js';
|
|
2
|
+
import { c as createBirpc } from './index-e909c175.js';
|
|
3
|
+
import { c as distDir } from './constants-5968a78c.js';
|
|
4
4
|
import { builtinModules, createRequire } from 'module';
|
|
5
5
|
import { pathToFileURL, fileURLToPath as fileURLToPath$2, URL as URL$1 } from 'url';
|
|
6
6
|
import vm from 'vm';
|
|
@@ -9,7 +9,7 @@ import fs, { promises, realpathSync, statSync, Stats, existsSync, readdirSync }
|
|
|
9
9
|
import assert from 'assert';
|
|
10
10
|
import { format as format$2, inspect } from 'util';
|
|
11
11
|
import { a as spyOn, s as spies } from './jest-mock-4a754991.js';
|
|
12
|
-
import {
|
|
12
|
+
import { r as rpc } from './rpc-8c7cc374.js';
|
|
13
13
|
import 'tty';
|
|
14
14
|
import 'local-pkg';
|
|
15
15
|
import 'chai';
|
|
@@ -9561,10 +9561,10 @@ async function startViteNode(ctx) {
|
|
|
9561
9561
|
return _viteNode;
|
|
9562
9562
|
const processExit = process.exit;
|
|
9563
9563
|
process.on("beforeExit", (code) => {
|
|
9564
|
-
|
|
9564
|
+
rpc().onWorkerExit(code);
|
|
9565
9565
|
});
|
|
9566
9566
|
process.exit = (code = process.exitCode || 0) => {
|
|
9567
|
-
|
|
9567
|
+
rpc().onWorkerExit(code);
|
|
9568
9568
|
return processExit(code);
|
|
9569
9569
|
};
|
|
9570
9570
|
const { config } = ctx;
|
|
@@ -9574,7 +9574,7 @@ async function startViteNode(ctx) {
|
|
|
9574
9574
|
resolve(distDir, "entry.js")
|
|
9575
9575
|
],
|
|
9576
9576
|
fetch(id) {
|
|
9577
|
-
return
|
|
9577
|
+
return rpc().fetch(id);
|
|
9578
9578
|
},
|
|
9579
9579
|
inline: config.depsInline,
|
|
9580
9580
|
external: config.depsExternal,
|
|
@@ -9596,6 +9596,7 @@ function init(ctx) {
|
|
|
9596
9596
|
config,
|
|
9597
9597
|
rpc: createBirpc({
|
|
9598
9598
|
functions: {},
|
|
9599
|
+
eventNames: ["onUserLog", "onCollected", "onTaskUpdate", "onWorkerExit"],
|
|
9599
9600
|
post(v) {
|
|
9600
9601
|
port.postMessage(v);
|
|
9601
9602
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.115",
|
|
4
4
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vite",
|
|
@@ -62,12 +62,13 @@
|
|
|
62
62
|
"@types/natural-compare": "^1.4.1",
|
|
63
63
|
"@types/node": "^17.0.4",
|
|
64
64
|
"@types/prompts": "^2.4.0",
|
|
65
|
-
"birpc": "^0.0.
|
|
65
|
+
"birpc": "^0.0.2",
|
|
66
66
|
"c8": "^7.10.0",
|
|
67
67
|
"cac": "^6.7.12",
|
|
68
68
|
"chai-subset": "^1.6.0",
|
|
69
69
|
"cli-truncate": "^3.1.0",
|
|
70
70
|
"diff": "^5.0.0",
|
|
71
|
+
"execa": "^6.0.0",
|
|
71
72
|
"fast-glob": "^3.2.7",
|
|
72
73
|
"find-up": "^6.2.0",
|
|
73
74
|
"flatted": "^3.2.4",
|
package/vitest.mjs
CHANGED
|
@@ -1,21 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { fileURLToPath } from 'url'
|
|
4
|
-
import { ensurePackageInstalled, resolvePath } from './dist/utils.js'
|
|
5
|
-
|
|
6
|
-
const argv = process.argv.slice(2)
|
|
7
|
-
|
|
8
|
-
if (!await ensurePackageInstalled('vite'))
|
|
9
|
-
process.exit(1)
|
|
10
|
-
|
|
11
|
-
if (argv.includes('--coverage')) {
|
|
12
|
-
if (!await ensurePackageInstalled('c8'))
|
|
13
|
-
process.exit(1)
|
|
14
|
-
const filename = fileURLToPath(import.meta.url)
|
|
15
|
-
const entry = resolvePath(filename, '../dist/cli.js')
|
|
16
|
-
process.argv.splice(2, 0, process.argv[0], entry)
|
|
17
|
-
await import('c8/bin/c8.js')
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
await import('./dist/cli.js')
|
|
21
|
-
}
|
|
2
|
+
import('./dist/cli.js')
|
package/dist/rpc-85fe6402.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const rpc = (method, ...args) => {
|
|
2
|
-
var _a;
|
|
3
|
-
return (_a = process.__vitest_worker__) == null ? void 0 : _a.rpc.call(method, ...args);
|
|
4
|
-
};
|
|
5
|
-
const send = (method, ...args) => {
|
|
6
|
-
var _a;
|
|
7
|
-
return (_a = process.__vitest_worker__) == null ? void 0 : _a.rpc.send(method, ...args);
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export { rpc as r, send as s };
|