vitest 0.9.2 → 0.10.0

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 (30) hide show
  1. package/LICENSE.md +7 -0
  2. package/dist/{chunk-api-setup.7290422e.js → chunk-api-setup.d70fc960.js} +5 -5
  3. package/dist/{chunk-constants.e59013dc.js → chunk-constants.d540b1d1.js} +1 -1
  4. package/dist/{chunk-defaults.9aa0ce42.js → chunk-defaults.04d5d90b.js} +1 -1
  5. package/dist/{chunk-install-pkg.7dd40977.js → chunk-install-pkg.73b84ae1.js} +113 -115
  6. package/dist/chunk-integrations-globals.d2c09cd2.js +29 -0
  7. package/dist/chunk-integrations-spy.f036df6f.js +102 -0
  8. package/dist/{chunk-runtime-chain.94cf66a4.js → chunk-runtime-chain.f863f182.js} +934 -897
  9. package/dist/{chunk-runtime-mocker.7f4b1850.js → chunk-runtime-mocker.111ac858.js} +3 -3
  10. package/dist/{chunk-runtime-rpc.4b80b6bd.js → chunk-runtime-rpc.8f648236.js} +1 -1
  11. package/dist/{chunk-utils-global.10dcdfa6.js → chunk-utils-global.37a7c822.js} +8 -10
  12. package/dist/{chunk-utils-timers.4800834c.js → chunk-utils-timers.12bc05d1.js} +1404 -1057
  13. package/dist/{chunk-vite-node-externalize.ddf2a6fb.js → chunk-vite-node-externalize.5c678054.js} +1773 -4417
  14. package/dist/{chunk-vite-node-utils.7f0053fb.js → chunk-vite-node-utils.33447cc0.js} +71 -71
  15. package/dist/cli.js +13 -13
  16. package/dist/entry.js +15 -919
  17. package/dist/index.d.ts +92 -25
  18. package/dist/index.js +8 -8
  19. package/dist/node.d.ts +25 -7
  20. package/dist/node.js +12 -12
  21. package/dist/spy.js +2 -102
  22. package/dist/vendor-_commonjsHelpers.addc3445.js +3 -0
  23. package/dist/vendor-entry.369fd6c9.js +949 -0
  24. package/dist/vendor-index.405e58ef.js +6291 -0
  25. package/dist/{vendor-index.87b2fc14.js → vendor-index.40be925a.js} +167 -152
  26. package/dist/worker.js +6 -6
  27. package/package.json +11 -11
  28. package/dist/chunk-integrations-globals.c040aaa9.js +0 -23
  29. package/dist/vendor-_commonjsHelpers.34b404ce.js +0 -7
  30. package/dist/vendor-index.ee829ed6.js +0 -5707
package/LICENSE.md CHANGED
@@ -465,6 +465,13 @@ Repository: git://github.com/kpdecker/jsdiff.git
465
465
 
466
466
  ---------------------------------------
467
467
 
468
+ ## eastasianwidth
469
+ License: MIT
470
+ By: Masaki Komagata
471
+ Repository: git://github.com/komagata/eastasianwidth.git
472
+
473
+ ---------------------------------------
474
+
468
475
  ## emoji-regex
469
476
  License: MIT
470
477
  By: Mathias Bynens
@@ -1,5 +1,5 @@
1
1
  import { promises } from 'fs';
2
- import { c as createBirpc } from './chunk-vite-node-utils.7f0053fb.js';
2
+ import { c as createBirpc } from './chunk-vite-node-utils.33447cc0.js';
3
3
  import require$$0$1 from 'stream';
4
4
  import require$$0 from 'zlib';
5
5
  import require$$3 from 'net';
@@ -9,14 +9,14 @@ import require$$2 from 'events';
9
9
  import require$$1 from 'https';
10
10
  import require$$2$1 from 'http';
11
11
  import url from 'url';
12
- import { A as API_PATH } from './chunk-constants.e59013dc.js';
13
- import { r as interpretSourcePos, b as parseStacktrace } from './chunk-utils-timers.4800834c.js';
12
+ import { A as API_PATH } from './chunk-constants.d540b1d1.js';
13
+ import { r as interpretSourcePos, b as parseStacktrace } from './chunk-utils-timers.12bc05d1.js';
14
14
  import 'module';
15
15
  import 'vm';
16
- import './chunk-utils-global.10dcdfa6.js';
17
- import 'path';
16
+ import './chunk-utils-global.37a7c822.js';
18
17
  import 'tty';
19
18
  import 'local-pkg';
