vitest 0.21.1 → 0.23.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 (50) hide show
  1. package/LICENSE.md +61 -33
  2. package/dist/browser.d.ts +5 -5
  3. package/dist/browser.mjs +12 -10
  4. package/dist/{chunk-api-setup.7a6ba7fb.mjs → chunk-api-setup.5fc06d1d.mjs} +94 -91
  5. package/dist/chunk-constants.6196597b.mjs +284 -0
  6. package/dist/chunk-env-node.ceb43f1c.mjs +403 -0
  7. package/dist/{chunk-install-pkg.6c6dc0c2.mjs → chunk-install-pkg.e081fc1b.mjs} +2 -1
  8. package/dist/chunk-integrations-coverage.99c020eb.mjs +166 -0
  9. package/dist/{chunk-integrations-globals.44a8f047.mjs → chunk-integrations-globals.ef598c23.mjs} +8 -9
  10. package/dist/{chunk-magic-string.efe26975.mjs → chunk-magic-string.56b2b543.mjs} +30 -10
  11. package/dist/chunk-mock-date.0d86eaa5.mjs +332 -0
  12. package/dist/chunk-node-git.6f289b0a.mjs +84 -0
  13. package/dist/{chunk-runtime-chain.98d42d89.mjs → chunk-runtime-chain.2af36ddf.mjs} +507 -172
  14. package/dist/{chunk-runtime-error.87a2b5a2.mjs → chunk-runtime-error.ed9b4f70.mjs} +208 -76
  15. package/dist/{chunk-runtime-hooks.453f8858.mjs → chunk-runtime-hooks.75ce0575.mjs} +18 -12
  16. package/dist/{chunk-runtime-mocker.23b62bfa.mjs → chunk-runtime-mocker.fc76f21d.mjs} +18 -11
  17. package/dist/{chunk-runtime-rpc.b50ab560.mjs → chunk-runtime-rpc.3fe371e9.mjs} +1 -2
  18. package/dist/{chunk-utils-source-map.94107ee8.mjs → chunk-utils-source-map.70ee97e1.mjs} +11 -4
  19. package/dist/{chunk-vite-node-client.fdd9592c.mjs → chunk-vite-node-client.74ebe3d5.mjs} +97 -31
  20. package/dist/{chunk-vite-node-debug.09afb76f.mjs → chunk-vite-node-debug.2d8a1dc3.mjs} +3 -3
  21. package/dist/{chunk-vite-node-externalize.27aee038.mjs → chunk-vite-node-externalize.41bf722e.mjs} +644 -222
  22. package/dist/{chunk-vite-node-utils.f34df9d3.mjs → chunk-vite-node-utils.68573626.mjs} +60 -42
  23. package/dist/cli-wrapper.mjs +128 -0
  24. package/dist/cli.mjs +29 -20
  25. package/dist/config.cjs +5 -2
  26. package/dist/config.d.ts +8 -4
  27. package/dist/config.mjs +4 -3
  28. package/dist/entry.mjs +20 -15
  29. package/dist/environments.d.ts +23 -0
  30. package/dist/environments.mjs +3 -0
  31. package/dist/{global-60f880c6.d.ts → global-ea084c9f.d.ts} +627 -178
  32. package/dist/{index-4a906fa4.d.ts → index-5f09f4d0.d.ts} +3 -50
  33. package/dist/index.d.ts +6 -6
  34. package/dist/index.mjs +7 -6
  35. package/dist/loader.mjs +3 -3
  36. package/dist/node.d.ts +5 -4
  37. package/dist/node.mjs +19 -16
  38. package/dist/suite.mjs +6 -5
  39. package/dist/vendor-index.0557b03a.mjs +147 -0
  40. package/dist/vendor-index.13e3bda3.mjs +61 -0
  41. package/dist/{chunk-node-git.c2be9c49.mjs → vendor-index.4aeeb598.mjs} +4 -72
  42. package/dist/{vendor-index.61438b77.mjs → vendor-index.731a22f2.mjs} +1 -61
  43. package/dist/worker.mjs +20 -18
  44. package/package.json +19 -16
  45. package/vitest.mjs +1 -1
  46. package/dist/chunk-constants.26dc9f85.mjs +0 -38
  47. package/dist/chunk-defaults.02abff90.mjs +0 -680
  48. package/dist/chunk-mock-date.bc81a3ac.mjs +0 -555
  49. package/dist/chunk-utils-global.fa20c2f6.mjs +0 -5
  50. package/dist/mocker-5e2a8e41.d.ts +0 -3
