vitest 0.12.5 → 0.12.8

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.
Files changed (27) hide show
  1. package/LICENSE.md +0 -72
  2. package/dist/{chunk-api-setup.62de6413.js → chunk-api-setup.9ccd19b5.js} +5 -4
  3. package/dist/{chunk-constants.153353ee.js → chunk-constants.3570739f.js} +1 -1
  4. package/dist/{chunk-defaults.374342ed.js → chunk-defaults.7d81a6ca.js} +1 -1
  5. package/dist/{chunk-install-pkg.eb979c48.js → chunk-install-pkg.fd8d1022.js} +9 -11
  6. package/dist/chunk-integrations-globals.23cc66c3.js +26 -0
  7. package/dist/{chunk-magic-string.d5e0e473.js → chunk-magic-string.41232190.js} +0 -4
  8. package/dist/{chunk-runtime-chain.eb563278.js → chunk-runtime-chain.5021a6b6.js} +44 -10
  9. package/dist/{chunk-runtime-mocker.efd6b7ac.js → chunk-runtime-mocker.d26f8110.js} +8 -7
  10. package/dist/{chunk-runtime-rpc.ef131645.js → chunk-runtime-rpc.47bae3f9.js} +1 -1
  11. package/dist/{chunk-utils-global.03413604.js → chunk-utils-global.2fab7e5c.js} +3 -9
  12. package/dist/{chunk-utils-timers.a0f0fe66.js → chunk-utils-timers.da6ac0a6.js} +3 -2
  13. package/dist/{chunk-vite-node-externalize.8560ca65.js → chunk-vite-node-externalize.fc385bba.js} +67 -58
  14. package/dist/{chunk-vite-node-utils.1064f66b.js → chunk-vite-node-utils.46e2a803.js} +8 -1064
  15. package/dist/cli.js +11 -9
  16. package/dist/config.d.ts +6 -3
  17. package/dist/entry.js +7 -6
  18. package/dist/index.d.ts +247 -249
  19. package/dist/index.js +5 -4
  20. package/dist/node.d.ts +215 -0
  21. package/dist/node.js +13 -11
  22. package/dist/vendor-_commonjsHelpers.addc3445.js +3 -0
  23. package/dist/{vendor-entry.5b810598.js → vendor-entry.ca05c118.js} +28 -83
  24. package/dist/{vendor-index.4e550a2c.js → vendor-index.6c69a0a8.js} +5 -5
  25. package/dist/worker.js +6 -5
  26. package/package.json +8 -7
  27. package/dist/chunk-integrations-globals.4fea033a.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.8560ca65.js';
2
- export { V as VitestRunner } from './chunk-runtime-mocker.efd6b7ac.js';
1
+ export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.fc385bba.js';
2
+ export { V as VitestRunner } from './chunk-runtime-mocker.d26f8110.js';
3
3
  import 'buffer';
4
4
  import 'path';
5
5
  import 'child_process';
6
6
  import 'process';
7
- import './vendor-index.4e550a2c.js';
8
- import './chunk-utils-global.03413604.js';
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.153353ee.js';
20
+ import './chunk-constants.3570739f.js';
20
21
  import 'readline';
21
- import './chunk-vite-node-utils.1064f66b.js';
22
+ import './chunk-vite-node-utils.46e2a803.js';
22
23
  import 'module';
23
24
  import 'vm';
24
- import './chunk-defaults.374342ed.js';
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.a0f0fe66.js';
29
- import './chunk-magic-string.d5e0e473.js';
30
+ import './chunk-utils-timers.da6ac0a6.js';
31
+ import './chunk-magic-string.41232190.js';
30
32
  import './vendor-index.405e58ef.js';
@@ -0,0 +1,3 @@
1
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
+
3
+ export { commonjsGlobal as c };
@@ -1,11 +1,11 @@
1
1
  import { promises } from 'fs';
2
- import { I as isNode, a as getWorkerState, t as toArray, J as clone, G as getType, m as relative, K as partitionSuiteChildren, L as hasTests, u as hasFailed, q as getFullName, r as resetModules } from './chunk-utils-global.03413604.js';
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 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.eb563278.js';
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.ef131645.js';
7
- import { d as clearTimeout, c as setTimeout, s as stringify } from './chunk-utils-timers.a0f0fe66.js';
8
- import { t as takeCoverage } from './chunk-defaults.374342ed.js';
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({
@@ -281,18 +281,22 @@ function getWindowKeys(global, win) {
281
281
  }));
282
282
  return keys;
