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
@@ -1,105 +1,121 @@
1
1
  import childProcess from 'child_process';
2
2
  import path$3 from 'path';
3
- import { a as commonjsGlobal } from './vendor-_commonjsHelpers.34b404ce.js';
4
- import fs$3 from 'fs';
3
+ import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
4
+ import fs$1 from 'fs';
5
5
  import assert$1 from 'assert';
6
6
  import require$$2 from 'events';
7
7
  import require$$0$2 from 'buffer';
8
8
  import require$$0 from 'stream';
9
9
  import require$$0$1 from 'util';
10
10
 
11
- var crossSpawn$1 = {exports: {}};
12
-
13
- var windows = isexe$3;
14
- isexe$3.sync = sync$2;
15
-
16
- var fs$2 = fs$3;
17
-
18
- function checkPathExt (path, options) {
19
- var pathext = options.pathExt !== undefined ?
20
- options.pathExt : process.env.PATHEXT;
21
-
22
- if (!pathext) {
23
- return true
24
- }
11
+ var crossSpawn = {exports: {}};
12
+
13
+ var windows;
14
+ var hasRequiredWindows;
15
+
16
+ function requireWindows () {
17
+ if (hasRequiredWindows) return windows;
18
+ hasRequiredWindows = 1;
19
+ windows = isexe;
20
+ isexe.sync = sync;
21
+
22
+ var fs = fs$1;
23
+
24
+ function checkPathExt (path, options) {
25
+ var pathext = options.pathExt !== undefined ?
26
+ options.pathExt : process.env.PATHEXT;
27
+
28
+ if (!pathext) {
29
+ return true
30
+ }
31
+
32
+ pathext = pathext.split(';');
33
+ if (pathext.indexOf('') !== -1) {
34
+ return true
35
+ }
36
+ for (var i = 0; i < pathext.length; i++) {
37
+ var p = pathext[i].toLowerCase();
38
+ if (p && path.substr(-p.length).toLowerCase() === p) {
39
+ return true
40
+ }
41
+ }
42
+ return false
43
+ }
25
44
 
26
- pathext = pathext.split(';');
27
- if (pathext.indexOf('') !== -1) {
28
- return true
29
- }
30
- for (var i = 0; i < pathext.length; i++) {
31
- var p = pathext[i].toLowerCase();
32
- if (p && path.substr(-p.length).toLowerCase() === p) {
33
- return true
34
- }
35
- }
36
- return false
37
- }
45
+ function checkStat (stat, path, options) {
46
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
47
+ return false
48
+ }
49
+ return checkPathExt(path, options)
50
+ }
38
51
 
39
- function checkStat$1 (stat, path, options) {
40
- if (!stat.isSymbolicLink() && !stat.isFile()) {
41
- return false
42
- }
43
- return checkPathExt(path, options)
44
- }
52
+ function isexe (path, options, cb) {
53
+ fs.stat(path, function (er, stat) {
54
+ cb(er, er ? false : checkStat(stat, path, options));
55
+ });
56
+ }
45
57
 
46
- function isexe$3 (path, options, cb) {
47
- fs$2.stat(path, function (er, stat) {
48
- cb(er, er ? false : checkStat$1(stat, path, options));
49
- });
58
+ function sync (path, options) {
59
+ return checkStat(fs.statSync(path), path, options)
60
+ }
61
+ return windows;
50
62
  }
51
63
 
52
- function sync$2 (path, options) {
53
- return checkStat$1(fs$2.statSync(path), path, options)
54
- }
64
+ var mode;
65
+ var hasRequiredMode;
55
66
 