package/dist/worker.mjs CHANGED
@@ -1,21 +1,20 @@
1
- import { y as resolve } from './chunk-mock-date.bc81a3ac.mjs';
2
- import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-client.fdd9592c.mjs';
1
+ import { a as resolve, c as distDir } from './chunk-constants.6196597b.mjs';
2
+ import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-client.74ebe3d5.mjs';
3
3
  import { workerId } from 'tinypool';
4
- import { d as distDir } from './chunk-constants.26dc9f85.mjs';
5
- import { e as executeInViteNode } from './chunk-runtime-mocker.23b62bfa.mjs';
6
- import { r as rpc } from './chunk-runtime-rpc.b50ab560.mjs';
7
- import { g as getWorkerState } from './chunk-utils-global.fa20c2f6.mjs';
8
- import 'path';
4
+ import { g as getWorkerState } from './chunk-mock-date.0d86eaa5.mjs';
5
+ import { e as executeInViteNode } from './chunk-runtime-mocker.fc76f21d.mjs';
6
+ import { r as rpc } from './chunk-runtime-rpc.3fe371e9.mjs';
9
7
  import 'tty';
10
- import 'local-pkg';
11
- import 'module';
12
8
  import 'url';
9
+ import 'path';
10
+ import 'module';
13
11
  import 'vm';
14
- import './chunk-vite-node-utils.f34df9d3.mjs';
12
+ import './chunk-vite-node-utils.68573626.mjs';
15
13
  import 'fs';
16
14
  import 'assert';
17
15
  import 'util';
18
16
  import 'debug';
17
+ import 'local-pkg';
19
18
  import 'vite';
20
19
  import './chunk-utils-timers.b48455ed.mjs';
21
20
 