19
+ import 'path';
20
20
  import 'assert';
21
21
  import 'util';
22
22
 
@@ -1,5 +1,5 @@
1
1
  import { fileURLToPath } from 'url';
2
- import { w as resolve } from './chunk-utils-global.10dcdfa6.js';
2
+ import { k as resolve } from './chunk-utils-global.37a7c822.js';
3
3
 
4
4
  const distDir = resolve(fileURLToPath(import.meta.url), "../../dist");
5
5
  const defaultPort = 51204;
@@ -1,7 +1,7 @@
1
1
  import { existsSync, promises } from 'fs';
2
2
  import { createRequire } from 'module';
3
3
  import { pathToFileURL } from 'url';
4
- import { t as toArray, w as resolve } from './chunk-utils-global.10dcdfa6.js';
4
+ import { t as toArray, k as resolve } from './chunk-utils-global.37a7c822.js';
5
5
 
6
6
  const defaultInclude = ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];
7
7
  const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**"];
@@ -2,9 +2,9 @@ import path$2 from 'path';
2
2
  import fs$2 from 'fs';
3
3
  import require$$0 from 'util';
4
4
  import childProcess$1 from 'child_process';
5
- import { p as pathKey, s as signalExit, m as mergeStream$1, b as getStream$1, d as crossSpawn$1, e as onetime$1 } from './vendor-index.87b2fc14.js';
5
+ import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1, o as onetime$1 } from './vendor-index.40be925a.js';
6
6
  import require$$0$1 from 'os';
7
- import './vendor-_commonjsHelpers.34b404ce.js';
7
+ import './vendor-_commonjsHelpers.addc3445.js';
8
8
  import 'assert';
9
9
  import 'events';
10
10
  import 'buffer';
@@ -298,99 +298,99 @@ pathExists.exports.sync = path => {
298
298
  };
299
299
 
300
300
  (function (module) {
301
- const path = path$2;
302
- const locatePath$1 = locatePath.exports;
303
- const pathExists$1 = pathExists.exports;
301
+ const path = path$2;
302
+ const locatePath$1 = locatePath.exports;
303
+ const pathExists$1 = pathExists.exports;
304
304
 
305
- const stop = Symbol('findUp.stop');
305
+ const stop = Symbol('findUp.stop');
306
306
 
307
- module.exports = async (name, options = {}) => {
308
- let directory = path.resolve(options.cwd || '');
309
- const {root} = path.parse(directory);
310
- const paths = [].concat(name);
307
+ module.exports = async (name, options = {}) => {
308
+ let directory = path.resolve(options.cwd || '');
309
+ const {root} = path.parse(directory);
310
+ const paths = [].concat(name);
311
311
 
312
- const runMatcher = async locateOptions => {
313
- if (typeof name !== 'function') {
314
- return locatePath$1(paths, locateOptions);
315
- }
312
+ const runMatcher = async locateOptions => {
313
+ if (typeof name !== 'function') {
314
+ return locatePath$1(paths, locateOptions);
315
+ }
316
316
 
317
- const foundPath = await name(locateOptions.cwd);
318
- if (typeof foundPath === 'string') {
319
- return locatePath$1([foundPath], locateOptions);
320
- }
317
+ const foundPath = await name(locateOptions.cwd);
318
+ if (typeof foundPath === 'string') {
319
+ return locatePath$1([foundPath], locateOptions);
320
+ }
321
321
 
322
- return foundPath;
323
- };
322
+ return foundPath;
323
+ };
324
324
 
325
- // eslint-disable-next-line no-constant-condition
326
- while (true) {
327
- // eslint-disable-next-line no-await-in-loop
328
- const foundPath = await runMatcher({...options, cwd: directory});
325
+ // eslint-disable-next-line no-constant-condition
326
+ while (true) {
327
+ // eslint-disable-next-line no-await-in-loop
328
+ const foundPath = await runMatcher({...options, cwd: directory});
329
329
 
330
- if (foundPath === stop) {
331
- return;
332
- }
330
+ if (foundPath === stop) {
331
+ return;
332
+ }
333
333
 
334
- if (foundPath) {
335
- return path.resolve(directory, foundPath);
336
- }
334
+ if (foundPath) {
335
+ return path.resolve(directory, foundPath);
336
+ }
337
337
 
338
- if (directory === root) {
339
- return;
338
+ if (directory === root) {
339
+ return;
340
+ }
341
+
342
+ directory = path.dirname(directory);
340
343
  }
344
+ };
341
345
 
342
- directory = path.dirname(directory);
343
- }
344
- };
346
+ module.exports.sync = (name, options = {}) => {
347
+ let directory = path.resolve(options.cwd || '');
348
+ const {root} = path.parse(directory);
349
+ const paths = [].concat(name);
345
350
 
346
- module.exports.sync = (name, options = {}) => {
347
- let directory = path.resolve(options.cwd || '');
348
- const {root} = path.parse(directory);
349
- const paths = [].concat(name);
351
+ const runMatcher = locateOptions => {
352
+ if (typeof name !== 'function') {
353
+ return locatePath$1.sync(paths, locateOptions);
354
+ }
350
355
 
351
- const runMatcher = locateOptions => {
352
- if (typeof name !== 'function') {
353
- return locatePath$1.sync(paths, locateOptions);
354
- }
356
+ const foundPath = name(locateOptions.cwd);
357
+ if (typeof foundPath === 'string') {
358
+ return locatePath$1.sync([foundPath], locateOptions);
359
+ }
355
360
 
356
- const foundPath = name(locateOptions.cwd);
357
- if (typeof foundPath === 'string') {
358
- return locatePath$1.sync([foundPath], locateOptions);
359
- }
361
+ return foundPath;
362
+ };
360
363
 
361
- return foundPath;
362
- };
364
+ // eslint-disable-next-line no-constant-condition
365
+ while (true) {
366
+ const foundPath = runMatcher({...options, cwd: directory});
363
367
 
364
- // eslint-disable-next-line no-constant-condition
365
- while (true) {
366
- const foundPath = runMatcher({...options, cwd: directory});
368
+ if (foundPath === stop) {
369
+ return;
370
+ }
367
371
 
368
- if (foundPath === stop) {
369
- return;
370
- }
372
+ if (foundPath) {
373
+ return path.resolve(directory, foundPath);
374
+ }
371
375
 
372
- if (foundPath) {
373
- return path.resolve(directory, foundPath);
374
- }
376
+ if (directory === root) {
377
+ return;
378
+ }
375
379
 
376
- if (directory === root) {
377
- return;
380
+ directory = path.dirname(directory);
378
381
  }
382
+ };
379
383
 
380
- directory = path.dirname(directory);
381
- }
382
- };
383
-
384
- module.exports.exists = pathExists$1;
384
+ module.exports.exists = pathExists$1;
385
385
 
386
- module.exports.sync.exists = pathExists$1.sync;
386
+ module.exports.sync.exists = pathExists$1.sync;
387
387
 
388
- module.exports.stop = stop;
389
- }(findUp$1));
388
+ module.exports.stop = stop;
389
+ } (findUp$1));
390
390
 
