vitest 1.0.0-beta.4 → 1.0.0-beta.6

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 (66) hide show
  1. package/LICENSE.md +1 -513
  2. package/dist/browser.d.ts +1 -1
  3. package/dist/browser.js +4 -4
  4. package/dist/child.js +13 -17
  5. package/dist/{chunk-api-setup.6d19ab38.js → chunks/api-setup.jHV5vgr2.js} +97 -39
  6. package/dist/chunks/install-pkg.ORGzQeqb.js +457 -0
  7. package/dist/chunks/integrations-globals.eip0xL77.js +29 -0
  8. package/dist/{chunk-node-git.6c12e560.js → chunks/node-git.Hw101KjS.js} +1 -18
  9. package/dist/{chunk-runtime-console.f3263f87.js → chunks/runtime-console.hf2msWA9.js} +1 -1
  10. package/dist/cli-wrapper.js +2 -18
  11. package/dist/cli.js +19 -24
  12. package/dist/config.cjs +1 -1
  13. package/dist/config.d.ts +4 -6
  14. package/dist/config.js +1 -1
  15. package/dist/coverage.d.ts +25 -15
  16. package/dist/coverage.js +118 -49
  17. package/dist/entry-vm.js +13 -13
  18. package/dist/entry.js +14 -14
  19. package/dist/environments.d.ts +1 -1
  20. package/dist/environments.js +1 -1
  21. package/dist/execute.d.ts +1 -1
  22. package/dist/execute.js +3 -3
  23. package/dist/index.d.ts +168 -39
  24. package/dist/index.js +10 -10
  25. package/dist/node.d.ts +5 -5
  26. package/dist/node.js +17 -22
  27. package/dist/{vendor-paths.84fc7a99.js → paths.js} +1 -1
  28. package/dist/{reporters-50c2bd49.d.ts → reporters-vMlHjCdM.d.ts} +335 -365
  29. package/dist/reporters.d.ts +1 -1
  30. package/dist/reporters.js +7 -8
  31. package/dist/runners.d.ts +1 -1
  32. package/dist/runners.js +8 -8
  33. package/dist/{suite-ad69b7cd.d.ts → suite-vfxzpeqE.d.ts} +1 -1
  34. package/dist/suite.d.ts +2 -2
  35. package/dist/suite.js +3 -3
  36. package/dist/{vendor-benchmark.b6befc50.js → vendor/benchmark.WVm6DARl.js} +1 -1
  37. package/dist/{vendor-date.6e993429.js → vendor/date.Ns1pGd_X.js} +1 -0
  38. package/dist/{vendor-environments.dcc4a34e.js → vendor/environments.ewIbzajW.js} +2 -1
  39. package/dist/{vendor-execute.157302d6.js → vendor/execute.aMjV5C9u.js} +2 -4
  40. package/dist/{vendor-index.72df742e.js → vendor/index.VL3WbvjT.js} +4 -4
  41. package/dist/{vendor-index.2b92937b.js → vendor/index.XU72Rmy8.js} +1 -1
  42. package/dist/{vendor-index.57925a34.js → vendor/index.h0j9y5vy.js} +5 -5
  43. package/dist/vendor/index.xL8XjTLv.js +3962 -0
  44. package/dist/vendor/loader.-JDdZ5RJ.js +39 -0
  45. package/dist/{vendor-node.65461b16.js → vendor/node.1xm0UoNi.js} +1904 -5957
  46. package/dist/{vendor-reporters.d24d80a4.js → vendor/reporters.pr8MinP9.js} +429 -377
  47. package/dist/{vendor-rpc.171f65fb.js → vendor/rpc.Bl-ysZIr.js} +1 -1
  48. package/dist/{vendor-run-once.fb836747.js → vendor/run-once.X3E7xx3F.js} +1 -1
  49. package/dist/{vendor-vi.3baa7c4a.js → vendor/vi.JXuS6emb.js} +4 -4
  50. package/dist/vm.js +13 -18
  51. package/dist/worker.js +13 -18
  52. package/import-meta.d.ts +5 -0
  53. package/index.cjs +5 -0
  54. package/package.json +52 -53
  55. package/dist/chunk-install-pkg.e1d6323e.js +0 -1740
  56. package/dist/chunk-integrations-globals.2b099e04.js +0 -29
  57. package/dist/vendor-index.8efe7746.js +0 -2236
  58. package/dist/vendor-loader.9c966f23.js +0 -2089
  59. /package/dist/{vendor-_commonjsHelpers.7d1333e8.js → vendor/_commonjsHelpers.jjO7Zipk.js} +0 -0
  60. /package/dist/{vendor-base.9c08bbd0.js → vendor/base._79unx2z.js} +0 -0
  61. /package/dist/{vendor-constants.538d9b49.js → vendor/constants.WSvnD_fn.js} +0 -0
  62. /package/dist/{vendor-coverage.78040316.js → vendor/coverage.v6aD8iAh.js} +0 -0
  63. /package/dist/{vendor-global.c3664e75.js → vendor/global.L7JRz1qU.js} +0 -0
  64. /package/dist/{vendor-index.1ca68bd5.js → vendor/index.cAUulNDf.js} +0 -0
  65. /package/dist/{vendor-inspector.209edf5a.js → vendor/inspector.lFAeuaAt.js} +0 -0
  66. /package/dist/{vendor-tasks.f9d75aed.js → vendor/tasks.IknbGB2n.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { getSafeTimers } from '@vitest/utils';
2
- import { g as getWorkerState } from './vendor-global.c3664e75.js';
2
+ import { g as getWorkerState } from './global.L7JRz1qU.js';
3
3
 
4
4
  const { get } = Reflect;
5
5
  function withSafeTimers(fn) {
@@ -1,4 +1,4 @@
1
- import { g as getWorkerState } from './vendor-global.c3664e75.js';
1
+ import { g as getWorkerState } from './global.L7JRz1qU.js';
2
2
 
3
3
  const filesCount = /* @__PURE__ */ new Map();
4
4
  const cache = /* @__PURE__ */ new Map();
@@ -1,15 +1,15 @@
1
1
  import * as chai$1 from 'chai';
2
- import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './vendor-_commonjsHelpers.7d1333e8.js';
2
+ import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers.jjO7Zipk.js';
3
3
  import { equals, iterableEquality, subsetEquality, JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT as GLOBAL_EXPECT$1, ASYMMETRIC_MATCHERS_OBJECT as ASYMMETRIC_MATCHERS_OBJECT$1, getState, setState } from '@vitest/expect';
4
4
  import { stripSnapshotIndentation, addSerializer, SnapshotClient } from '@vitest/snapshot';
5
5
  import { getNames } from '@vitest/runner/utils';
6
6
  import '@vitest/utils/error';
7
7
  import { getCurrentTest } from '@vitest/runner';
8
- import { g as getFullName } from './vendor-tasks.f9d75aed.js';
9
- import { g as getWorkerState, a as getCurrentEnvironment } from './vendor-global.c3664e75.js';
8
+ import { g as getFullName } from './tasks.IknbGB2n.js';
9
+ import { g as getWorkerState, a as getCurrentEnvironment } from './global.L7JRz1qU.js';
10
10
  import { getSafeTimers, assertTypes, createSimpleStackTrace } from '@vitest/utils';
11
11
  import { parseSingleStack } from '@vitest/utils/source-map';
12
- import { R as RealDate, r as resetDate, m as mockDate } from './vendor-date.6e993429.js';
12
+ import { R as RealDate, r as resetDate, m as mockDate } from './date.Ns1pGd_X.js';
13
13
  import { spyOn, fn, isMockFunction, mocks } from '@vitest/spy';
14
14
 
15
15
  function resetModules(modules, resetMocks = false) {
package/dist/vm.js CHANGED
@@ -3,33 +3,28 @@ import { performance } from 'node:perf_hooks';
3
3
  import { isContext } from 'node:vm';
4
4
  import { ModuleCacheMap } from 'vite-node/client';
5
5
  import { workerId } from 'tinypool';
6
- import { c as createBirpc } from './vendor-index.1ca68bd5.js';
6
+ import { c as createBirpc } from './vendor/index.cAUulNDf.js';
7
7
  import { resolve } from 'pathe';
8
8
  import { installSourcemapsSupport } from 'vite-node/source-map';
9
- import { d as distDir } from './vendor-paths.84fc7a99.js';
10
- import { l as loadEnvironment } from './vendor-loader.9c966f23.js';
11
- import { b as startVitestExecutor } from './vendor-execute.157302d6.js';
12
- import { createCustomConsole } from './chunk-runtime-console.f3263f87.js';
13
- import { c as createSafeRpc } from './vendor-rpc.171f65fb.js';
14
- import 'acorn';
15
- import 'node:module';
16
- import 'node:fs';
17
- import 'node:assert';
18
- import 'node:process';
19
- import 'node:path';
20
- import 'node:v8';
21
- import 'node:util';
22
- import './vendor-environments.dcc4a34e.js';
9
+ import { distDir } from './paths.js';
10
+ import { l as loadEnvironment } from './vendor/loader.-JDdZ5RJ.js';
11
+ import { b as startVitestExecutor } from './vendor/execute.aMjV5C9u.js';
12
+ import { createCustomConsole } from './chunks/runtime-console.hf2msWA9.js';
13
+ import { c as createSafeRpc } from './vendor/rpc.Bl-ysZIr.js';
14
+ import './vendor/environments.ewIbzajW.js';
23
15
  import 'node:console';
24
16
  import 'local-pkg';
25
17
  import 'vite-node/utils';
26
18
  import '@vitest/utils/error';
19
+ import 'node:fs';
27
20
  import '@vitest/utils';
28
- import './vendor-base.9c08bbd0.js';
21
+ import './vendor/base._79unx2z.js';
22
+ import 'node:path';
23
+ import 'node:module';
29
24
  import 'vite-node/constants';
30
25
  import 'node:stream';
31
- import './vendor-date.6e993429.js';
32
- import './vendor-global.c3664e75.js';
26
+ import './vendor/date.Ns1pGd_X.js';
27
+ import './vendor/global.L7JRz1qU.js';
33
28
 
34
29
  const entryFile = pathToFileURL(resolve(distDir, "entry-vm.js")).href;
35
30
  async function run(ctx) {
package/dist/worker.js CHANGED
@@ -1,31 +1,26 @@
1
1
  import { performance } from 'node:perf_hooks';
2
- import { c as createBirpc } from './vendor-index.1ca68bd5.js';
2
+ import { c as createBirpc } from './vendor/index.cAUulNDf.js';
3
3
  import { workerId } from 'tinypool';
4
- import { g as getWorkerState } from './vendor-global.c3664e75.js';
5
- import { l as loadEnvironment } from './vendor-loader.9c966f23.js';
6
- import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor-execute.157302d6.js';
7
- import { s as setupInspect } from './vendor-inspector.209edf5a.js';
8
- import { r as rpcDone, c as createSafeRpc } from './vendor-rpc.171f65fb.js';
4
+ import { g as getWorkerState } from './vendor/global.L7JRz1qU.js';
5
+ import { l as loadEnvironment } from './vendor/loader.-JDdZ5RJ.js';
6
+ import { s as startViteNode, m as moduleCache, a as mockMap } from './vendor/execute.aMjV5C9u.js';
7
+ import { s as setupInspect } from './vendor/inspector.lFAeuaAt.js';
8
+ import { r as rpcDone, c as createSafeRpc } from './vendor/rpc.Bl-ysZIr.js';
9
9
  import 'pathe';
10
- import 'acorn';
11
- import 'node:module';
12
- import 'node:fs';
13
- import 'node:url';
14
- import 'node:assert';
15
- import 'node:process';
16
- import 'node:path';
17
- import 'node:v8';
18
- import 'node:util';
19
10
  import 'vite-node/client';
20
- import './vendor-environments.dcc4a34e.js';
11
+ import './vendor/environments.ewIbzajW.js';
21
12
  import 'node:console';
22
13
  import 'local-pkg';
14
+ import 'node:url';
23
15
  import 'node:vm';
24
16
  import 'vite-node/utils';
25
17
  import '@vitest/utils/error';
26
- import './vendor-paths.84fc7a99.js';
18
+ import './paths.js';
19
+ import 'node:fs';
27
20
  import '@vitest/utils';
28
- import './vendor-base.9c08bbd0.js';
21
+ import './vendor/base._79unx2z.js';
22
+ import 'node:path';
23
+ import 'node:module';
29
24
  import 'vite-node/constants';
30
25
 
31
26
  async function init(ctx) {
@@ -0,0 +1,5 @@
1
+ /// <reference path="./importMeta.d.ts" />
2
+
3
+ // https://github.com/microsoft/TypeScript/issues/45096
4
+ // TypeScript has a bug that makes <reference types="vite/types/importMeta" />
5
+ // not possible in userland. This file provides a workaround for now.
package/index.cjs CHANGED
@@ -0,0 +1,5 @@
1
+ throw new Error(
2
+ 'Vitest cannot be imported in a CommonJS module using require(). Please use "import" instead.'
3
+ + '\n\nIf you are using "import" in your source code, then it\'s possible it was bundled into require() automatically by your bundler. '
4
+ + 'In that case, do not bundle CommonJS output since it will never work with Vitest, or use dynamic import() which is available in all CommonJS modules.',
5
+ )
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.4",
4
+ "version": "1.0.0-beta.6",
5
5
  "description": "Next generation testing framework powered by Vite",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -25,13 +25,13 @@
25
25
  "sideEffects": false,
26
26
  "exports": {
27
27
  ".": {
28
- "require": {
29
- "types": "./index.d.cts",
30
- "default": "./index.cjs"
31
- },
32
28
  "import": {
33
29
  "types": "./dist/index.d.ts",
34
30
  "default": "./dist/index.js"
31
+ },
32
+ "require": {
33
+ "types": "./index.d.cts",
34
+ "default": "./index.cjs"
35
35
  }
36
36
  },
37
37
  "./*": "./*",
@@ -41,46 +41,49 @@
41
41
  "./importMeta": {
42
42
  "types": "./importMeta.d.ts"
43
43
  },
44
+ "./import-meta": {
45
+ "types": "./import-meta.d.ts"
46
+ },
44
47
  "./node": {
45
48
  "types": "./dist/node.d.ts",
46
- "import": "./dist/node.js"
49
+ "default": "./dist/node.js"
47
50
  },
48
51
  "./execute": {
49
52
  "types": "./dist/execute.d.ts",
50
- "import": "./dist/execute.js"
53
+ "default": "./dist/execute.js"
51
54
  },
52
55
  "./browser": {
53
56
  "types": "./dist/browser.d.ts",
54
- "import": "./dist/browser.js"
57
+ "default": "./dist/browser.js"
55
58
  },
56
59
  "./runners": {
57
60
  "types": "./dist/runners.d.ts",
58
- "import": "./dist/runners.js"
61
+ "default": "./dist/runners.js"
59
62
  },
60
63
  "./suite": {
61
64
  "types": "./dist/suite.d.ts",
62
- "import": "./dist/suite.js"
65
+ "default": "./dist/suite.js"
63
66
  },
64
67
  "./environments": {
65
68
  "types": "./dist/environments.d.ts",
66
- "import": "./dist/environments.js"
69
+ "default": "./dist/environments.js"
67
70
  },
68
71
  "./utils": {
69
72
  "types": "./dist/utils.d.ts",
70
- "import": "./dist/utils.js"
73
+ "default": "./dist/utils.js"
71
74
  },
72
75
  "./config": {
73
76
  "types": "./config.d.ts",
74
77
  "require": "./dist/config.cjs",
75
- "import": "./dist/config.js"
78
+ "default": "./dist/config.js"
76
79
  },
77
80
  "./coverage": {
78
81
  "types": "./coverage.d.ts",
79
- "import": "./dist/coverage.js"
82
+ "default": "./dist/coverage.js"
80
83
  },
81
84
  "./reporters": {
82
85
  "types": "./dist/reporters.d.ts",
83
- "import": "./dist/reporters.js"
86
+ "default": "./dist/reporters.js"
84
87
  }
85
88
  },
86
89
  "main": "./dist/index.js",
@@ -90,12 +93,12 @@
90
93
  "vitest": "./vitest.mjs"
91
94
  },
92
95
  "files": [
93
- "dist",
94
- "bin",
95
- "*.d.ts",
96
+ "*.cjs",
96
97
  "*.d.cts",
98
+ "*.d.ts",
97
99
  "*.mjs",
98
- "*.cjs"
100
+ "bin",
101
+ "dist"
99
102
  ],
100
103
  "engines": {
101
104
  "node": "^18.0.0 || >=20.0.0"
@@ -129,61 +132,57 @@
129
132
  }
130
133
  },
131
134
  "dependencies": {
132
- "acorn": "^8.9.0",
133
- "acorn-walk": "^8.2.0",
135
+ "acorn-walk": "^8.3.0",
134
136
  "cac": "^6.7.14",
135
137
  "chai": "^4.3.10",
136
138
  "debug": "^4.3.4",
137
- "local-pkg": "^0.4.3",
139
+ "execa": "^8.0.1",
140
+ "local-pkg": "^0.5.0",
138
141
  "magic-string": "^0.30.5",
139
142
  "pathe": "^1.1.1",
140
143
  "picocolors": "^1.0.0",
141
- "std-env": "^3.3.3",
142
- "strip-literal": "^1.0.1",
143
- "tinybench": "^2.5.0",
144
+ "std-env": "^3.5.0",
145
+ "strip-literal": "^1.3.0",
146
+ "tinybench": "^2.5.1",
144
147
  "tinypool": "^0.8.1",
145
- "vite": "^3.1.0 || ^4.0.0 || ^5.0.0-0",
148
+ "vite": "^5.0.0-beta.19 || ^5.0.0",
146
149
  "why-is-node-running": "^2.2.2",
147
- "@vitest/spy": "1.0.0-beta.4",
148
- "@vitest/expect": "1.0.0-beta.4",
149
- "@vitest/runner": "1.0.0-beta.4",
150
- "@vitest/snapshot": "1.0.0-beta.4",
151
- "@vitest/utils": "1.0.0-beta.4",
152
- "vite-node": "1.0.0-beta.4"
150
+ "@vitest/expect": "1.0.0-beta.6",
151
+ "@vitest/runner": "1.0.0-beta.6",
152
+ "@vitest/spy": "1.0.0-beta.6",
153
+ "@vitest/snapshot": "1.0.0-beta.6",
154
+ "vite-node": "1.0.0-beta.6",
155
+ "@vitest/utils": "1.0.0-beta.6"
153
156
  },
154
157
  "devDependencies": {
155
158
  "@ampproject/remapping": "^2.2.1",
156
159
  "@antfu/install-pkg": "^0.1.1",
157
- "@edge-runtime/vm": "3.0.3",
160
+ "@edge-runtime/vm": "^3.1.7",
158
161
  "@sinonjs/fake-timers": "11.1.0",
159
- "@types/diff": "^5.0.3",
160
- "@types/estree": "^1.0.1",
161
- "@types/istanbul-lib-coverage": "^2.0.4",
162
- "@types/istanbul-reports": "^3.0.1",
163
- "@types/jsdom": "^21.1.1",
164
- "@types/micromatch": "^4.0.2",
165
- "@types/prompts": "^2.4.4",
166
- "@types/sinonjs__fake-timers": "^8.1.2",
162
+ "@types/estree": "^1.0.5",
163
+ "@types/istanbul-lib-coverage": "^2.0.6",
164
+ "@types/istanbul-reports": "^3.0.4",
165
+ "@types/jsdom": "^21.1.6",
166
+ "@types/micromatch": "^4.0.5",
167
+ "@types/prompts": "^2.4.8",
168
+ "@types/sinonjs__fake-timers": "^8.1.5",
167
169
  "birpc": "0.2.14",
168
170
  "chai-subset": "^1.6.0",
169
- "cli-truncate": "^3.1.0",
170
- "execa": "^7.1.1",
171
- "expect-type": "^0.16.0",
172
- "fast-glob": "^3.3.0",
171
+ "cli-truncate": "^4.0.0",
172
+ "expect-type": "^0.17.3",
173
+ "fast-glob": "^3.3.2",
173
174
  "find-up": "^6.3.0",
174
- "flatted": "^3.2.7",
175
- "get-tsconfig": "^4.6.2",
176
- "happy-dom": "^9.20.3",
175
+ "flatted": "^3.2.9",
176
+ "get-tsconfig": "^4.7.2",
177
+ "happy-dom": "^12.10.3",
177
178
  "jsdom": "^22.1.0",
178
179
  "log-update": "^6.0.0",
179
180
  "micromatch": "^4.0.5",
180
- "mlly": "^1.4.0",
181
- "p-limit": "^4.0.0",
182
- "pkg-types": "^1.0.3",
183
- "pretty-format": "^29.5.0",
181
+ "p-limit": "^5.0.0",
182
+ "pretty-format": "^29.7.0",
184
183
  "prompts": "^2.4.2",
185
184
  "strip-ansi": "^7.1.0",
186
- "ws": "^8.13.0"
185
+ "ws": "^8.14.2"
187
186
  },
188
187
  "scripts": {
189
188
  "build": "rimraf dist && rollup -c",