283
283
  }
284
+ function isClassLikeName(name) {
285
+ return name[0] === name[0].toUpperCase();
286
+ }
284
287
  function populateGlobal(global, win, options = {}) {
285
288
  const { bindFunctions = false } = options;
286
289
  const keys = getWindowKeys(global, win);
290
+ const originals = new Map(allowRewrite.map(([key]) => [key, global[key]]));
287
291
  const overrideObject = /* @__PURE__ */ new Map();
288
292
  for (const key of keys) {
289
- const shouldBind = bindFunctions && typeof win[key] === "function";
293
+ const boundFunction = bindFunctions && typeof win[key] === "function" && !isClassLikeName(key) && win[key].bind(win);
290
294
  Object.defineProperty(global, key, {
291
295
  get() {
292
296
  if (overrideObject.has(key))
293
297
  return overrideObject.get(key);
294
- if (shouldBind)
295
- return win[key].bind(win);
298
+ if (boundFunction)
299
+ return boundFunction;
296
300
  return win[key];
297
301
  },
298
302
  set(v) {
@@ -301,76 +305,16 @@ function populateGlobal(global, win, options = {}) {
301
305
  configurable: true
302
306
  });
303
307
  }
304
- const globalKeys = /* @__PURE__ */ new Set(["window", "self", "top", "parent"]);
305
- const globalProxy = new Proxy(win.window, {
306
- get(target, p, receiver) {
307
- if (overrideObject.has(p))
308
- return overrideObject.get(p);
309
- return Reflect.get(target, p, receiver);
310
- },
311
- set(target, p, value, receiver) {
312
- try {
313
- Object.defineProperty(global, p, {
314
- get: () => overrideObject.get(p),
315
- set: (value2) => overrideObject.set(p, value2),
316
- configurable: true
317
- });
318
- overrideObject.set(p, value);
319
- Reflect.set(target, p, value, receiver);
320
- } catch {
321
- }
322
- return true;
323
- },
324
- deleteProperty(target, p) {
325
- Reflect.deleteProperty(global, p);
326
- overrideObject.delete(p);
327
- return Reflect.deleteProperty(target, p);
328
- },
329
- defineProperty(target, p, attributes) {
330
- if (attributes.writable && "value" in attributes) ; else if (attributes.get) {
331
- overrideObject.delete(p);
332
- Reflect.defineProperty(global, p, attributes);
333
- }
334
- return Reflect.defineProperty(target, p, attributes);
335
- }
336
- });
337
- globalKeys.forEach((key) => {
338
- if (!win[key])
339
- return;
340
- Object.defineProperty(global, key, {
341
- get() {
342
- return globalProxy;
343
- },
344
- configurable: true
345
- });
346
- });
347
- const globalThisProxy = new Proxy(global.globalThis, {
348
- set(target, key, value, receiver) {
349
- overrideObject.set(key, value);
350
- return Reflect.set(target, key, value, receiver);
351
- },
352
- deleteProperty(target, key) {
353
- overrideObject.delete(key);
354
- return Reflect.deleteProperty(target, key);
355
- },
356
- defineProperty(target, p, attributes) {
357
- if (attributes.writable && "value" in attributes) ; else if (attributes.get && !globalKeys.has(p)) {
358
- globalKeys.forEach((key) => {
359
- if (win[key])
360
- Object.defineProperty(win[key], p, attributes);
361
- });
362
- }
363
- return Reflect.defineProperty(target, p, attributes);
364
- }
365
- });
366
- global.globalThis = globalThisProxy;
308
+ global.window = global;
309
+ global.self = global;
310
+ global.top = global;
367
311
  if (global.global)
368
- global.global = globalThisProxy;
312
+ global.global = global;
369
313
  skipKeys.forEach((k) => keys.add(k));
370
314
  return {
371
315
  keys,
372
316
  skipKeys,
373
- allowRewrite
317
+ originals
374
318
  };
375
319
  }
376
320
 
@@ -445,8 +389,7 @@ var jsdom = {
445
389
  contentType,
446
390
  userAgent
447
391
  }, restOptions));