391
391
  var findUp = findUp$1.exports;
392
392
 
393
- var execa$2 = {exports: {}};
393
+ var execa$1 = {exports: {}};
394
394
 
395
395
  var stripFinalNewline$1 = input => {
396
396
  const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
@@ -410,53 +410,53 @@ var stripFinalNewline$1 = input => {
410
410
  var npmRunPath$1 = {exports: {}};
411
411
 
412
412
  (function (module) {
413
- const path = path$2;
414
- const pathKey$1 = pathKey.exports;
415
-
416
- const npmRunPath = options => {
417
- options = {
418
- cwd: process.cwd(),
419
- path: process.env[pathKey$1()],
420
- execPath: process.execPath,
421
- ...options
422
- };
413
+ const path = path$2;
414
+ const pathKey$1 = pathKey.exports;
415
+
416
+ const npmRunPath = options => {
417
+ options = {
418
+ cwd: process.cwd(),
419
+ path: process.env[pathKey$1()],
420
+ execPath: process.execPath,
421
+ ...options
422
+ };
423
423
 
424
- let previous;
425
- let cwdPath = path.resolve(options.cwd);
426
- const result = [];
424
+ let previous;
425
+ let cwdPath = path.resolve(options.cwd);
426
+ const result = [];
427
427
 
428
- while (previous !== cwdPath) {
429
- result.push(path.join(cwdPath, 'node_modules/.bin'));
430
- previous = cwdPath;
431
- cwdPath = path.resolve(cwdPath, '..');
432
- }
428
+ while (previous !== cwdPath) {
429
+ result.push(path.join(cwdPath, 'node_modules/.bin'));
430
+ previous = cwdPath;
431
+ cwdPath = path.resolve(cwdPath, '..');
432
+ }
433
433
 
434
- // Ensure the running `node` binary is used
435
- const execPathDir = path.resolve(options.cwd, options.execPath, '..');
436
- result.push(execPathDir);
434
+ // Ensure the running `node` binary is used
435
+ const execPathDir = path.resolve(options.cwd, options.execPath, '..');
436
+ result.push(execPathDir);
437
437
 
438
- return result.concat(options.path).join(path.delimiter);
439
- };
438
+ return result.concat(options.path).join(path.delimiter);
439
+ };
440
440
 
441
- module.exports = npmRunPath;
442
- // TODO: Remove this for the next major release
443
- module.exports.default = npmRunPath;
441
+ module.exports = npmRunPath;
442
+ // TODO: Remove this for the next major release
443
+ module.exports.default = npmRunPath;
444
444
 
445
- module.exports.env = options => {
446
- options = {
447
- env: process.env,
448
- ...options
449
- };
445
+ module.exports.env = options => {
446
+ options = {
447
+ env: process.env,
448
+ ...options
449
+ };
450
450
 
451
- const env = {...options.env};
452
- const path = pathKey$1({env});
451
+ const env = {...options.env};
452
+ const path = pathKey$1({env});
453
453
 
454
- options.path = env[path];
455
- env[path] = module.exports(options);
454
+ options.path = env[path];
455
+ env[path] = module.exports(options);
456
456
 
457
- return env;
458
- };
459
- }(npmRunPath$1));
457
+ return env;
458
+ };
459
+ } (npmRunPath$1));
460
460
 