56
- var mode = isexe$2;
57
- isexe$2.sync = sync$1;
67
+ function requireMode () {
68
+ if (hasRequiredMode) return mode;
69
+ hasRequiredMode = 1;
70
+ mode = isexe;
71
+ isexe.sync = sync;
58
72
 
59
- var fs$1 = fs$3;
73
+ var fs = fs$1;
60
74
 
61
- function isexe$2 (path, options, cb) {
62
- fs$1.stat(path, function (er, stat) {
63
- cb(er, er ? false : checkStat(stat, options));
64
- });
65
- }
75
+ function isexe (path, options, cb) {
76
+ fs.stat(path, function (er, stat) {
77
+ cb(er, er ? false : checkStat(stat, options));
78
+ });
79
+ }
66
80
 
67
- function sync$1 (path, options) {
68
- return checkStat(fs$1.statSync(path), options)
69
- }
81
+ function sync (path, options) {
82
+ return checkStat(fs.statSync(path), options)
83
+ }
70
84
 
71
- function checkStat (stat, options) {
72
- return stat.isFile() && checkMode(stat, options)
73
- }
85
+ function checkStat (stat, options) {
86
+ return stat.isFile() && checkMode(stat, options)
87
+ }
74
88
 
75
- function checkMode (stat, options) {
76
- var mod = stat.mode;
77
- var uid = stat.uid;
78
- var gid = stat.gid;
89
+ function checkMode (stat, options) {
90
+ var mod = stat.mode;
91
+ var uid = stat.uid;
92
+ var gid = stat.gid;
79
93
 
80
- var myUid = options.uid !== undefined ?
81
- options.uid : process.getuid && process.getuid();
82
- var myGid = options.gid !== undefined ?
83
- options.gid : process.getgid && process.getgid();
94
+ var myUid = options.uid !== undefined ?
95
+ options.uid : process.getuid && process.getuid();
96
+ var myGid = options.gid !== undefined ?
97
+ options.gid : process.getgid && process.getgid();
84
98
 
85
- var u = parseInt('100', 8);
86
- var g = parseInt('010', 8);
87
- var o = parseInt('001', 8);
88
- var ug = u | g;
99
+ var u = parseInt('100', 8);
100
+ var g = parseInt('010', 8);
101
+ var o = parseInt('001', 8);
102
+ var ug = u | g;
89
103
 
90
- var ret = (mod & o) ||
91
- (mod & g) && gid === myGid ||
92
- (mod & u) && uid === myUid ||
93
- (mod & ug) && myUid === 0;
104
+ var ret = (mod & o) ||
105
+ (mod & g) && gid === myGid ||
106
+ (mod & u) && uid === myUid ||
107
+ (mod & ug) && myUid === 0;
94
108
 
95
- return ret
109
+ return ret
110
+ }
111
+ return mode;
96
112
  }
97
113
 
98
114
  var core;
99
115
  if (process.platform === 'win32' || commonjsGlobal.TESTING_WINDOWS) {
100
- core = windows;
116
+ core = requireWindows();
101
117
  } else {
102
- core = mode;
118
+ core = requireMode();
103
119
  }
104
120
 
105
121
  var isexe_1 = isexe$1;
@@ -413,7 +429,7 @@ var shebangCommand$1 = (string = '') => {
413
429
  return argument ? `${binary} ${argument}` : binary;
414
430
  };
415
431
 
416
- const fs = fs$3;
432
+ const fs = fs$1;
417
433
  const shebangCommand = shebangCommand$1;
418
434
 
419
435
  function readShebang$1(command) {
@@ -614,74 +630,79 @@ function spawnSync(command, args, options) {
614
630
  return result;
615
631
  }
616
632
 
617
- crossSpawn$1.exports = spawn;
618
- crossSpawn$1.exports.spawn = spawn;
619
- crossSpawn$1.exports.sync = spawnSync;
620
-
621
- crossSpawn$1.exports._parse = parse;
622
- crossSpawn$1.exports._enoent = enoent;
633
+ crossSpawn.exports = spawn;
634
+ crossSpawn.exports.spawn = spawn;
635
+ crossSpawn.exports.sync = spawnSync;
623
636
 
624
- var crossSpawn = crossSpawn$1.exports;
637
+ crossSpawn.exports._parse = parse;
638
+ crossSpawn.exports._enoent = enoent;
625
639
 
626
640
  var signalExit = {exports: {}};
627
641
 
628
642
  var signals$1 = {exports: {}};
629
643
 
630
- (function (module) {
631
- // This is not the set of all possible signals.
632
- //
633
- // It IS, however, the set of all signals that trigger
634
- // an exit on either Linux or BSD systems. Linux is a
635
- // superset of the signal names supported on BSD, and
636
- // the unknown signals just fail to register, so we can
637
- // catch that easily enough.
638
- //
639
- // Don't bother with SIGKILL. It's uncatchable, which
640
- // means that we can't fire any callbacks anyway.
641
- //
642
- // If a user does happen to register a handler on a non-
643
- // fatal signal like SIGWINCH or something, and then
644
- // exit, it'll end up firing `process.emit('exit')`, so
645
- // the handler will be fired anyway.
646
- //
647
- // SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
648
- // artificially, inherently leave the process in a
649
- // state from which it is not safe to try and enter JS
650
- // listeners.
651
- module.exports = [
652
- 'SIGABRT',
653
- 'SIGALRM',
654
- 'SIGHUP',
655
- 'SIGINT',
656
- 'SIGTERM'
657
- ];
658
-
659
- if (process.platform !== 'win32') {
660
- module.exports.push(
661
- 'SIGVTALRM',
662
- 'SIGXCPU',
663
- 'SIGXFSZ',
664
- 'SIGUSR2',
665
- 'SIGTRAP',
666
- 'SIGSYS',
667
- 'SIGQUIT',
668
- 'SIGIOT'
669
- // should detect profiler and enable/disable accordingly.
670
- // see #21
671
- // 'SIGPROF'
672
- );
673
- }
644
+ var hasRequiredSignals;
645
+
646
+ function requireSignals () {
647
+ if (hasRequiredSignals) return signals$1.exports;
648
+ hasRequiredSignals = 1;
649
+ (function (module) {
650
+ // This is not the set of all possible signals.
651
+ //
652
+ // It IS, however, the set of all signals that trigger
653
+ // an exit on either Linux or BSD systems. Linux is a
654
+ // superset of the signal names supported on BSD, and
655
+ // the unknown signals just fail to register, so we can
656
+ // catch that easily enough.
657
+ //
658
+ // Don't bother with SIGKILL. It's uncatchable, which
659
+ // means that we can't fire any callbacks anyway.
660
+ //
661
+ // If a user does happen to register a handler on a non-
662
+ // fatal signal like SIGWINCH or something, and then
663
+ // exit, it'll end up firing `process.emit('exit')`, so
664
+ // the handler will be fired anyway.
665
+ //
666
+ // SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
667
+ // artificially, inherently leave the process in a
668
+ // state from which it is not safe to try and enter JS
669
+ // listeners.
670
+ module.exports = [
671
+ 'SIGABRT',
672
+ 'SIGALRM',
673
+ 'SIGHUP',
674
+ 'SIGINT',
675
+ 'SIGTERM'
676
+ ];
677
+
678
+ if (process.platform !== 'win32') {
679
+ module.exports.push(
680
+ 'SIGVTALRM',
681
+ 'SIGXCPU',
682
+ 'SIGXFSZ',
683
+ 'SIGUSR2',
684
+ 'SIGTRAP',
685
+ 'SIGSYS',
686
+ 'SIGQUIT',
687
+ 'SIGIOT'
688
+ // should detect profiler and enable/disable accordingly.
689
+ // see #21
690
+ // 'SIGPROF'
691
+ );
692
+ }
674
693
 
675
- if (process.platform === 'linux') {
676
- module.exports.push(
677
- 'SIGIO',
678
- 'SIGPOLL',
679
- 'SIGPWR',
680
- 'SIGSTKFLT',
681
- 'SIGUNUSED'
682
- );
694
+ if (process.platform === 'linux') {
695
+ module.exports.push(
696
+ 'SIGIO',
697
+ 'SIGPOLL',
698
+ 'SIGPWR',
699
+ 'SIGSTKFLT',
700
+ 'SIGUNUSED'
701
+ );
702
+ }
703
+ } (signals$1));
704
+ return signals$1.exports;
683
705
  }
684
- }(signals$1));
685
706
 
686
707
  // Note: since nyc uses this module to output coverage, any lines
687
708
  // that are in the direct sync flow of nyc's outputCoverage are
@@ -709,7 +730,7 @@ if (!processOk(process$1)) {
709
730
  };
710
731
  } else {
711
732
  var assert = assert$1;
712
- var signals = signals$1.exports;
733
+ var signals = requireSignals();
713
734
  var isWin = /^win/i.test(process$1.platform);
714
735
 
715
736
  var EE = require$$2;
@@ -886,9 +907,7 @@ if (!processOk(process$1)) {
886
907
  };
887
908
  }
888
909
 
889
- var onExit = signalExit.exports;
890
-
891
- var getStream$2 = {exports: {}};
910
+ var getStream$1 = {exports: {}};
892
911
 
893
912
  const {PassThrough: PassThroughStream} = require$$0;
894
913
 
@@ -998,12 +1017,10 @@ async function getStream(inputStream, options) {
998
1017
  return stream.getBufferedValue();
999
1018
  }
1000
1019
 
1001
- getStream$2.exports = getStream;
1002
- getStream$2.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'});
1003
- getStream$2.exports.array = (stream, options) => getStream(stream, {...options, array: true});
1004
- getStream$2.exports.MaxBufferError = MaxBufferError;
1005
-
1006
- var getStream$1 = getStream$2.exports;
1020
+ getStream$1.exports = getStream;
1021
+ getStream$1.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'});
1022
+ getStream$1.exports.array = (stream, options) => getStream(stream, {...options, array: true});
1023
+ getStream$1.exports.MaxBufferError = MaxBufferError;
1007
1024
 
1008
1025
  const { PassThrough } = require$$0;
1009
1026
 
@@ -1045,7 +1062,7 @@ var mergeStream = function (/*streams...*/) {
1045
1062
  }
1046
1063
  };
1047
1064
 
1048
- var onetime$2 = {exports: {}};
1065
+ var onetime$1 = {exports: {}};
1049
1066
 
1050
1067
  var mimicFn$2 = {exports: {}};
1051
1068
 
@@ -1093,11 +1110,11 @@ const onetime = (function_, options = {}) => {
1093
1110
  return onetime;
1094
1111
  };
1095
1112
 
1096
- onetime$2.exports = onetime;
1113
+ onetime$1.exports = onetime;
1097
1114
  // TODO: Remove this for the next major release
1098
- onetime$2.exports.default = onetime;
1115
+ onetime$1.exports.default = onetime;
1099
1116
 
1100
- onetime$2.exports.callCount = function_ => {
1117
+ onetime$1.exports.callCount = function_ => {
1101
1118
  if (!calledFunctions.has(function_)) {
1102
1119
  throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
1103
1120
  }
@@ -1105,6 +1122,4 @@ onetime$2.exports.callCount = function_ => {
1105
1122
  return calledFunctions.get(function_);
1106
1123
  };
1107
1124
 
1108
- var onetime$1 = onetime$2.exports;
1109
-
1110
- export { onetime$1 as a, getStream$2 as b, crossSpawn as c, crossSpawn$1 as d, onetime$2 as e, getStream$1 as g, mergeStream as m, onExit as o, pathKey$1 as p, signalExit as s };
1125
+ export { crossSpawn as c, getStream$1 as g, mergeStream as m, onetime$1 as o, pathKey$1 as p, signalExit as s };
package/dist/worker.js CHANGED
@@ -1,11 +1,11 @@
1
- import { w as resolve, g as getWorkerState } from './chunk-utils-global.10dcdfa6.js';
2
- import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.7f0053fb.js';
3
- import { d as distDir } from './chunk-constants.e59013dc.js';
4
- import { e as executeInViteNode } from './chunk-runtime-mocker.7f4b1850.js';
5
- import { r as rpc } from './chunk-runtime-rpc.4b80b6bd.js';
6
- import 'path';
1
+ import { k as resolve, b as getWorkerState } from './chunk-utils-global.37a7c822.js';
2
+ import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.33447cc0.js';
3
+ import { d as distDir } from './chunk-constants.d540b1d1.js';
4
+ import { e as executeInViteNode } from './chunk-runtime-mocker.111ac858.js';
5
+ import { r as rpc } from './chunk-runtime-rpc.8f648236.js';
7
6
  import 'tty';
8
7
  import 'local-pkg';
8
+ import 'path';
9
9
  import 'module';
10
10
  import 'url';
11
11
  import 'vm';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "0.9.2",
4
+ "version": "0.10.0",
5
5
  "description": "A blazing fast unit test framework powered by Vite",
6
6
  "keywords": [
7
7
  "vite",
@@ -75,27 +75,27 @@
75
75
  }
76
76
  },
77
77
  "dependencies": {
78
- "@types/chai": "^4.3.0",
78
+ "@types/chai": "^4.3.1",
79
79
  "@types/chai-subset": "^1.3.3",
80
80
  "chai": "^4.3.6",
81
81
  "local-pkg": "^0.4.1",
82
82
  "tinypool": "^0.1.2",
83
83
  "tinyspy": "^0.3.2",
84
- "vite": "^2.9.1"
84
+ "vite": "^2.9.5"
85
85
  },
86
86
  "devDependencies": {
87
87
  "@antfu/install-pkg": "^0.1.0",
88
- "@sinonjs/fake-timers": "^9.1.1",
88
+ "@sinonjs/fake-timers": "^9.1.2",
89
89
  "@types/diff": "^5.0.2",
90
90
  "@types/jsdom": "^16.2.14",
91
91
  "@types/micromatch": "^4.0.2",
92
92
  "@types/natural-compare": "^1.4.1",
93
- "@types/node": "^17.0.23",
93
+ "@types/node": "^17.0.26",
94
94
  "@types/prompts": "^2.4.0",
95
95
  "@types/sinonjs__fake-timers": "^8.1.2",
96
- "@vitest/ui": "0.9.2",
96
+ "@vitest/ui": "0.10.0",
97
97
  "birpc": "^0.2.2",
98
- "c8": "^7.11.0",
98
+ "c8": "^7.11.2",
99
99
  "cac": "^6.7.12",
100
100
  "chai-subset": "^1.6.0",
101
101
  "cli-truncate": "^3.1.0",
@@ -106,21 +106,21 @@
106
106
  "flatted": "^3.2.5",
107
107
  "happy-dom": "^2.55.0",
108
108
  "jsdom": "^19.0.0",
109
- "log-update": "^5.0.0",
109
+ "log-update": "^5.0.1",
110
110
  "magic-string": "^0.26.1",
111
111
  "micromatch": "^4.0.5",
112
- "mlly": "^0.5.1",
112
+ "mlly": "^0.5.2",
113
113
  "natural-compare": "^1.4.0",
114
114
  "pathe": "^0.2.0",
115
115
  "picocolors": "^1.0.0",
116
116
  "pkg-types": "^0.3.2",
117
117
  "pretty-format": "^27.5.1",
118
118
  "prompts": "^2.4.2",
119
- "rollup": "^2.70.1",
119
+ "rollup": "^2.70.2",
120
120
  "source-map-js": "^1.0.2",
121
121
  "strip-ansi": "^7.0.1",
122
122
  "typescript": "^4.6.3",
123
- "vite-node": "0.9.2",
123
+ "vite-node": "0.10.0",
124
124
  "ws": "^8.5.0"
125
125
  },
126
126
  "engines": {
@@ -1,23 +0,0 @@
1
- import { g as globalApis } from './chunk-constants.e59013dc.js';
2
- import { i as index } from './chunk-runtime-chain.94cf66a4.js';
3
- import 'url';
4
- import './chunk-utils-global.10dcdfa6.js';
5
- import 'path';
6
- import 'tty';
7
- import 'local-pkg';
8
- import 'util';
9
- import './chunk-utils-timers.4800834c.js';
10
- import 'chai';
11
- import './vendor-_commonjsHelpers.34b404ce.js';
12
- import './chunk-runtime-rpc.4b80b6bd.js';
13
- import 'fs';
14
- import './spy.js';
15
- import 'tinyspy';
16
-
17
- function registerApiGlobally() {
18
- globalApis.forEach((api) => {
19
- globalThis[api] = index[api];
20
- });
21
- }
22
-
23
- export { registerApiGlobally };
@@ -1,7 +0,0 @@
1
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
-
3
- function commonjsRequire (path) {
4
- throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
5
- }
6
-
7
- export { commonjsGlobal as a, commonjsRequire as c };