@@ -67,15 +66,18 @@ function init(ctx) {
67
66
  moduleCache,
68
67
  config,
69
68
  mockMap,
70
- rpc: createBirpc({}, {
71
- eventNames: ["onUserConsoleLog", "onFinished", "onCollected", "onWorkerExit"],
72
- post(v) {
73
- port.postMessage(v);
74
- },
75
- on(fn) {
76
- port.addListener("message", fn);
69
+ rpc: createBirpc(
70
+ {},
71
+ {
72
+ eventNames: ["onUserConsoleLog", "onFinished", "onCollected", "onWorkerExit"],
73
+ post(v) {
74
+ port.postMessage(v);
75
+ },
76
+ on(fn) {
77
+ port.addListener("message", fn);
78
+ }
77
79
  }
78
- })
80
+ )
79
81
  };
80
82
  if (ctx.invalidates) {
81
83
  ctx.invalidates.forEach((fsPath) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest",
3
- "version": "0.21.1",
3
+ "version": "0.23.0",
4
4
  "description": "A blazing fast unit test framework powered by Vite",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -16,6 +16,7 @@
16
16
  "keywords": [
17
17
  "vite",
18
18
  "vite-node",
19
+ "vitest",
19
20
  "test",
20
21
  "jest"
21
22
  ],
@@ -35,6 +36,10 @@
35
36
  "types": "./dist/node.d.ts",
36
37
  "import": "./dist/node.mjs"
37
38
  },
39
+ "./environments": {
40
+ "types": "./dist/environments.d.ts",
41
+ "import": "./dist/environments.mjs"
42
+ },
38
43
  "./browser": {
39
44
  "types": "./dist/browser.d.ts",
40
45
  "import": "./dist/browser.mjs"
@@ -65,7 +70,6 @@
65
70
  "@edge-runtime/vm": "*",
66
71
  "@vitest/browser": "*",
67
72
  "@vitest/ui": "*",
68
- "c8": "*",
69
73
  "happy-dom": "*",
70
74
  "jsdom": "*"
71
75
  },
@@ -76,9 +80,6 @@
76
80
  "@vitest/browser": {
77
81
  "optional": true
78
82
  },
79
- "c8": {
80
- "optional": true
81
- },
82
83
  "happy-dom": {
83
84
  "optional": true
84
85
  },
@@ -96,13 +97,15 @@
96
97
  "chai": "^4.3.6",
97
98
  "debug": "^4.3.4",
98
99
  "local-pkg": "^0.4.2",
100
+ "strip-literal": "^0.4.0",
101
+ "tinybench": "^2.1.3",
99
102
  "tinypool": "^0.2.4",
100
- "tinyspy": "^1.0.0",
103
+ "tinyspy": "^1.0.2",
101
104
  "vite": "^2.9.12 || ^3.0.0-0"
102
105
  },
103
106
  "devDependencies": {
104
107
  "@antfu/install-pkg": "^0.1.0",
105
- "@edge-runtime/vm": "1.1.0-beta.26",
108
+ "@edge-runtime/vm": "1.1.0-beta.31",
106
109
  "@sinonjs/fake-timers": "^9.1.2",
107
110
  "@types/diff": "^5.0.2",
108
111
  "@types/jsdom": "^20.0.0",
@@ -110,35 +113,35 @@
110
113
  "@types/natural-compare": "^1.4.1",
111
114
  "@types/prompts": "^2.4.0",
112
115
  "@types/sinonjs__fake-timers": "^8.1.2",
113
- "@vitest/ui": "0.21.1",
116
+ "@vitest/ui": "0.23.0",
114
117
  "birpc": "^0.2.3",
115
- "c8": "^7.12.0",
116
- "cac": "^6.7.12",
118
+ "cac": "^6.7.14",
117
119
  "chai-subset": "^1.6.0",
118
120
  "cli-truncate": "^3.1.0",
119
121
  "diff": "^5.1.0",
122
+ "event-target-polyfill": "^0.0.3",
120
123
  "execa": "^6.1.0",
121
124
  "fast-glob": "^3.2.11",
122
125
  "find-up": "^6.3.0",
123
- "flatted": "^3.2.6",
126
+ "flatted": "^3.2.7",
124
127
  "happy-dom": "^6.0.4",
125
128
  "jsdom": "^20.0.0",
126
129
  "log-update": "^5.0.1",
127
130
  "magic-string": "^0.26.2",
128
131
  "micromatch": "^4.0.5",
129
- "mlly": "^0.5.7",
132
+ "mlly": "^0.5.14",
130
133
  "natural-compare": "^1.4.0",
131
134
  "p-limit": "^4.0.0",
132
135
  "pathe": "^0.2.0",
133
136
  "picocolors": "^1.0.0",
134
- "pkg-types": "^0.3.3",
137
+ "pkg-types": "^0.3.4",
135
138
  "pretty-format": "^27.5.1",
136
139
  "prompts": "^2.4.2",
137
- "rollup": "^2.77.2",
140
+ "rollup": "^2.78.1",
138
141
  "source-map-js": "^1.0.2",
139
142
  "strip-ansi": "^7.0.1",
140
- "typescript": "^4.7.4",
141
- "vite-node": "0.21.1",
143
+ "typescript": "^4.8.2",
144
+ "vite-node": "0.23.0",
142
145
  "ws": "^8.8.1"
143
146
  },
144
147
  "scripts": {
package/vitest.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import './dist/cli.mjs'
2
+ import './dist/cli-wrapper.mjs'
@@ -1,38 +0,0 @@
1
- import _url from 'url';
2
- import { y as resolve } from './chunk-mock-date.bc81a3ac.mjs';
3
-
4
- const rootDir = resolve(_url.fileURLToPath(import.meta.url), "../../");
5
- const distDir = resolve(_url.fileURLToPath(import.meta.url), "../../dist");
6
- const defaultPort = 51204;
7
- const API_PATH = "/__vitest_api__";
8
- const configFiles = [
9
- "vitest.config.ts",
10
- "vitest.config.mts",
11
- "vitest.config.cts",
12
- "vitest.config.js",
13
- "vitest.config.mjs",
14
- "vitest.config.cjs",
15
- "vite.config.ts",
16
- "vite.config.mts",
17
- "vite.config.cts",
18
- "vite.config.js",
19
- "vite.config.mjs",
20
- "vite.config.cjs"
21
- ];
22
- const globalApis = [
23
- "suite",
24
- "test",
25
- "describe",
26
- "it",
27
- "chai",
28
- "expect",
29
- "assert",
30
- "vitest",
31
- "vi",
32
- "beforeAll",
33
- "afterAll",
34
- "beforeEach",
35
- "afterEach"
36
- ];
37
-
38
- export { API_PATH as A, defaultPort as a, configFiles as c, distDir as d, globalApis as g, rootDir as r };