vitest 0.0.96 → 0.0.100
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 +2003 -0
- package/dist/_commonjsHelpers-bdec4bbd.js +7 -0
- package/dist/cli.js +13 -14
- package/dist/{constants-9cfa4d7b.js → constants-3cbd9066.js} +1 -1
- package/dist/entry.js +146 -33
- package/dist/error-34c1d9e5.js +4739 -0
- package/dist/global-b84f9970.js +19 -0
- package/dist/index-0b2be7f7.js +11164 -0
- package/dist/{index-e7a421bb.js → index-0c3a317d.js} +2 -1
- package/dist/{index-ece64e3c.js → index-113b8b23.js} +2589 -121
- package/dist/{index-5cc247ff.js → index-825cb54c.js} +2 -3
- package/dist/{index-368448f4.js → index-d57cd3f0.js} +1 -2
- package/dist/index.d.ts +32 -113
- package/dist/index.js +7 -3
- package/dist/{middleware-bf0f818d.js → middleware-991dfa87.js} +5 -2
- package/dist/node.js +11 -10
- package/dist/{utils-576876dc.js → utils-b780070b.js} +186 -2
- package/dist/utils.js +2 -1
- package/dist/worker.js +21 -16
- package/package.json +15 -15
- package/{bin/vitest.mjs → vitest.mjs} +3 -4
- package/LICENSE +0 -22
- package/dist/error-81292c96.js +0 -1414
- package/dist/global-473089f7.js +0 -16
- package/dist/suite-b8c6cb53.js +0 -236
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { c as commonjsGlobal } from './_commonjsHelpers-bdec4bbd.js';
|
|
1
2
|
import assert$1 from 'assert';
|
|
2
3
|
import require$$2 from 'events';
|
|
3
4
|
|
|
4
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
5
|
-
|
|
6
5
|
var onetime$2 = {exports: {}};
|
|
7
6
|
|
|
8
7
|
var mimicFn$2 = {exports: {}};
|
|
@@ -328,4 +327,4 @@ if (!processOk(process$1)) {
|
|
|
328
327
|
|
|
329
328
|
var signalExit = signalExit$1.exports;
|
|
330
329
|
|
|
331
|
-
export { signalExit$1 as a, onetime$2 as b,
|
|
330
|
+
export { signalExit$1 as a, onetime$2 as b, onetime$1 as o, signalExit as s };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it } from './
|
|
2
|
-
import chai, { util, assert, should, expect } from 'chai';
|
|
1
|
+
import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, u as util, s as suite, t as test, d as describe, i as it, b as assert, c as should, e as expect, f as chai } from './index-0b2be7f7.js';
|
|
3
2
|
import * as tinyspy from 'tinyspy';
|
|
4
3
|
import { spies } from 'tinyspy';
|
|
5
4
|
|
package/dist/index.d.ts
CHANGED
|
@@ -173,6 +173,12 @@ interface UserConsoleLog {
|
|
|
173
173
|
taskId?: string;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
declare type ChainableFunction<T extends string, Args extends any[], R = any> = {
|
|
177
|
+
(...args: Args): R;
|
|
178
|
+
} & {
|
|
179
|
+
[x in T]: ChainableFunction<T, Args, R>;
|
|
180
|
+
};
|
|
181
|
+
|
|
176
182
|
declare type RunMode = 'run' | 'skip' | 'only' | 'todo';
|
|
177
183
|
declare type TaskState = RunMode | 'pass' | 'fail';
|
|
178
184
|
declare type ComputeMode = 'serial' | 'concurrent';
|
|
@@ -203,36 +209,16 @@ interface Test extends TaskBase {
|
|
|
203
209
|
type: 'test';
|
|
204
210
|
suite: Suite;
|
|
205
211
|
result?: TaskResult;
|
|
212
|
+
fails?: boolean;
|
|
206
213
|
}
|
|
207
214
|
declare type Task = Test | Suite | File;
|
|
208
215
|
declare type DoneCallback = (error?: any) => void;
|
|
209
216
|
declare type TestFunction = (done: DoneCallback) => Awaitable<void>;
|
|
210
|
-
declare type
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
todo: (name: string) => void;
|
|
216
|
-
}
|
|
217
|
-
interface OnlyCollector {
|
|
218
|
-
(name: string, fn: TestFunction, timeout?: number): void;
|
|
219
|
-
concurrent: TestCollectorFn;
|
|
220
|
-
}
|
|
221
|
-
interface SkipCollector {
|
|
222
|
-
(name: string, fn: TestFunction, timeout?: number): void;
|
|
223
|
-
concurrent: TestCollectorFn;
|
|
224
|
-
}
|
|
225
|
-
interface TodoCollector {
|
|
226
|
-
(name: string): void;
|
|
227
|
-
concurrent: (name: string) => void;
|
|
228
|
-
}
|
|
229
|
-
interface TestCollector {
|
|
230
|
-
(name: string, fn: TestFunction, timeout?: number): void;
|
|
231
|
-
concurrent: ConcurrentCollector;
|
|
232
|
-
only: OnlyCollector;
|
|
233
|
-
skip: SkipCollector;
|
|
234
|
-
todo: TodoCollector;
|
|
235
|
-
}
|
|
217
|
+
declare type TestCollector = ChainableFunction<'concurrent' | 'only' | 'skip' | 'todo' | 'fails', [
|
|
218
|
+
name: string,
|
|
219
|
+
fn?: TestFunction,
|
|
220
|
+
timeout?: number
|
|
221
|
+
], void>;
|
|
236
222
|
declare type HookListener<T extends any[]> = (...args: T) => Awaitable<void>;
|
|
237
223
|
interface SuiteHooks {
|
|
238
224
|
beforeAll: HookListener<[Suite]>[];
|
|
@@ -420,6 +406,12 @@ interface InlineConfig {
|
|
|
420
406
|
* Path to setup files
|
|
421
407
|
*/
|
|
422
408
|
setupFiles?: string | string[];
|
|
409
|
+
/**
|
|
410
|
+
* Pattern of file paths to be ignore from triggering watch rerun
|
|
411
|
+
*
|
|
412
|
+
* @default ['**\/node_modules\/**', '**\/dist/**']
|
|
413
|
+
*/
|
|
414
|
+
watchIgnore?: (string | RegExp)[];
|
|
423
415
|
/**
|
|
424
416
|
* Open Vitest UI
|
|
425
417
|
* @internal WIP
|
|
@@ -446,7 +438,14 @@ interface UserConfig extends InlineConfig {
|
|
|
446
438
|
* - `vite.config.ts`
|
|
447
439
|
*/
|
|
448
440
|
config?: string | undefined;
|
|
441
|
+
/**
|
|
442
|
+
* Use happy-dom
|
|
443
|
+
*/
|
|
449
444
|
dom?: boolean;
|
|
445
|
+
/**
|
|
446
|
+
* Do not watch
|
|
447
|
+
*/
|
|
448
|
+
run?: boolean;
|
|
450
449
|
}
|
|
451
450
|
interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'> {
|
|
452
451
|
config?: string;
|
|
@@ -469,8 +468,6 @@ interface RpcMap {
|
|
|
469
468
|
onCollected: [[files: File[]], void];
|
|
470
469
|
onFinished: [[], void];
|
|
471
470
|
onTaskUpdate: [[pack: TaskResultPack], void];
|
|
472
|
-
onWatcherStart: [[], void];
|
|
473
|
-
onWatcherRerun: [[files: string[], trigger: string], void];
|
|
474
471
|
snapshotSaved: [[snapshot: SnapshotResult], void];
|
|
475
472
|
}
|
|
476
473
|
declare type RpcCall = <T extends keyof RpcMap>(method: T, ...args: RpcMap[T][0]) => Promise<RpcMap[T][1]>;
|
|
@@ -481,90 +478,10 @@ declare type RpcPayload<T extends keyof RpcMap = keyof RpcMap> = {
|
|
|
481
478
|
args: RpcMap[T][0];
|
|
482
479
|
};
|
|
483
480
|
|
|
484
|
-
declare const suite:
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
skip(suiteName: string, factory?: TestFactory | undefined): SuiteCollector;
|
|
489
|
-
only(suiteName: string, factory?: TestFactory | undefined): SuiteCollector;
|
|
490
|
-
todo(suiteName: string): SuiteCollector;
|
|
491
|
-
};
|
|
492
|
-
skip: {
|
|
493
|
-
(suiteName: string, factory?: TestFactory | undefined): SuiteCollector;
|
|
494
|
-
concurrent: (suiteName: string, factory?: TestFactory | undefined) => SuiteCollector;
|
|
495
|
-
};
|
|
496
|
-
only: {
|
|
497
|
-
(suiteName: string, factory?: TestFactory | undefined): SuiteCollector;
|
|
498
|
-
concurrent: (suiteName: string, factory?: TestFactory | undefined) => SuiteCollector;
|
|
499
|
-
};
|
|
500
|
-
todo: {
|
|
501
|
-
(suiteName: string): SuiteCollector;
|
|
502
|
-
concurrent: (suiteName: string) => SuiteCollector;
|
|
503
|
-
};
|
|
504
|
-
};
|
|
505
|
-
declare const test: {
|
|
506
|
-
(name: string, fn: TestFunction, timeout?: number | undefined): void;
|
|
507
|
-
concurrent: {
|
|
508
|
-
(name: string, fn: TestFunction, timeout?: number | undefined): void;
|
|
509
|
-
skip(name: string, fn: TestFunction, timeout?: number | undefined): void;
|
|
510
|
-
only(name: string, fn: TestFunction, timeout?: number | undefined): void;
|
|
511
|
-
todo(name: string): void;
|
|
512
|
-
};
|
|
513
|
-
skip: {
|
|
514
|
-
(name: string, fn: TestFunction, timeout?: number | undefined): void;
|
|
515
|
-
concurrent(name: string, fn: TestFunction, timeout?: number | undefined): void;
|
|
516
|
-
};
|
|
517
|
-
only: {
|
|
518
|
-
(name: string, fn: TestFunction, timeout?: number | undefined): void;
|
|
519
|
-
concurrent(name: string, fn: TestFunction, timeout?: number | undefined): void;
|
|
520
|
-
};
|
|
521
|
-
todo: {
|
|
522
|
-
(name: string): void;
|
|
523
|
-
concurrent(name: string): void;
|
|
524
|
-
};
|
|
525
|
-
};
|
|
526
|
-
declare const describe: {
|
|
527
|
-
(suiteName: string, factory?: TestFactory | undefined): SuiteCollector;
|
|
528
|
-
concurrent: {
|
|
529
|
-
(suiteName: string, factory?: TestFactory | undefined): SuiteCollector;
|
|
530
|
-
skip(suiteName: string, factory?: TestFactory | undefined): SuiteCollector;
|
|
531
|
-
only(suiteName: string, factory?: TestFactory | undefined): SuiteCollector;
|
|
532
|
-
todo(suiteName: string): SuiteCollector;
|
|
533
|
-
};
|
|
534
|
-
skip: {
|
|
535
|
-
(suiteName: string, factory?: TestFactory | undefined): SuiteCollector;
|
|
536
|
-
concurrent: (suiteName: string, factory?: TestFactory | undefined) => SuiteCollector;
|
|
537
|
-
};
|
|
538
|
-
only: {
|
|
539
|
-
(suiteName: string, factory?: TestFactory | undefined): SuiteCollector;
|
|
540
|
-
concurrent: (suiteName: string, factory?: TestFactory | undefined) => SuiteCollector;
|
|
541
|
-
};
|
|
542
|
-
todo: {
|
|
543
|
-
(suiteName: string): SuiteCollector;
|
|
544
|
-
concurrent: (suiteName: string) => SuiteCollector;
|
|
545
|
-
};
|
|
546
|
-
};
|
|
547
|
-
declare const it: {
|
|
548
|
-
(name: string, fn: TestFunction, timeout?: number | undefined): void;
|
|
549
|
-
concurrent: {
|
|
550
|
-
(name: string, fn: TestFunction, timeout?: number | undefined): void;
|
|
551
|
-
skip(name: string, fn: TestFunction, timeout?: number | undefined): void;
|
|
552
|
-
only(name: string, fn: TestFunction, timeout?: number | undefined): void;
|
|
553
|
-
todo(name: string): void;
|
|
554
|
-
};
|
|
555
|
-
skip: {
|
|
556
|
-
(name: string, fn: TestFunction, timeout?: number | undefined): void;
|
|
557
|
-
concurrent(name: string, fn: TestFunction, timeout?: number | undefined): void;
|
|
558
|
-
};
|
|
559
|
-
only: {
|
|
560
|
-
(name: string, fn: TestFunction, timeout?: number | undefined): void;
|
|
561
|
-
concurrent(name: string, fn: TestFunction, timeout?: number | undefined): void;
|
|
562
|
-
};
|
|
563
|
-
todo: {
|
|
564
|
-
(name: string): void;
|
|
565
|
-
concurrent(name: string): void;
|
|
566
|
-
};
|
|
567
|
-
};
|
|
481
|
+
declare const suite: ChainableFunction<"skip" | "only" | "todo" | "concurrent", [name: string, factory?: TestFactory | undefined], SuiteCollector>;
|
|
482
|
+
declare const test: TestCollector;
|
|
483
|
+
declare const describe: ChainableFunction<"skip" | "only" | "todo" | "concurrent", [name: string, factory?: TestFactory | undefined], SuiteCollector>;
|
|
484
|
+
declare const it: TestCollector;
|
|
568
485
|
declare global {
|
|
569
486
|
namespace NodeJS {
|
|
570
487
|
interface Process {
|
|
@@ -653,12 +570,14 @@ declare class VitestUtils {
|
|
|
653
570
|
declare const vitest: VitestUtils;
|
|
654
571
|
declare const vi: VitestUtils;
|
|
655
572
|
|
|
573
|
+
declare type VitestInlineConfig = InlineConfig;
|
|
574
|
+
|
|
656
575
|
declare module 'vite' {
|
|
657
576
|
interface UserConfig {
|
|
658
577
|
/**
|
|
659
578
|
* Options for Vitest
|
|
660
579
|
*/
|
|
661
|
-
test?:
|
|
580
|
+
test?: VitestInlineConfig;
|
|
662
581
|
}
|
|
663
582
|
}
|
|
664
583
|
declare global {
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
export { d as describe, i as it, s as suite, t as test } from './
|
|
2
|
-
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, f as fn, s as spyOn, e as vi, v as vitest } from './index-
|
|
3
|
-
export { assert, default as chai, expect, should } from 'chai';
|
|
1
|
+
export { b as assert, f as chai, d as describe, e as expect, i as it, c as should, s as suite, t as test } from './index-0b2be7f7.js';
|
|
2
|
+
export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, f as fn, s as spyOn, e as vi, v as vitest } from './index-d57cd3f0.js';
|
|
4
3
|
import './index-9e71c815.js';
|
|
4
|
+
import './utils-b780070b.js';
|
|
5
|
+
import 'tty';
|
|
6
|
+
import 'local-pkg';
|
|
7
|
+
import 'path';
|
|
8
|
+
import './_commonjsHelpers-bdec4bbd.js';
|
|
5
9
|
import 'tinyspy';
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { A as API_PATH } from './constants-
|
|
2
|
-
import 'path';
|
|
1
|
+
import { A as API_PATH } from './constants-3cbd9066.js';
|
|
3
2
|
import 'url';
|
|
3
|
+
import './utils-b780070b.js';
|
|
4
|
+
import 'tty';
|
|
5
|
+
import 'local-pkg';
|
|
6
|
+
import 'path';
|
|
4
7
|
|
|
5
8
|
/*! (c) 2020 Andrea Giammarchi */
|
|
6
9
|
|
package/dist/node.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
export { c as createVitest } from './index-
|
|
1
|
+
export { c as createVitest } from './index-113b8b23.js';
|
|
2
|
+
import './utils-b780070b.js';
|
|
3
|
+
import 'tty';
|
|
4
|
+
import 'local-pkg';
|
|
2
5
|
import 'path';
|
|
3
6
|
import 'vite';
|
|
4
7
|
import 'process';
|
|
5
8
|
import 'fs';
|
|
6
|
-
import '
|
|
9
|
+
import 'os';
|
|
7
10
|
import 'util';
|
|
8
|
-
import '
|
|
11
|
+
import 'stream';
|
|
12
|
+
import 'events';
|
|
13
|
+
import './constants-3cbd9066.js';
|
|
9
14
|
import 'url';
|
|
10
|
-
import './utils-576876dc.js';
|
|
11
|
-
import 'tty';
|
|
12
|
-
import 'local-pkg';
|
|
13
15
|
import 'perf_hooks';
|
|
14
|
-
import './error-
|
|
15
|
-
import '
|
|
16
|
-
import './
|
|
16
|
+
import './error-34c1d9e5.js';
|
|
17
|
+
import './index-825cb54c.js';
|
|
18
|
+
import './_commonjsHelpers-bdec4bbd.js';
|
|
17
19
|
import 'assert';
|
|
18
|
-
import 'events';
|
|
19
20
|
import 'worker_threads';
|
|
20
21
|
import 'tinypool';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import require$$0 from 'tty';
|
|
2
2
|
import { isPackageExists } from 'local-pkg';
|
|
3
|
+
import path from 'path';
|
|
3
4
|
|
|
4
5
|
var picocolors = {exports: {}};
|
|
5
6
|
|
|
@@ -64,6 +65,189 @@ picocolors.exports.createColors = createColors;
|
|
|
64
65
|
|
|
65
66
|
var c = picocolors.exports;
|
|
66
67
|
|
|
68
|
+
function normalizeWindowsPath(input = "") {
|
|
69
|
+
if (!input.includes("\\")) {
|
|
70
|
+
return input;
|
|
71
|
+
}
|
|
72
|
+
return input.replace(/\\/g, "/");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const _UNC_REGEX = /^[/][/]/;
|
|
76
|
+
const _UNC_DRIVE_REGEX = /^[/][/]([.]{1,2}[/])?([a-zA-Z]):[/]/;
|
|
77
|
+
const _IS_ABSOLUTE_RE = /^\/|^\\|^[a-zA-Z]:[/\\]/;
|
|
78
|
+
const sep = "/";
|
|
79
|
+
const delimiter = ":";
|
|
80
|
+
const normalize = function(path2) {
|
|
81
|
+
if (path2.length === 0) {
|
|
82
|
+
return ".";
|
|
83
|
+
}
|
|
84
|
+
path2 = normalizeWindowsPath(path2);
|
|
85
|
+
const isUNCPath = path2.match(_UNC_REGEX);
|
|
86
|
+
const hasUNCDrive = isUNCPath && path2.match(_UNC_DRIVE_REGEX);
|
|
87
|
+
const isPathAbsolute = isAbsolute(path2);
|
|
88
|
+
const trailingSeparator = path2[path2.length - 1] === "/";
|
|
89
|
+
path2 = normalizeString(path2, !isPathAbsolute);
|
|
90
|
+
if (path2.length === 0) {
|
|
91
|
+
if (isPathAbsolute) {
|
|
92
|
+
return "/";
|
|
93
|
+
}
|
|
94
|
+
return trailingSeparator ? "./" : ".";
|
|
95
|
+
}
|
|
96
|
+
if (trailingSeparator) {
|
|
97
|
+
path2 += "/";
|
|
98
|
+
}
|
|
99
|
+
if (isUNCPath) {
|
|
100
|
+
if (hasUNCDrive) {
|
|
101
|
+
return `//./${path2}`;
|
|
102
|
+
}
|
|
103
|
+
return `//${path2}`;
|
|
104
|
+
}
|
|
105
|
+
return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
|
|
106
|
+
};
|
|
107
|
+
const join = function(...args) {
|
|
108
|
+
if (args.length === 0) {
|
|
109
|
+
return ".";
|
|
110
|
+
}
|
|
111
|
+
let joined;
|
|
112
|
+
for (let i = 0; i < args.length; ++i) {
|
|
113
|
+
const arg = args[i];
|
|
114
|
+
if (arg.length > 0) {
|
|
115
|
+
if (joined === void 0) {
|
|
116
|
+
joined = arg;
|
|
117
|
+
} else {
|
|
118
|
+
joined += `/${arg}`;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (joined === void 0) {
|
|
123
|
+
return ".";
|
|
124
|
+
}
|
|
125
|
+
return normalize(joined);
|
|
126
|
+
};
|
|
127
|
+
const resolve = function(...args) {
|
|
128
|
+
args = args.map((arg) => normalizeWindowsPath(arg));
|
|
129
|
+
let resolvedPath = "";
|
|
130
|
+
let resolvedAbsolute = false;
|
|
131
|
+
for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
132
|
+
const path2 = i >= 0 ? args[i] : process.cwd();
|
|
133
|
+
if (path2.length === 0) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
resolvedPath = `${path2}/${resolvedPath}`;
|
|
137
|
+
resolvedAbsolute = isAbsolute(path2);
|
|
138
|
+
}
|
|
139
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
140
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
141
|
+
return `/${resolvedPath}`;
|
|
142
|
+
}
|
|
143
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
144
|
+
};
|
|
145
|
+
function normalizeString(path2, allowAboveRoot) {
|
|
146
|
+
let res = "";
|
|
147
|
+
let lastSegmentLength = 0;
|
|
148
|
+
let lastSlash = -1;
|
|
149
|
+
let dots = 0;
|
|
150
|
+
let char = null;
|
|
151
|
+
for (let i = 0; i <= path2.length; ++i) {
|
|
152
|
+
if (i < path2.length) {
|
|
153
|
+
char = path2[i];
|
|
154
|
+
} else if (char === "/") {
|
|
155
|
+
break;
|
|
156
|
+
} else {
|
|
157
|
+
char = "/";
|
|
158
|
+
}
|
|
159
|
+
if (char === "/") {
|
|
160
|
+
if (lastSlash === i - 1 || dots === 1) ; else if (dots === 2) {
|
|
161
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
162
|
+
if (res.length > 2) {
|
|
163
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
164
|
+
if (lastSlashIndex === -1) {
|
|
165
|
+
res = "";
|
|
166
|
+
lastSegmentLength = 0;
|
|
167
|
+
} else {
|
|
168
|
+
res = res.slice(0, lastSlashIndex);
|
|
169
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
170
|
+
}
|
|
171
|
+
lastSlash = i;
|
|
172
|
+
dots = 0;
|
|
173
|
+
continue;
|
|
174
|
+
} else if (res.length !== 0) {
|
|
175
|
+
res = "";
|
|
176
|
+
lastSegmentLength = 0;
|
|
177
|
+
lastSlash = i;
|
|
178
|
+
dots = 0;
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (allowAboveRoot) {
|
|
183
|
+
res += res.length > 0 ? "/.." : "..";
|
|
184
|
+
lastSegmentLength = 2;
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
if (res.length > 0) {
|
|
188
|
+
res += `/${path2.slice(lastSlash + 1, i)}`;
|
|
189
|
+
} else {
|
|
190
|
+
res = path2.slice(lastSlash + 1, i);
|
|
191
|
+
}
|
|
192
|
+
lastSegmentLength = i - lastSlash - 1;
|
|
193
|
+
}
|
|
194
|
+
lastSlash = i;
|
|
195
|
+
dots = 0;
|
|
196
|
+
} else if (char === "." && dots !== -1) {
|
|
197
|
+
++dots;
|
|
198
|
+
} else {
|
|
199
|
+
dots = -1;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return res;
|
|
203
|
+
}
|
|
204
|
+
const isAbsolute = function(p) {
|
|
205
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
206
|
+
};
|
|
207
|
+
const toNamespacedPath = function(p) {
|
|
208
|
+
return normalizeWindowsPath(p);
|
|
209
|
+
};
|
|
210
|
+
const extname = function(p) {
|
|
211
|
+
return path.posix.extname(normalizeWindowsPath(p));
|
|
212
|
+
};
|
|
213
|
+
const relative = function(from, to) {
|
|
214
|
+
return path.posix.relative(normalizeWindowsPath(from), normalizeWindowsPath(to));
|
|
215
|
+
};
|
|
216
|
+
const dirname = function(p) {
|
|
217
|
+
return path.posix.dirname(normalizeWindowsPath(p));
|
|
218
|
+
};
|
|
219
|
+
const format = function(p) {
|
|
220
|
+
return normalizeWindowsPath(path.posix.format(p));
|
|
221
|
+
};
|
|
222
|
+
const basename = function(p, ext) {
|
|
223
|
+
return path.posix.basename(normalizeWindowsPath(p), ext);
|
|
224
|
+
};
|
|
225
|
+
const parse = function(p) {
|
|
226
|
+
return path.posix.parse(normalizeWindowsPath(p));
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
const _path = /*#__PURE__*/Object.freeze({
|
|
230
|
+
__proto__: null,
|
|
231
|
+
sep: sep,
|
|
232
|
+
delimiter: delimiter,
|
|
233
|
+
normalize: normalize,
|
|
234
|
+
join: join,
|
|
235
|
+
resolve: resolve,
|
|
236
|
+
normalizeString: normalizeString,
|
|
237
|
+
isAbsolute: isAbsolute,
|
|
238
|
+
toNamespacedPath: toNamespacedPath,
|
|
239
|
+
extname: extname,
|
|
240
|
+
relative: relative,
|
|
241
|
+
dirname: dirname,
|
|
242
|
+
format: format,
|
|
243
|
+
basename: basename,
|
|
244
|
+
parse: parse
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
const index = {
|
|
248
|
+
..._path
|
|
249
|
+
};
|
|
250
|
+
|
|
67
251
|
function toArray(array) {
|
|
68
252
|
array = array || [];
|
|
69
253
|
if (Array.isArray(array))
|
|
@@ -153,10 +337,10 @@ async function ensurePackageInstalled(dependency, promptInstall = !process.env.C
|
|
|
153
337
|
message: c.reset(`Do you want to install ${c.green(dependency)}?`)
|
|
154
338
|
});
|
|
155
339
|
if (install) {
|
|
156
|
-
await (await import('./index-
|
|
340
|
+
await (await import('./index-0c3a317d.js')).installPackage(dependency, { dev: true });
|
|
157
341
|
return true;
|
|
158
342
|
}
|
|
159
343
|
return false;
|
|
160
344
|
}
|
|
161
345
|
|
|
162
|
-
export { getTests as a,
|
|
346
|
+
export { getTests as a, basename as b, c, dirname as d, ensurePackageInstalled as e, getSuites as f, getNames as g, resolve as h, isAbsolute as i, hasFailed as j, notNullish as k, index as l, interpretOnlyMode as m, noop as n, hasTests as o, partitionSuiteChildren as p, getTasks as q, relative as r, slash as s, toArray as t };
|
package/dist/utils.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { e as ensurePackageInstalled, g as getNames,
|
|
1
|
+
export { e as ensurePackageInstalled, g as getNames, f as getSuites, q as getTasks, a as getTests, j as hasFailed, o as hasTests, m as interpretOnlyMode, n as noop, k as notNullish, p as partitionSuiteChildren, h as resolvePath, s as slash, t as toArray } from './utils-b780070b.js';
|
|
2
2
|
import 'local-pkg';
|
|
3
3
|
import 'tty';
|
|
4
|
+
import 'path';
|
package/dist/worker.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { s as slash, h as resolve, d as dirname$2 } from './utils-b780070b.js';
|
|
2
2
|
import { n as nanoid } from './index-9e71c815.js';
|
|
3
|
-
import { c as distDir } from './constants-
|
|
3
|
+
import { c as distDir } from './constants-3cbd9066.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';
|
|
7
|
+
import path from 'path';
|
|
7
8
|
import fs, { promises, realpathSync, statSync, Stats } from 'fs';
|
|
8
9
|
import assert from 'assert';
|
|
9
10
|
import { format as format$2, inspect } from 'util';
|
|
10
|
-
import { s as slash } from './utils-576876dc.js';
|
|
11
11
|
import { s as send } from './rpc-7de86f29.js';
|
|
12
12
|
import 'tty';
|
|
13
13
|
import 'local-pkg';
|
|
@@ -9226,18 +9226,21 @@ const stubRequests = {
|
|
|
9226
9226
|
};
|
|
9227
9227
|
async function interpretedImport(path, interpretDefault) {
|
|
9228
9228
|
const mod = await import(path);
|
|
9229
|
-
if (interpretDefault && "
|
|
9230
|
-
|
|
9231
|
-
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
|
|
9235
|
-
|
|
9236
|
-
|
|
9237
|
-
|
|
9238
|
-
|
|
9239
|
-
|
|
9240
|
-
|
|
9229
|
+
if (interpretDefault && "default" in mod) {
|
|
9230
|
+
return new Proxy(mod, {
|
|
9231
|
+
get(target, key, receiver) {
|
|
9232
|
+
return Reflect.get(target, key, receiver) || Reflect.get(target.default, key, receiver);
|
|
9233
|
+
},
|
|
9234
|
+
set(target, key, value, receiver) {
|
|
9235
|
+
return Reflect.set(target, key, value, receiver) || Reflect.set(target.default, key, value, receiver);
|
|
9236
|
+
},
|
|
9237
|
+
has(target, key) {
|
|
9238
|
+
return Reflect.has(target, key) || Reflect.has(target.default, key);
|
|
9239
|
+
},
|
|
9240
|
+
deleteProperty(target, key) {
|
|
9241
|
+
return Reflect.deleteProperty(target, key) || Reflect.deleteProperty(target.default, key);
|
|
9242
|
+
}
|
|
9243
|
+
});
|
|
9241
9244
|
}
|
|
9242
9245
|
return mod;
|
|
9243
9246
|
}
|
|
@@ -9311,7 +9314,7 @@ ${[...callstack, dep].reverse().map((p) => `- ${p}`).join("\n")}`);
|
|
|
9311
9314
|
var _a, _b;
|
|
9312
9315
|
const id = normalizeId(rawId);
|
|
9313
9316
|
if (externalCache.get(id))
|
|
9314
|
-
return interpretedImport(id, options.interpretDefault);
|
|
9317
|
+
return interpretedImport(patchWindowsImportPath(id), options.interpretDefault);
|
|
9315
9318
|
const fsPath = toFilePath(id, root);
|
|
9316
9319
|
const importPath = patchWindowsImportPath(fsPath);
|
|
9317
9320
|
if (!externalCache.has(importPath))
|
|
@@ -9376,6 +9379,8 @@ function matchExternalizePattern(id, patterns) {
|
|
|
9376
9379
|
function patchWindowsImportPath(path) {
|
|
9377
9380
|
if (path.match(/^\w:\\/))
|
|
9378
9381
|
return `file:///${slash(path)}`;
|
|
9382
|
+
else if (path.match(/^\w:\//))
|
|
9383
|
+
return `file:///${path}`;
|
|
9379
9384
|
else
|
|
9380
9385
|
return path;
|
|
9381
9386
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vite",
|
|
@@ -25,34 +25,31 @@
|
|
|
25
25
|
"import": "./dist/index.js",
|
|
26
26
|
"types": "./dist/index.d.ts"
|
|
27
27
|
},
|
|
28
|
-
"
|
|
29
|
-
"import": "./dist/node.js",
|
|
30
|
-
"types": "./dist/node.d.ts"
|
|
31
|
-
},
|
|
28
|
+
"./*": "./*",
|
|
32
29
|
"./global": {
|
|
33
30
|
"types": "./global.d.ts"
|
|
34
31
|
},
|
|
35
|
-
"
|
|
32
|
+
"./node": {
|
|
33
|
+
"import": "./dist/node.js",
|
|
34
|
+
"types": "./dist/node.d.ts"
|
|
35
|
+
}
|
|
36
36
|
},
|
|
37
37
|
"main": "./dist/index.js",
|
|
38
38
|
"module": "./dist/index.js",
|
|
39
39
|
"types": "./dist/index.d.ts",
|
|
40
40
|
"bin": {
|
|
41
|
-
"vitest": "./
|
|
41
|
+
"vitest": "./vitest.mjs"
|
|
42
42
|
},
|
|
43
43
|
"files": [
|
|
44
44
|
"dist",
|
|
45
45
|
"bin",
|
|
46
|
-
"*.d.ts"
|
|
46
|
+
"*.d.ts",
|
|
47
|
+
"*.mjs"
|
|
47
48
|
],
|
|
48
49
|
"dependencies": {
|
|
49
50
|
"@types/chai": "^4.3.0",
|
|
50
51
|
"@types/chai-subset": "^1.3.3",
|
|
51
|
-
"chai": "^4.3.4",
|
|
52
|
-
"chai-subset": "^1.6.0",
|
|
53
|
-
"fast-glob": "^3.2.7",
|
|
54
52
|
"local-pkg": "^0.4.0",
|
|
55
|
-
"source-map": "^0.7.3",
|
|
56
53
|
"tinypool": "^0.0.3",
|
|
57
54
|
"tinyspy": "^0.1.2"
|
|
58
55
|
},
|
|
@@ -66,8 +63,11 @@
|
|
|
66
63
|
"@types/prompts": "^2.4.0",
|
|
67
64
|
"c8": "^7.10.0",
|
|
68
65
|
"cac": "^6.7.12",
|
|
66
|
+
"chai": "^4.3.4",
|
|
67
|
+
"chai-subset": "^1.6.0",
|
|
69
68
|
"cli-truncate": "^3.1.0",
|
|
70
69
|
"diff": "^5.0.0",
|
|
70
|
+
"fast-glob": "^3.2.7",
|
|
71
71
|
"find-up": "^6.2.0",
|
|
72
72
|
"flatted": "^3.2.4",
|
|
73
73
|
"happy-dom": "^2.25.0",
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
"pretty-format": "^27.4.2",
|
|
84
84
|
"prompts": "^2.4.2",
|
|
85
85
|
"rollup": "^2.61.1",
|
|
86
|
+
"source-map-js": "^1.0.1",
|
|
86
87
|
"strip-ansi": "^7.0.1",
|
|
87
88
|
"typescript": "^4.5.4"
|
|
88
89
|
},
|
|
@@ -104,12 +105,11 @@
|
|
|
104
105
|
}
|
|
105
106
|
},
|
|
106
107
|
"engines": {
|
|
107
|
-
"node": ">=
|
|
108
|
+
"node": ">=14.14.0"
|
|
108
109
|
},
|
|
109
110
|
"scripts": {
|
|
110
111
|
"build": "rimraf dist && rollup -c",
|
|
111
112
|
"dev": "rollup -c --watch src",
|
|
112
113
|
"typecheck": "tsc --noEmit"
|
|
113
|
-
}
|
|
114
|
-
"readme": "# vitest\n\n[](https://www.npmjs.com/package/vitest)\n\nA blazing fast unit test framework powered by Vite.\n\n> **This project is currently in closed beta exclusively for Sponsors.**<br>\n> Become a Sponsor of [@patak-dev](https://github.com/sponsors/patak-dev) or [@antfu](https://github.com/sponsors/antfu) to access the source code and issues tracker.\n> Learn more at [vitest.dev](https://vitest.dev)\n"
|
|
114
|
+
}
|
|
115
115
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { fileURLToPath } from 'url'
|
|
4
|
-
import {
|
|
5
|
-
import { ensurePackageInstalled } from '../dist/utils.js'
|
|
4
|
+
import { ensurePackageInstalled, resolvePath } from './dist/utils.js'
|
|
6
5
|
|
|
7
6
|
const argv = process.argv.slice(2)
|
|
8
7
|
|
|
@@ -13,10 +12,10 @@ if (argv.includes('--coverage')) {
|
|
|
13
12
|
if (!await ensurePackageInstalled('c8'))
|
|
14
13
|
process.exit(1)
|
|
15
14
|
const filename = fileURLToPath(import.meta.url)
|
|
16
|
-
const entry =
|
|
15
|
+
const entry = resolvePath(filename, '../../dist/cli.js')
|
|
17
16
|
process.argv.splice(2, 0, process.argv[0], entry)
|
|
18
17
|
await import('c8/bin/c8.js')
|
|
19
18
|
}
|
|
20
19
|
else {
|
|
21
|
-
await import('
|
|
20
|
+
await import('./dist/cli.js')
|
|
22
21
|
}
|