vitest 0.12.7 → 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.
@@ -1,5 +1,5 @@
1
1
  import { promises } from 'fs';
2
- import { c as createBirpc } from './chunk-vite-node-utils.9975fd9e.js';
2
+ import { c as createBirpc } from './chunk-vite-node-utils.46e2a803.js';
3
3
  import require$$0$1 from 'stream';
4
4
  import require$$0 from 'zlib';
5
5
  import require$$3 from 'net';
@@ -1,5 +1,5 @@
1
1
  import { g as globalApis } from './chunk-constants.3570739f.js';
2
- import { i as index } from './vendor-entry.7d6cc1fd.js';
2
+ import { i as index } from './vendor-entry.ca05c118.js';
3
3
  import 'url';
4
4
  import './chunk-utils-global.2fab7e5c.js';
5
5
  import 'tty';
@@ -1,4 +1,4 @@
1
- import { n as normalizeRequestId, i as isNodeBuiltin, t as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.9975fd9e.js';
1
+ import { n as normalizeRequestId, i as isNodeBuiltin, t as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.46e2a803.js';
2
2
  import { normalizePath } from 'vite';
3
3
  import { a as getWorkerState, D as isWindows, E as mergeSlashes, d as dirname, h as resolve, f as basename, F as getType, G as getAllProperties, s as slash } from './chunk-utils-global.2fab7e5c.js';
4
4
  import { existsSync, readdirSync } from 'fs';
@@ -80,7 +80,7 @@ const _VitestMocker = class {
80
80
  return this.getMocks()[this.resolveDependency(dep)];
81
81
  }
82
82
  resolveDependency(dep) {
83
- return normalizeRequestId(dep).replace(/^\/@fs\//, isWindows ? "" : "/");
83
+ return normalizeRequestId(dep.replace(this.root, "")).replace(/^\/@fs\//, isWindows ? "" : "/");
84
84
  }
85
85
  normalizePath(path) {
86
86
  return normalizeRequestId(path.replace(this.root, "")).replace(/^\/@fs\//, isWindows ? "" : "/");
@@ -14,7 +14,7 @@ import require$$0$1 from 'util';
14
14
  import require$$0$2 from 'stream';
15
15
  import require$$2 from 'events';
16
16
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
17
- import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.9975fd9e.js';
17
+ import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.46e2a803.js';
18
18
  import createDebug from 'debug';
19
19
  import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.7d81a6ca.js';
20
20
  import { MessageChannel } from 'worker_threads';
@@ -25,7 +25,7 @@ import { resolveModule } from 'local-pkg';
25
25
  import MagicString from './chunk-magic-string.41232190.js';
26
26
  import { p as prompts } from './vendor-index.405e58ef.js';
27
27
 
28
- var version = "0.12.7";
28
+ var version = "0.12.8";
29
29
 
30
30
  function stripFinalNewline(input) {
31
31
  const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
@@ -10958,7 +10958,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
10958
10958
  await ctx.setServer(options, server);
10959
10959
  haveStarted = true;
10960
10960
  if (options.api && options.watch)
10961
- (await import('./chunk-api-setup.2f2df7e0.js')).setup(ctx);
10961
+ (await import('./chunk-api-setup.9ccd19b5.js')).setup(ctx);
10962
10962
  if (!options.watch)
10963
10963
  await server.watcher.close();
10964
10964
  }
@@ -8845,6 +8845,9 @@ const isWindows = process.platform === "win32";
8845
8845
  function slash(str) {
8846
8846
  return str.replace(/\\/g, "/");
8847
8847
  }
8848
+ function mergeSlashes(str) {
8849
+ return str.replace(/\/\//g, "/");
8850
+ }
8848
8851
  function normalizeRequestId(id, base) {
8849
8852
  if (base && id.startsWith(base))
8850
8853
  id = `/${id.slice(base.length)}`;
@@ -8979,7 +8982,7 @@ ${getStack()}`), 2e3);
8979
8982
  if (importer && importer.startsWith("mock:"))
8980
8983
  importer = importer.slice(5);
8981
8984
  const { id: id2 } = await this.options.resolveId(dep, importer) || {};
8982
- dep = id2 && isAbsolute$2(id2) ? `/@fs/${id2}` : id2 || dep;
8985
+ dep = id2 && isAbsolute$2(id2) ? mergeSlashes(`/@fs/${id2}`) : id2 || dep;
8983
8986
  }
8984
8987
  return dep;
8985
8988
  };
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'events';
2
2
  import { p as picocolors } from './chunk-utils-global.2fab7e5c.js';
3
- import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.0aac0c8e.js';
3
+ import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.fc385bba.js';
4
4
  import 'tty';
5
5
  import 'local-pkg';
6
6
  import 'path';
@@ -18,7 +18,7 @@ import 'os';
18
18
  import 'vite';
19
19
  import './chunk-constants.3570739f.js';
20
20
  import 'readline';
21
- import './chunk-vite-node-utils.9975fd9e.js';
21
+ import './chunk-vite-node-utils.46e2a803.js';
22
22
  import 'module';
23
23
  import 'vm';
24
24
  import 'debug';
package/dist/entry.js CHANGED
@@ -1,4 +1,4 @@
1
- export { r as run } from './vendor-entry.7d6cc1fd.js';
1
+ export { r as run } from './vendor-entry.ca05c118.js';
2
2
  import 'fs';
3
3
  import './chunk-utils-global.2fab7e5c.js';
4
4
  import 'tty';
package/dist/node.js CHANGED
@@ -1,5 +1,5 @@
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';
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';
@@ -19,7 +19,7 @@ import 'local-pkg';
19
19
  import 'vite';
20
20
  import './chunk-constants.3570739f.js';
21
21
  import 'readline';
22
- import './chunk-vite-node-utils.9975fd9e.js';
22
+ import './chunk-vite-node-utils.46e2a803.js';
23
23
  import 'module';
24
24
  import 'vm';
25
25
  import 'debug';
@@ -281,19 +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);
287
290
  const originals = new Map(allowRewrite.map(([key]) => [key, global[key]]));
288
291
  const overrideObject = /* @__PURE__ */ new Map();
289
292
  for (const key of keys) {
290
- const bindedFunction = bindFunctions && typeof win[key] === "function" && win[key].bind(win);
293
+ const boundFunction = bindFunctions && typeof win[key] === "function" && !isClassLikeName(key) && win[key].bind(win);
291
294
  Object.defineProperty(global, key, {
292
295
  get() {
293
296
  if (overrideObject.has(key))
294
297
  return overrideObject.get(key);
295
- if (bindedFunction)
296
- return bindedFunction;
298
+ if (boundFunction)
299
+ return boundFunction;
297
300
  return win[key];
298
301
  },
299
302
  set(v) {
@@ -432,7 +435,7 @@ async function setupGlobalEnv(config) {
432
435
  if (isNode)
433
436
  await setupConsoleLogSpy();
434
437
  if (config.globals)
435
- (await import('./chunk-integrations-globals.36dc71fa.js')).registerApiGlobally();
438
+ (await import('./chunk-integrations-globals.23cc66c3.js')).registerApiGlobally();
436
439
  }
437
440
  function setupDefines(defines) {
438
441
  for (const key in defines)
package/dist/worker.js CHANGED
@@ -1,7 +1,7 @@
1
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';
2
+ import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.46e2a803.js';
3
3
  import { d as distDir } from './chunk-constants.3570739f.js';
4
- import { e as executeInViteNode } from './chunk-runtime-mocker.42fa71a8.js';
4
+ import { e as executeInViteNode } from './chunk-runtime-mocker.d26f8110.js';
5
5
  import { r as rpc } from './chunk-runtime-rpc.47bae3f9.js';
6
6
  import 'tty';
7
7
  import 'local-pkg';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "0.12.7",
4
+ "version": "0.12.8",
5
5
  "description": "A blazing fast unit test framework powered by Vite",
6
6
  "keywords": [
7
7
  "vite",
@@ -94,7 +94,7 @@
94
94
  "@types/node": "^17.0.33",
95
95
  "@types/prompts": "^2.4.0",
96
96
  "@types/sinonjs__fake-timers": "^8.1.2",
97
- "@vitest/ui": "0.12.7",
97
+ "@vitest/ui": "0.12.8",
98
98
  "birpc": "^0.2.2",
99
99
  "c8": "^7.11.2",
100
100
  "cac": "^6.7.12",
@@ -121,7 +121,7 @@
121
121
  "source-map-js": "^1.0.2",
122
122
  "strip-ansi": "^7.0.1",
123
123
  "typescript": "^4.6.4",
124
- "vite-node": "0.12.7",
124
+ "vite-node": "0.12.8",
125
125
  "ws": "^8.6.0"
126
126
  },
127
127
  "engines": {