448
- const { keys, allowRewrite } = populateGlobal(global, dom.window);
449
- const originals = new Map(allowRewrite.map(([key]) => [key, global[key]]));
392
+ const { keys, originals } = populateGlobal(global, dom.window, { bindFunctions: true });
450
393
  return {
451
394
  teardown(global2) {
452
395
  keys.forEach((key) => delete global2[key]);
@@ -461,8 +404,7 @@ var happy = {
461
404
  async setup(global) {
462
405
  const { Window, GlobalWindow } = await importModule("happy-dom");
463
406
  const win = new (GlobalWindow || Window)();
464
- const { keys, allowRewrite } = populateGlobal(global, win, { bindFunctions: true });
465
- const originals = new Map(allowRewrite.map(([key]) => [key, global[key]]));
407
+ const { keys, originals } = populateGlobal(global, win, { bindFunctions: true });
466
408
  return {
467
409
  teardown(global2) {
468
410
  win.happyDOM.cancelAsync();
@@ -493,7 +435,7 @@ async function setupGlobalEnv(config) {
493
435
  if (isNode)
494
436
  await setupConsoleLogSpy();
495
437
  if (config.globals)
496
- (await import('./chunk-integrations-globals.4fea033a.js')).registerApiGlobally();
438
+ (await import('./chunk-integrations-globals.23cc66c3.js')).registerApiGlobally();
497
439
  }
498
440
  function setupDefines(defines) {
499
441
  for (const key in defines)
@@ -677,14 +619,17 @@ function processError(err) {
677
619
  err.expected = stringify(err.expected);
678
620
  if (typeof err.actual !== "string")
679
621
  err.actual = stringify(err.actual);
680
- if (typeof err.message === "string")
681
- err.message = normalizeErrorMessage(err.message);
682
- if (typeof err.cause === "object" && err.cause.message === "string")
683
- err.cause.message = normalizeErrorMessage(err.cause.message);
622
+ try {
623
+ if (typeof err.message === "string")
624
+ err.message = normalizeErrorMessage(err.message);
625
+ if (typeof err.cause === "object" && err.cause.message === "string")
626
+ err.cause.message = normalizeErrorMessage(err.cause.message);
627
+ } catch {
628
+ }
684
629
  try {
685
630
  return serializeError(err);
686
631
  } catch (e) {
687
- return serializeError(new Error(`Failed to fully serialize error: ${e == null ? void 0 : e.message}.
632
+ return serializeError(new Error(`Failed to fully serialize error: ${e == null ? void 0 : e.message}
688
633
  Inner error message: ${err == null ? void 0 : err.message}`));
689
634
  }
690
635
  }
@@ -1,12 +1,12 @@
1
1
  import childProcess from 'child_process';
2
2
  import path$3 from 'path';
3
- import { c as commonjsGlobal } from './chunk-utils-global.03413604.js';
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$1 from 'buffer';
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$1;
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 { k as resolve, a as getWorkerState } from './chunk-utils-global.03413604.js';
2
- import { b as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.1064f66b.js';
3
- import { d as distDir } from './chunk-constants.153353ee.js';
4
- import { e as executeInViteNode } from './chunk-runtime-mocker.efd6b7ac.js';
5
- import { r as rpc } from './chunk-runtime-rpc.ef131645.js';
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.46e2a803.js';
3
+ import { d as distDir } from './chunk-constants.3570739f.js';
4
+ import { e as executeInViteNode } from './chunk-runtime-mocker.d26f8110.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.5",
4
+ "version": "0.12.8",
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.31",
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.5",
97
+ "@vitest/ui": "0.12.8",
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.1.1",
108
+ "happy-dom": "^3.2.0",
108
109
  "jsdom": "^19.0.0",
109
110
  "log-update": "^5.0.1",
110
- "magic-string": "^0.26.1",
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.72.1",
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.5",
124
+ "vite-node": "0.12.8",
124
125
  "ws": "^8.6.0"
125
126
  },
126
127
  "engines": {
@@ -1,25 +0,0 @@
1
- import { g as globalApis } from './chunk-constants.153353ee.js';
2
- import { i as index } from './vendor-entry.5b810598.js';
3
- import 'url';
4
- import './chunk-utils-global.03413604.js';
5
- import 'tty';
6
- import 'local-pkg';
7
- import 'path';
8
- import 'fs';
9
- import './chunk-runtime-chain.eb563278.js';
10
- import 'chai';
11
- import './chunk-runtime-rpc.ef131645.js';
12
- import './chunk-utils-timers.a0f0fe66.js';
13
- import './chunk-integrations-spy.bee66426.js';
14
- import 'tinyspy';
15
- import 'util';
16
- import './chunk-defaults.374342ed.js';
17
- import 'module';
18
-
19
- function registerApiGlobally() {
20
- globalApis.forEach((api) => {
21
- globalThis[api] = index[api];
22
- });
23
- }
24
-
25
- export { registerApiGlobally };