461
461
  var main = {};
462
462
 
@@ -1501,9 +1501,9 @@ const execa = (file, args, options) => {
1501
1501
  return mergePromise(spawned, handlePromiseOnce);
1502
1502
  };
1503
1503
 
1504
- execa$2.exports = execa;
1504
+ execa$1.exports = execa;
1505
1505
 
1506
- execa$2.exports.sync = (file, args, options) => {
1506
+ execa$1.exports.sync = (file, args, options) => {
1507
1507
  const parsed = handleArguments(file, args, options);
1508
1508
  const command = joinCommand(file, args);
1509
1509
  const escapedCommand = getEscapedCommand(file, args);
@@ -1566,17 +1566,17 @@ execa$2.exports.sync = (file, args, options) => {
1566
1566
  };
1567
1567
  };
1568
1568
 
1569
- execa$2.exports.command = (command, options) => {
1569
+ execa$1.exports.command = (command, options) => {
1570
1570
  const [file, ...args] = parseCommand(command);
1571
1571
  return execa(file, args, options);
1572
1572
  };
1573
1573
 
1574
- execa$2.exports.commandSync = (command, options) => {
1574
+ execa$1.exports.commandSync = (command, options) => {
1575
1575
  const [file, ...args] = parseCommand(command);
1576
1576
  return execa.sync(file, args, options);
1577
1577
  };
1578
1578
 
1579
- execa$2.exports.node = (scriptPath, args, options = {}) => {
1579
+ execa$1.exports.node = (scriptPath, args, options = {}) => {
1580
1580
  if (args && !Array.isArray(args) && typeof args === 'object') {
1581
1581
  options = args;
1582
1582
  args = [];
@@ -1608,8 +1608,6 @@ execa$2.exports.node = (scriptPath, args, options = {}) => {
1608
1608
  );
1609
1609
  };
1610
1610
 
1611
- var execa$1 = execa$2.exports;
1612
-
1613
1611
  // src/detect.ts
1614
1612
  var LOCKS = {
1615
1613
  "pnpm-lock.yaml": "pnpm",
@@ -1628,7 +1626,7 @@ async function installPackage(names, options = {}) {
1628
1626
  const args = options.additionalArgs || [];
1629
1627
  if (options.preferOffline)
1630
1628
  args.unshift("--prefer-offline");
1631
- return execa$1(agent, [
1629
+ return execa$1.exports(agent, [
1632
1630
  agent === "yarn" ? "add" : "install",
1633
1631
  options.dev ? "-D" : "",
1634
1632
  ...args,
@@ -0,0 +1,29 @@
1
+ import { g as globalApis } from './chunk-constants.d540b1d1.js';
2
+ import { i as index } from './vendor-entry.369fd6c9.js';
3
+ import 'url';
4
+ import './chunk-utils-global.37a7c822.js';
5
+ import 'tty';
6
+ import 'local-pkg';
7
+ import 'path';
8
+ import 'fs';
9
+ import 'console';
10
+ import 'stream';
11
+ import './chunk-runtime-chain.f863f182.js';
12
+ import 'chai';
13
+ import './vendor-_commonjsHelpers.addc3445.js';
14
+ import './chunk-runtime-rpc.8f648236.js';
15
+ import './chunk-utils-timers.12bc05d1.js';
16
+ import './chunk-integrations-spy.f036df6f.js';
17
+ import 'tinyspy';
18
+ import 'util';
19
+ import './chunk-defaults.04d5d90b.js';
20
+ import 'module';
21
+ import 'crypto';
22
+
23
+ function registerApiGlobally() {
24
+ globalApis.forEach((api) => {
25
+ globalThis[api] = index[api];
26
+ });
27
+ }
28
+
29
+ export { registerApiGlobally };
@@ -0,0 +1,102 @@
1
+ import * as tinyspy from 'tinyspy';
2
+
3
+ const spies = /* @__PURE__ */ new Set();
4
+ function isMockFunction(fn2) {
5
+ return typeof fn2 === "function" && "_isMockFunction" in fn2 && fn2._isMockFunction;
6
+ }
7
+ function spyOn(obj, method, accessType) {
8
+ const dictionary = {
9
+ get: "getter",
10
+ set: "setter"
11
+ };
12
+ const objMethod = accessType ? { [dictionary[accessType]]: method } : method;
13
+ const stub = tinyspy.spyOn(obj, objMethod);
14
+ return enhanceSpy(stub);
15
+ }
16
+ let callOrder = 0;
17
+ function enhanceSpy(spy) {
18
+ const stub = spy;
19
+ let implementation;
20
+ let instances = [];
21
+ let invocations = [];
22
+ const mockContext = {
23
+ get calls() {
24
+ return stub.calls;
25
+ },
26
+ get instances() {
27
+ return instances;
28
+ },
29
+ get invocationCallOrder() {
30
+ return invocations;
31
+ },
32
+ get results() {
33
+ return stub.results.map(([callType, value]) => {
34
+ const type = callType === "error" ? "throw" : "return";
35
+ return { type, value };
36
+ });
37
+ },
38
+ get lastCall() {
39
+ return stub.calls.at(-1);
40
+ }
41
+ };
42
+ let onceImplementations = [];
43
+ let name = stub.name;
44
+ stub.getMockName = () => name || "vi.fn()";
45
+ stub.mockName = (n) => {
46
+ name = n;
47
+ return stub;
48
+ };
49
+ stub.mockClear = () => {
50
+ stub.reset();
51
+ instances = [];
52
+ invocations = [];
53
+ return stub;
54
+ };
55
+ stub.mockReset = () => {
56
+ stub.mockClear();
57
+ implementation = () => void 0;
58
+ onceImplementations = [];
59
+ return stub;
60
+ };
61
+ stub.mockRestore = () => {
62
+ stub.mockReset();
63
+ implementation = void 0;
64
+ return stub;
65
+ };
66
+ stub.getMockImplementation = () => implementation;
67
+ stub.mockImplementation = (fn2) => {
68
+ implementation = fn2;
69
+ return stub;
70
+ };
71
+ stub.mockImplementationOnce = (fn2) => {
72
+ onceImplementations.push(fn2);
73
+ return stub;
74
+ };
75
+ stub.mockReturnThis = () => stub.mockImplementation(function() {
76
+ return this;
77
+ });
78
+ stub.mockReturnValue = (val) => stub.mockImplementation(() => val);
79
+ stub.mockReturnValueOnce = (val) => stub.mockImplementationOnce(() => val);
80
+ stub.mockResolvedValue = (val) => stub.mockImplementation(() => Promise.resolve(val));
81
+ stub.mockResolvedValueOnce = (val) => stub.mockImplementationOnce(() => Promise.resolve(val));
82
+ stub.mockRejectedValue = (val) => stub.mockImplementation(() => Promise.reject(val));
83
+ stub.mockRejectedValueOnce = (val) => stub.mockImplementationOnce(() => Promise.reject(val));
84
+ Object.defineProperty(stub, "mock", {
85
+ get: () => mockContext
86
+ });
87
+ stub.willCall(function(...args) {
88
+ instances.push(this);
89
+ invocations.push(++callOrder);
90
+ const impl = onceImplementations.shift() || implementation || stub.getOriginal() || (() => {
91
+ });
92
+ return impl.apply(this, args);
93
+ });
94
+ spies.add(stub);
95
+ return stub;
96
+ }
97
+ function fn(implementation) {
98
+ return enhanceSpy(tinyspy.spyOn({ fn: implementation || (() => {
99
+ }) }, "fn"));
100
+ }
101
+
102
+ export { spies as a, fn as f, isMockFunction as i, spyOn as s };