vitest 0.12.6 → 0.12.7
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 +0 -72
- package/dist/{chunk-api-setup.02588d9f.js → chunk-api-setup.2f2df7e0.js} +5 -4
- package/dist/{chunk-constants.7180775c.js → chunk-constants.3570739f.js} +1 -1
- package/dist/{chunk-defaults.9e0c233e.js → chunk-defaults.7d81a6ca.js} +1 -1
- package/dist/{chunk-install-pkg.078f5345.js → chunk-install-pkg.fd8d1022.js} +9 -11
- package/dist/chunk-integrations-globals.36dc71fa.js +26 -0
- package/dist/{chunk-magic-string.d5e0e473.js → chunk-magic-string.41232190.js} +0 -4
- package/dist/{chunk-runtime-chain.5cae775c.js → chunk-runtime-chain.5021a6b6.js} +22 -21
- package/dist/{chunk-runtime-mocker.43db6608.js → chunk-runtime-mocker.42fa71a8.js} +3 -3
- package/dist/{chunk-runtime-rpc.ad208eea.js → chunk-runtime-rpc.47bae3f9.js} +1 -1
- package/dist/{chunk-utils-global.29e8a0a3.js → chunk-utils-global.2fab7e5c.js} +2 -8
- package/dist/{chunk-utils-timers.64f2cbe8.js → chunk-utils-timers.da6ac0a6.js} +1 -1
- package/dist/{chunk-vite-node-externalize.35ad761d.js → chunk-vite-node-externalize.0aac0c8e.js} +41 -36
- package/dist/{chunk-vite-node-utils.26c328fa.js → chunk-vite-node-utils.9975fd9e.js} +4 -1063
- package/dist/cli.js +11 -9
- package/dist/config.d.ts +6 -3
- package/dist/entry.js +7 -6
- package/dist/index.d.ts +248 -251
- package/dist/index.js +5 -4
- package/dist/node.d.ts +215 -0
- package/dist/node.js +13 -11
- package/dist/vendor-_commonjsHelpers.addc3445.js +3 -0
- package/dist/{vendor-entry.5c1e6d94.js → vendor-entry.7d6cc1fd.js} +26 -85
- package/dist/{vendor-index.3ff91c47.js → vendor-index.6c69a0a8.js} +5 -5
- package/dist/worker.js +6 -5
- package/package.json +8 -7
- package/dist/chunk-integrations-globals.cf24723d.js +0 -25
package/dist/node.d.ts
CHANGED
|
@@ -393,6 +393,9 @@ declare type BuiltinReporters = keyof typeof ReportersMap;
|
|
|
393
393
|
declare type Awaitable<T> = T | PromiseLike<T>;
|
|
394
394
|
declare type Arrayable<T> = T | Array<T>;
|
|
395
395
|
declare type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
|
|
396
|
+
interface Constructable {
|
|
397
|
+
new (...args: any[]): any;
|
|
398
|
+
}
|
|
396
399
|
interface UserConsoleLog {
|
|
397
400
|
content: string;
|
|
398
401
|
type: 'stdout' | 'stderr';
|
|
@@ -994,6 +997,218 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
|
|
|
994
997
|
api?: ApiConfig;
|
|
995
998
|
}
|
|
996
999
|
|
|
1000
|
+
declare type VitestInlineConfig = InlineConfig;
|
|
1001
|
+
declare module 'vite' {
|
|
1002
|
+
interface UserConfig {
|
|
1003
|
+
/**
|
|
1004
|
+
* Options for Vitest
|
|
1005
|
+
*/
|
|
1006
|
+
test?: VitestInlineConfig;
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
declare type Formatter = (input: string | number | null | undefined) => string;
|
|
1011
|
+
|
|
1012
|
+
interface MatcherHintOptions {
|
|
1013
|
+
comment?: string;
|
|
1014
|
+
expectedColor?: Formatter;
|
|
1015
|
+
isDirectExpectCall?: boolean;
|
|
1016
|
+
isNot?: boolean;
|
|
1017
|
+
promise?: string;
|
|
1018
|
+
receivedColor?: Formatter;
|
|
1019
|
+
secondArgument?: string;
|
|
1020
|
+
secondArgumentColor?: Formatter;
|
|
1021
|
+
}
|
|
1022
|
+
interface DiffOptions {
|
|
1023
|
+
aAnnotation?: string;
|
|
1024
|
+
aColor?: Formatter;
|
|
1025
|
+
aIndicator?: string;
|
|
1026
|
+
bAnnotation?: string;
|
|
1027
|
+
bColor?: Formatter;
|
|
1028
|
+
bIndicator?: string;
|
|
1029
|
+
changeColor?: Formatter;
|
|
1030
|
+
changeLineTrailingSpaceColor?: Formatter;
|
|
1031
|
+
commonColor?: Formatter;
|
|
1032
|
+
commonIndicator?: string;
|
|
1033
|
+
commonLineTrailingSpaceColor?: Formatter;
|
|
1034
|
+
contextLines?: number;
|
|
1035
|
+
emptyFirstOrLastLinePlaceholder?: string;
|
|
1036
|
+
expand?: boolean;
|
|
1037
|
+
includeChangeCounts?: boolean;
|
|
1038
|
+
omitAnnotationLines?: boolean;
|
|
1039
|
+
patchColor?: Formatter;
|
|
1040
|
+
compareKeys?: any;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
declare const EXPECTED_COLOR: Formatter;
|
|
1044
|
+
declare const RECEIVED_COLOR: Formatter;
|
|
1045
|
+
declare const INVERTED_COLOR: Formatter;
|
|
1046
|
+
declare const BOLD_WEIGHT: Formatter;
|
|
1047
|
+
declare const DIM_COLOR: Formatter;
|
|
1048
|
+
declare function matcherHint(matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions): string;
|
|
1049
|
+
declare function stringify(object: unknown, maxDepth?: number, options?: PrettyFormatOptions): string;
|
|
1050
|
+
declare const printReceived: (object: unknown) => string;
|
|
1051
|
+
declare const printExpected: (value: unknown) => string;
|
|
1052
|
+
declare function diff(a: any, b: any, options?: DiffOptions): string;
|
|
1053
|
+
|
|
1054
|
+
declare const jestMatcherUtils_EXPECTED_COLOR: typeof EXPECTED_COLOR;
|
|
1055
|
+
declare const jestMatcherUtils_RECEIVED_COLOR: typeof RECEIVED_COLOR;
|
|
1056
|
+
declare const jestMatcherUtils_INVERTED_COLOR: typeof INVERTED_COLOR;
|
|
1057
|
+
declare const jestMatcherUtils_BOLD_WEIGHT: typeof BOLD_WEIGHT;
|
|
1058
|
+
declare const jestMatcherUtils_DIM_COLOR: typeof DIM_COLOR;
|
|
1059
|
+
declare const jestMatcherUtils_matcherHint: typeof matcherHint;
|
|
1060
|
+
declare const jestMatcherUtils_stringify: typeof stringify;
|
|
1061
|
+
declare const jestMatcherUtils_printReceived: typeof printReceived;
|
|
1062
|
+
declare const jestMatcherUtils_printExpected: typeof printExpected;
|
|
1063
|
+
declare const jestMatcherUtils_diff: typeof diff;
|
|
1064
|
+
declare namespace jestMatcherUtils {
|
|
1065
|
+
export {
|
|
1066
|
+
jestMatcherUtils_EXPECTED_COLOR as EXPECTED_COLOR,
|
|
1067
|
+
jestMatcherUtils_RECEIVED_COLOR as RECEIVED_COLOR,
|
|
1068
|
+
jestMatcherUtils_INVERTED_COLOR as INVERTED_COLOR,
|
|
1069
|
+
jestMatcherUtils_BOLD_WEIGHT as BOLD_WEIGHT,
|
|
1070
|
+
jestMatcherUtils_DIM_COLOR as DIM_COLOR,
|
|
1071
|
+
jestMatcherUtils_matcherHint as matcherHint,
|
|
1072
|
+
jestMatcherUtils_stringify as stringify,
|
|
1073
|
+
jestMatcherUtils_printReceived as printReceived,
|
|
1074
|
+
jestMatcherUtils_printExpected as printExpected,
|
|
1075
|
+
jestMatcherUtils_diff as diff,
|
|
1076
|
+
};
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
declare type Tester = (a: any, b: any) => boolean | undefined;
|
|
1080
|
+
interface MatcherState {
|
|
1081
|
+
assertionCalls: number;
|
|
1082
|
+
currentTestName?: string;
|
|
1083
|
+
dontThrow?: () => void;
|
|
1084
|
+
error?: Error;
|
|
1085
|
+
equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean;
|
|
1086
|
+
expand?: boolean;
|
|
1087
|
+
expectedAssertionsNumber?: number | null;
|
|
1088
|
+
expectedAssertionsNumberErrorGen?: (() => Error) | null;
|
|
1089
|
+
isExpectingAssertions?: boolean;
|
|
1090
|
+
isExpectingAssertionsError?: Error | null;
|
|
1091
|
+
isNot: boolean;
|
|
1092
|
+
promise: string;
|
|
1093
|
+
suppressedErrors: Array<Error>;
|
|
1094
|
+
testPath?: string;
|
|
1095
|
+
utils: typeof jestMatcherUtils & {
|
|
1096
|
+
iterableEquality: Tester;
|
|
1097
|
+
subsetEquality: Tester;
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
interface SyncExpectationResult {
|
|
1101
|
+
pass: boolean;
|
|
1102
|
+
message: () => string;
|
|
1103
|
+
actual?: any;
|
|
1104
|
+
expected?: any;
|
|
1105
|
+
}
|
|
1106
|
+
declare type AsyncExpectationResult = Promise<SyncExpectationResult>;
|
|
1107
|
+
declare type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;
|
|
1108
|
+
interface RawMatcherFn<T extends MatcherState = MatcherState> {
|
|
1109
|
+
(this: T, received: any, expected: any, options?: any): ExpectationResult;
|
|
1110
|
+
}
|
|
1111
|
+
declare type MatchersObject<T extends MatcherState = MatcherState> = Record<string, RawMatcherFn<T>>;
|
|
1112
|
+
|
|
1113
|
+
declare type Promisify<O> = {
|
|
1114
|
+
[K in keyof O]: O[K] extends (...args: infer A) => infer R ? O extends R ? Promisify<O[K]> : (...args: A) => Promise<R> : O[K];
|
|
1115
|
+
};
|
|
1116
|
+
declare global {
|
|
1117
|
+
namespace jest {
|
|
1118
|
+
interface Matchers<R, T = {}> {
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
namespace Vi {
|
|
1122
|
+
interface ExpectStatic extends Chai.ExpectStatic, AsymmetricMatchersContaining {
|
|
1123
|
+
<T>(actual: T, message?: string): Vi.Assertion<T>;
|
|
1124
|
+
extend(expects: MatchersObject): void;
|
|
1125
|
+
assertions(expected: number): void;
|
|
1126
|
+
hasAssertions(): void;
|
|
1127
|
+
anything(): any;
|
|
1128
|
+
any(constructor: unknown): any;
|
|
1129
|
+
addSnapshotSerializer(plugin: Plugin): void;
|
|
1130
|
+
getState(): MatcherState;
|
|
1131
|
+
setState(state: Partial<MatcherState>): void;
|
|
1132
|
+
not: AsymmetricMatchersContaining;
|
|
1133
|
+
}
|
|
1134
|
+
interface AsymmetricMatchersContaining {
|
|
1135
|
+
stringContaining(expected: string): any;
|
|
1136
|
+
objectContaining(expected: any): any;
|
|
1137
|
+
arrayContaining<T = unknown>(expected: Array<T>): any;
|
|
1138
|
+
stringMatching(expected: string | RegExp): any;
|
|
1139
|
+
}
|
|
1140
|
+
interface JestAssertion<T = any> extends jest.Matchers<void, T> {
|
|
1141
|
+
toMatchSnapshot<U extends {
|
|
1142
|
+
[P in keyof T]: any;
|
|
1143
|
+
}>(snapshot: Partial<U>, message?: string): void;
|
|
1144
|
+
toMatchSnapshot(message?: string): void;
|
|
1145
|
+
matchSnapshot<U extends {
|
|
1146
|
+
[P in keyof T]: any;
|
|
1147
|
+
}>(snapshot: Partial<U>, message?: string): void;
|
|
1148
|
+
matchSnapshot(message?: string): void;
|
|
1149
|
+
toMatchInlineSnapshot<U extends {
|
|
1150
|
+
[P in keyof T]: any;
|
|
1151
|
+
}>(properties: Partial<U>, snapshot?: string, message?: string): void;
|
|
1152
|
+
toMatchInlineSnapshot(snapshot?: string, message?: string): void;
|
|
1153
|
+
toThrowErrorMatchingSnapshot(message?: string): void;
|
|
1154
|
+
toThrowErrorMatchingInlineSnapshot(snapshot?: string, message?: string): void;
|
|
1155
|
+
toEqual<E>(expected: E): void;
|
|
1156
|
+
toStrictEqual<E>(expected: E): void;
|
|
1157
|
+
toBe<E>(expected: E): void;
|
|
1158
|
+
toMatch(expected: string | RegExp): void;
|
|
1159
|
+
toMatchObject<E extends {} | any[]>(expected: E): void;
|
|
1160
|
+
toContain<E>(item: E): void;
|
|
1161
|
+
toContainEqual<E>(item: E): void;
|
|
1162
|
+
toBeTruthy(): void;
|
|
1163
|
+
toBeFalsy(): void;
|
|
1164
|
+
toBeGreaterThan(num: number | bigint): void;
|
|
1165
|
+
toBeGreaterThanOrEqual(num: number | bigint): void;
|
|
1166
|
+
toBeLessThan(num: number | bigint): void;
|
|
1167
|
+
toBeLessThanOrEqual(num: number | bigint): void;
|
|
1168
|
+
toBeNaN(): void;
|
|
1169
|
+
toBeUndefined(): void;
|
|
1170
|
+
toBeNull(): void;
|
|
1171
|
+
toBeDefined(): void;
|
|
1172
|
+
toBeTypeOf(expected: 'bigint' | 'boolean' | 'function' | 'number' | 'object' | 'string' | 'symbol' | 'undefined'): void;
|
|
1173
|
+
toBeInstanceOf<E>(expected: E): void;
|
|
1174
|
+
toBeCalledTimes(times: number): void;
|
|
1175
|
+
toHaveLength(length: number): void;
|
|
1176
|
+
toHaveProperty<E>(property: string | string[], value?: E): void;
|
|
1177
|
+
toBeCloseTo(number: number, numDigits?: number): void;
|
|
1178
|
+
toHaveBeenCalledTimes(times: number): void;
|
|
1179
|
+
toHaveBeenCalledOnce(): void;
|
|
1180
|
+
toHaveBeenCalled(): void;
|
|
1181
|
+
toBeCalled(): void;
|
|
1182
|
+
toHaveBeenCalledWith<E extends any[]>(...args: E): void;
|
|
1183
|
+
toBeCalledWith<E extends any[]>(...args: E): void;
|
|
1184
|
+
toHaveBeenNthCalledWith<E extends any[]>(n: number, ...args: E): void;
|
|
1185
|
+
nthCalledWith<E extends any[]>(nthCall: number, ...args: E): void;
|
|
1186
|
+
toHaveBeenLastCalledWith<E extends any[]>(...args: E): void;
|
|
1187
|
+
lastCalledWith<E extends any[]>(...args: E): void;
|
|
1188
|
+
toThrow(expected?: string | Constructable | RegExp | Error): void;
|
|
1189
|
+
toThrowError(expected?: string | Constructable | RegExp | Error): void;
|
|
1190
|
+
toReturn(): void;
|
|
1191
|
+
toHaveReturned(): void;
|
|
1192
|
+
toReturnTimes(times: number): void;
|
|
1193
|
+
toHaveReturnedTimes(times: number): void;
|
|
1194
|
+
toReturnWith<E>(value: E): void;
|
|
1195
|
+
toHaveReturnedWith<E>(value: E): void;
|
|
1196
|
+
toHaveLastReturnedWith<E>(value: E): void;
|
|
1197
|
+
lastReturnedWith<E>(value: E): void;
|
|
1198
|
+
toHaveNthReturnedWith<E>(nthCall: number, value: E): void;
|
|
1199
|
+
nthReturnedWith<E>(nthCall: number, value: E): void;
|
|
1200
|
+
toSatisfy<E>(matcher: (value: E) => boolean, message?: string): void;
|
|
1201
|
+
}
|
|
1202
|
+
type VitestAssertion<A, T> = {
|
|
1203
|
+
[K in keyof A]: A[K] extends Chai.Assertion ? Assertion<T> : A[K] extends (...args: any[]) => any ? A[K] : VitestAssertion<A[K], T>;
|
|
1204
|
+
} & ((type: string, message?: string) => Assertion);
|
|
1205
|
+
interface Assertion<T = any> extends VitestAssertion<Chai.Assertion, T>, JestAssertion<T> {
|
|
1206
|
+
resolves: Promisify<Assertion<T>>;
|
|
1207
|
+
rejects: Promisify<Assertion<T>>;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
|
|
997
1212
|
declare type MockMap = Map<string, Record<string, string | null | (() => unknown)>>;
|
|
998
1213
|
|
|
999
1214
|
declare class SnapshotManager {
|
package/dist/node.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.
|
|
2
|
-
export { V as VitestRunner } from './chunk-runtime-mocker.
|
|
1
|
+
export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.0aac0c8e.js';
|
|
2
|
+
export { V as VitestRunner } from './chunk-runtime-mocker.42fa71a8.js';
|
|
3
3
|
import 'buffer';
|
|
4
4
|
import 'path';
|
|
5
5
|
import 'child_process';
|
|
6
6
|
import 'process';
|
|
7
|
-
import './vendor-index.
|
|
8
|
-
import './
|
|
9
|
-
import 'tty';
|
|
10
|
-
import 'local-pkg';
|
|
7
|
+
import './vendor-index.6c69a0a8.js';
|
|
8
|
+
import './vendor-_commonjsHelpers.addc3445.js';
|
|
11
9
|
import 'fs';
|
|
12
10
|
import 'assert';
|
|
13
11
|
import 'events';
|
|
@@ -15,16 +13,20 @@ import 'stream';
|
|
|
15
13
|
import 'util';
|
|
16
14
|
import 'url';
|
|
17
15
|
import 'os';
|
|
16
|
+
import './chunk-utils-global.2fab7e5c.js';
|
|
17
|
+
import 'tty';
|
|
18
|
+
import 'local-pkg';
|
|
18
19
|
import 'vite';
|
|
19
|
-
import './chunk-constants.
|
|
20
|
+
import './chunk-constants.3570739f.js';
|
|
20
21
|
import 'readline';
|
|
21
|
-
import './chunk-vite-node-utils.
|
|
22
|
+
import './chunk-vite-node-utils.9975fd9e.js';
|
|
22
23
|
import 'module';
|
|
23
24
|
import 'vm';
|
|
24
|
-
import '
|
|
25
|
+
import 'debug';
|
|
26
|
+
import './chunk-defaults.7d81a6ca.js';
|
|
25
27
|
import 'worker_threads';
|
|
26
28
|
import 'tinypool';
|
|
27
29
|
import 'perf_hooks';
|
|
28
|
-
import './chunk-utils-timers.
|
|
29
|
-
import './chunk-magic-string.
|
|
30
|
+
import './chunk-utils-timers.da6ac0a6.js';
|
|
31
|
+
import './chunk-magic-string.41232190.js';
|
|
30
32
|
import './vendor-index.405e58ef.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
|
-
import {
|
|
2
|
+
import { m as isNode, a as getWorkerState, t as toArray, H as clone, F as getType, l as relative, I as partitionSuiteChildren, J as hasTests, u as hasFailed, q as getFullName, r as resetModules } from './chunk-utils-global.2fab7e5c.js';
|
|
3
3
|
import { importModule } from 'local-pkg';
|
|
4
|
-
import { s as suite, t as test, d as describe, i as it, r as runOnce, a as isFirstRun, b as beforeAll, c as afterAll, e as beforeEach, f as afterEach, w as withCallback, g as createExpect, h as expect, v as vitest, j as vi, k as getRunningMode, l as isWatchMode, m as
|
|
4
|
+
import { s as suite, t as test, d as describe, i as it, r as runOnce, a as isFirstRun, b as beforeAll, c as afterAll, e as beforeEach, f as afterEach, w as withCallback, g as createExpect, h as expect, v as vitest, j as vi, k as getRunningMode, l as isWatchMode, m as resetRunOnceCounter, R as RealDate, n as clearCollectorContext, o as defaultSuite, p as setHooks, q as getHooks, u as collectorContext, x as getSnapshotClient, y as setState, z as getFn, A as getState } from './chunk-runtime-chain.5021a6b6.js';
|
|
5
5
|
import chai, { assert, should, util } from 'chai';
|
|
6
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
7
|
-
import { d as clearTimeout, c as setTimeout, s as stringify } from './chunk-utils-timers.
|
|
8
|
-
import { t as takeCoverage } from './chunk-defaults.
|
|
6
|
+
import { r as rpc } from './chunk-runtime-rpc.47bae3f9.js';
|
|
7
|
+
import { d as clearTimeout, c as setTimeout, s as stringify } from './chunk-utils-timers.da6ac0a6.js';
|
|
8
|
+
import { t as takeCoverage } from './chunk-defaults.7d81a6ca.js';
|
|
9
9
|
import { format } from 'util';
|
|
10
10
|
|
|
11
11
|
var index = /*#__PURE__*/Object.freeze({
|
|
@@ -29,8 +29,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
29
29
|
vitest: vitest,
|
|
30
30
|
vi: vi,
|
|
31
31
|
getRunningMode: getRunningMode,
|
|
32
|
-
isWatchMode: isWatchMode
|
|
33
|
-
toString: toString
|
|
32
|
+
isWatchMode: isWatchMode
|
|
34
33
|
});
|
|
35
34
|
|
|
36
35
|
var node = {
|
|
@@ -285,15 +284,16 @@ function getWindowKeys(global, win) {
|
|
|
285
284
|
function populateGlobal(global, win, options = {}) {
|
|
286
285
|
const { bindFunctions = false } = options;
|
|
287
286
|
const keys = getWindowKeys(global, win);
|
|
287
|
+
const originals = new Map(allowRewrite.map(([key]) => [key, global[key]]));
|
|
288
288
|
const overrideObject = /* @__PURE__ */ new Map();
|
|
289
289
|
for (const key of keys) {
|
|
290
|
-
const
|
|
290
|
+
const bindedFunction = bindFunctions && typeof win[key] === "function" && win[key].bind(win);
|
|
291
291
|
Object.defineProperty(global, key, {
|
|
292
292
|
get() {
|
|
293
293
|
if (overrideObject.has(key))
|
|
294
294
|
return overrideObject.get(key);
|
|
295
|
-
if (
|
|
296
|
-
return
|
|
295
|
+
if (bindedFunction)
|
|
296
|
+
return bindedFunction;
|
|
297
297
|
return win[key];
|
|
298
298
|
},
|
|
299
299
|
set(v) {
|
|
@@ -302,76 +302,16 @@ function populateGlobal(global, win, options = {}) {
|
|
|
302
302
|
configurable: true
|
|
303
303
|
});
|
|
304
304
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
if (overrideObject.has(p))
|
|
309
|
-
return overrideObject.get(p);
|
|
310
|
-
return Reflect.get(target, p, receiver);
|
|
311
|
-
},
|
|
312
|
-
set(target, p, value, receiver) {
|
|
313
|
-
try {
|
|
314
|
-
Object.defineProperty(global, p, {
|
|
315
|
-
get: () => overrideObject.get(p),
|
|
316
|
-
set: (value2) => overrideObject.set(p, value2),
|
|
317
|
-
configurable: true
|
|
318
|
-
});
|
|
319
|
-
overrideObject.set(p, value);
|
|
320
|
-
Reflect.set(target, p, value, receiver);
|
|
321
|
-
} catch {
|
|
322
|
-
}
|
|
323
|
-
return true;
|
|
324
|
-
},
|
|
325
|
-
deleteProperty(target, p) {
|
|
326
|
-
Reflect.deleteProperty(global, p);
|
|
327
|
-
overrideObject.delete(p);
|
|
328
|
-
return Reflect.deleteProperty(target, p);
|
|
329
|
-
},
|
|
330
|
-
defineProperty(target, p, attributes) {
|
|
331
|
-
if (attributes.writable && "value" in attributes) ; else if (attributes.get) {
|
|
332
|
-
overrideObject.delete(p);
|
|
333
|
-
Reflect.defineProperty(global, p, attributes);
|
|
334
|
-
}
|
|
335
|
-
return Reflect.defineProperty(target, p, attributes);
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
globalKeys.forEach((key) => {
|
|
339
|
-
if (!win[key])
|
|
340
|
-
return;
|
|
341
|
-
Object.defineProperty(global, key, {
|
|
342
|
-
get() {
|
|
343
|
-
return globalProxy;
|
|
344
|
-
},
|
|
345
|
-
configurable: true
|
|
346
|
-
});
|
|
347
|
-
});
|
|
348
|
-
const globalThisProxy = new Proxy(global.globalThis, {
|
|
349
|
-
set(target, key, value, receiver) {
|
|
350
|
-
overrideObject.set(key, value);
|
|
351
|
-
return Reflect.set(target, key, value, receiver);
|
|
352
|
-
},
|
|
353
|
-
deleteProperty(target, key) {
|
|
354
|
-
overrideObject.delete(key);
|
|
355
|
-
return Reflect.deleteProperty(target, key);
|
|
356
|
-
},
|
|
357
|
-
defineProperty(target, p, attributes) {
|
|
358
|
-
if (attributes.writable && "value" in attributes) ; else if (attributes.get && !globalKeys.has(p)) {
|
|
359
|
-
globalKeys.forEach((key) => {
|
|
360
|
-
if (win[key])
|
|
361
|
-
Object.defineProperty(win[key], p, attributes);
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
return Reflect.defineProperty(target, p, attributes);
|
|
365
|
-
}
|
|
366
|
-
});
|
|
367
|
-
global.globalThis = globalThisProxy;
|
|
305
|
+
global.window = global;
|
|
306
|
+
global.self = global;
|
|
307
|
+
global.top = global;
|
|
368
308
|
if (global.global)
|
|
369
|
-
global.global =
|
|
309
|
+
global.global = global;
|
|
370
310
|
skipKeys.forEach((k) => keys.add(k));
|
|
371
311
|
return {
|
|
372
312
|
keys,
|
|
373
313
|
skipKeys,
|
|
374
|
-
|
|
314
|
+
originals
|
|
375
315
|
};
|
|
376
316
|
}
|
|
377
317
|
|
|
@@ -446,8 +386,7 @@ var jsdom = {
|
|
|
446
386
|
contentType,
|
|
447
387
|
userAgent
|
|
448
388
|
}, restOptions));
|
|
449
|
-
const { keys,
|
|
450
|
-
const originals = new Map(allowRewrite.map(([key]) => [key, global[key]]));
|
|
389
|
+
const { keys, originals } = populateGlobal(global, dom.window, { bindFunctions: true });
|
|
451
390
|
return {
|
|
452
391
|
teardown(global2) {
|
|
453
392
|
keys.forEach((key) => delete global2[key]);
|
|
@@ -462,8 +401,7 @@ var happy = {
|
|
|
462
401
|
async setup(global) {
|
|
463
402
|
const { Window, GlobalWindow } = await importModule("happy-dom");
|
|
464
403
|
const win = new (GlobalWindow || Window)();
|
|
465
|
-
const { keys,
|
|
466
|
-
const originals = new Map(allowRewrite.map(([key]) => [key, global[key]]));
|
|
404
|
+
const { keys, originals } = populateGlobal(global, win, { bindFunctions: true });
|
|
467
405
|
return {
|
|
468
406
|
teardown(global2) {
|
|
469
407
|
win.happyDOM.cancelAsync();
|
|
@@ -494,7 +432,7 @@ async function setupGlobalEnv(config) {
|
|
|
494
432
|
if (isNode)
|
|
495
433
|
await setupConsoleLogSpy();
|
|
496
434
|
if (config.globals)
|
|
497
|
-
(await import('./chunk-integrations-globals.
|
|
435
|
+
(await import('./chunk-integrations-globals.36dc71fa.js')).registerApiGlobally();
|
|
498
436
|
}
|
|
499
437
|
function setupDefines(defines) {
|
|
500
438
|
for (const key in defines)
|
|
@@ -678,14 +616,17 @@ function processError(err) {
|
|
|
678
616
|
err.expected = stringify(err.expected);
|
|
679
617
|
if (typeof err.actual !== "string")
|
|
680
618
|
err.actual = stringify(err.actual);
|
|
681
|
-
|
|
682
|
-
err.message
|
|
683
|
-
|
|
684
|
-
err.cause
|
|
619
|
+
try {
|
|
620
|
+
if (typeof err.message === "string")
|
|
621
|
+
err.message = normalizeErrorMessage(err.message);
|
|
622
|
+
if (typeof err.cause === "object" && err.cause.message === "string")
|
|
623
|
+
err.cause.message = normalizeErrorMessage(err.cause.message);
|
|
624
|
+
} catch {
|
|
625
|
+
}
|
|
685
626
|
try {
|
|
686
627
|
return serializeError(err);
|
|
687
628
|
} catch (e) {
|
|
688
|
-
return serializeError(new Error(`Failed to fully serialize error: ${e == null ? void 0 : e.message}
|
|
629
|
+
return serializeError(new Error(`Failed to fully serialize error: ${e == null ? void 0 : e.message}
|
|
689
630
|
Inner error message: ${err == null ? void 0 : err.message}`));
|
|
690
631
|
}
|
|
691
632
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import childProcess from 'child_process';
|
|
2
2
|
import path$3 from 'path';
|
|
3
|
-
import { c as commonjsGlobal } from './
|
|
3
|
+
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
4
4
|
import fs$1 from 'fs';
|
|
5
5
|
import assert$1 from 'assert';
|
|
6
6
|
import require$$2 from 'events';
|
|
7
|
-
import require$$0$
|
|
7
|
+
import require$$0$2 from 'buffer';
|
|
8
8
|
import require$$0 from 'stream';
|
|
9
|
-
import require$$1 from 'util';
|
|
9
|
+
import require$$0$1 from 'util';
|
|
10
10
|
|
|
11
11
|
var crossSpawn = {exports: {}};
|
|
12
12
|
|
|
@@ -961,9 +961,9 @@ var bufferStream$1 = options => {
|
|
|
961
961
|
return stream;
|
|
962
962
|
};
|
|
963
963
|
|
|
964
|
-
const {constants: BufferConstants} = require$$0$
|
|
964
|
+
const {constants: BufferConstants} = require$$0$2;
|
|
965
965
|
const stream = require$$0;
|
|
966
|
-
const {promisify} = require$$1;
|
|
966
|
+
const {promisify} = require$$0$1;
|
|
967
967
|
const bufferStream = bufferStream$1;
|
|
968
968
|
|
|
969
969
|
const streamPipelinePromisified = promisify(stream.pipeline);
|
package/dist/worker.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { d as distDir } from './chunk-constants.
|
|
4
|
-
import { e as executeInViteNode } from './chunk-runtime-mocker.
|
|
5
|
-
import { r as rpc } from './chunk-runtime-rpc.
|
|
1
|
+
import { h as resolve, a as getWorkerState } from './chunk-utils-global.2fab7e5c.js';
|
|
2
|
+
import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.9975fd9e.js';
|
|
3
|
+
import { d as distDir } from './chunk-constants.3570739f.js';
|
|
4
|
+
import { e as executeInViteNode } from './chunk-runtime-mocker.42fa71a8.js';
|
|
5
|
+
import { r as rpc } from './chunk-runtime-rpc.47bae3f9.js';
|
|
6
6
|
import 'tty';
|
|
7
7
|
import 'local-pkg';
|
|
8
8
|
import 'path';
|
|
@@ -12,6 +12,7 @@ import 'vm';
|
|
|
12
12
|
import 'fs';
|
|
13
13
|
import 'assert';
|
|
14
14
|
import 'util';
|
|
15
|
+
import 'debug';
|
|
15
16
|
import 'vite';
|
|
16
17
|
|
|
17
18
|
let _viteNode;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.12.
|
|
4
|
+
"version": "0.12.7",
|
|
5
5
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"vite",
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"@types/chai": "^4.3.1",
|
|
79
79
|
"@types/chai-subset": "^1.3.3",
|
|
80
80
|
"chai": "^4.3.6",
|
|
81
|
+
"debug": "^4.3.4",
|
|
81
82
|
"local-pkg": "^0.4.1",
|
|
82
83
|
"tinypool": "^0.1.3",
|
|
83
84
|
"tinyspy": "^0.3.2",
|
|
@@ -90,10 +91,10 @@
|
|
|
90
91
|
"@types/jsdom": "^16.2.14",
|
|
91
92
|
"@types/micromatch": "^4.0.2",
|
|
92
93
|
"@types/natural-compare": "^1.4.1",
|
|
93
|
-
"@types/node": "^17.0.
|
|
94
|
+
"@types/node": "^17.0.33",
|
|
94
95
|
"@types/prompts": "^2.4.0",
|
|
95
96
|
"@types/sinonjs__fake-timers": "^8.1.2",
|
|
96
|
-
"@vitest/ui": "0.12.
|
|
97
|
+
"@vitest/ui": "0.12.7",
|
|
97
98
|
"birpc": "^0.2.2",
|
|
98
99
|
"c8": "^7.11.2",
|
|
99
100
|
"cac": "^6.7.12",
|
|
@@ -104,10 +105,10 @@
|
|
|
104
105
|
"fast-glob": "^3.2.11",
|
|
105
106
|
"find-up": "^6.3.0",
|
|
106
107
|
"flatted": "^3.2.5",
|
|
107
|
-
"happy-dom": "^3.
|
|
108
|
+
"happy-dom": "^3.2.0",
|
|
108
109
|
"jsdom": "^19.0.0",
|
|
109
110
|
"log-update": "^5.0.1",
|
|
110
|
-
"magic-string": "^0.26.
|
|
111
|
+
"magic-string": "^0.26.2",
|
|
111
112
|
"micromatch": "^4.0.5",
|
|
112
113
|
"mlly": "^0.5.2",
|
|
113
114
|
"natural-compare": "^1.4.0",
|
|
@@ -116,11 +117,11 @@
|
|
|
116
117
|
"pkg-types": "^0.3.2",
|
|
117
118
|
"pretty-format": "^27.5.1",
|
|
118
119
|
"prompts": "^2.4.2",
|
|
119
|
-
"rollup": "^2.
|
|
120
|
+
"rollup": "^2.73.0",
|
|
120
121
|
"source-map-js": "^1.0.2",
|
|
121
122
|
"strip-ansi": "^7.0.1",
|
|
122
123
|
"typescript": "^4.6.4",
|
|
123
|
-
"vite-node": "0.12.
|
|
124
|
+
"vite-node": "0.12.7",
|
|
124
125
|
"ws": "^8.6.0"
|
|
125
126
|
},
|
|
126
127
|
"engines": {
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { g as globalApis } from './chunk-constants.7180775c.js';
|
|
2
|
-
import { i as index } from './vendor-entry.5c1e6d94.js';
|
|
3
|
-
import 'url';
|
|
4
|
-
import './chunk-utils-global.29e8a0a3.js';
|
|
5
|
-
import 'tty';
|
|
6
|
-
import 'local-pkg';
|
|
7
|
-
import 'path';
|
|
8
|
-
import 'fs';
|
|
9
|
-
import './chunk-runtime-chain.5cae775c.js';
|
|
10
|
-
import 'chai';
|
|
11
|
-
import './chunk-runtime-rpc.ad208eea.js';
|
|
12
|
-
import './chunk-utils-timers.64f2cbe8.js';
|
|
13
|
-
import './chunk-integrations-spy.bee66426.js';
|
|
14
|
-
import 'tinyspy';
|
|
15
|
-
import 'util';
|
|
16
|
-
import './chunk-defaults.9e0c233e.js';
|
|
17
|
-
import 'module';
|
|
18
|
-
|
|
19
|
-
function registerApiGlobally() {
|
|
20
|
-
globalApis.forEach((api) => {
|
|
21
|
-
globalThis[api] = index[api];
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { registerApiGlobally };
|