vitest 0.0.115 → 0.0.116
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.
- package/LICENSE.md +27 -28
- package/dist/cli.js +6 -6
- package/dist/{constants-5968a78c.js → constants-080f26e8.js} +1 -1
- package/dist/{diff-67678e1f.js → diff-80c47cfa.js} +1 -1
- package/dist/entry.js +46 -12
- package/dist/{global-bc40af7c.js → global-a73dfade.js} +4 -4
- package/dist/{index-b4f86684.js → index-1af8810e.js} +25 -20
- package/dist/{index-7f57c252.js → index-80d9a771.js} +1 -1
- package/dist/{index-7c024e16.js → index-bf29f0e6.js} +2 -1
- package/dist/index.d.ts +14 -15
- package/dist/index.js +3 -3
- package/dist/node.d.ts +13 -14
- package/dist/node.js +4 -4
- package/dist/setup-95b119ff.js +4318 -0
- package/dist/utils.js +1 -1
- package/dist/{vi-2115c609.js → vi-b3412f83.js} +4 -15
- package/dist/worker.js +3 -3
- package/package.json +4 -5
- package/dist/middleware-647438b9.js +0 -81
package/dist/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { l as deepMerge, e as ensurePackageInstalled, g as getFullName, u as getNames, f as getSuites, z as getTasks, j as getTests, h as hasFailed, x as hasTests, v as interpretOnlyMode, i as isObject, y as isWindows, p as mergeSlashes, n as noop, o as notNullish, w as partitionSuiteChildren, k as resolvePath, s as slash, t as toArray, m as toFilePath } from './index-
|
|
1
|
+
export { l as deepMerge, e as ensurePackageInstalled, g as getFullName, u as getNames, f as getSuites, z as getTasks, j as getTests, h as hasFailed, x as hasTests, v as interpretOnlyMode, i as isObject, y as isWindows, p as mergeSlashes, n as noop, o as notNullish, w as partitionSuiteChildren, k as resolvePath, s as slash, t as toArray, m as toFilePath } from './index-bf29f0e6.js';
|
|
2
2
|
import 'url';
|
|
3
3
|
import 'tty';
|
|
4
4
|
import 'local-pkg';
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
import { n as noop, i as isObject } from './index-
|
|
1
|
+
import { n as noop, i as isObject } from './index-bf29f0e6.js';
|
|
2
2
|
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-c9e3b764.js';
|
|
3
3
|
import { a as spyOn, f as fn, s as spies } from './jest-mock-4a754991.js';
|
|
4
4
|
|
|
5
|
-
let urlAlphabet =
|
|
6
|
-
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
|
|
7
|
-
let nanoid = (size = 21) => {
|
|
8
|
-
let id = '';
|
|
9
|
-
let i = size;
|
|
10
|
-
while (i--) {
|
|
11
|
-
id += urlAlphabet[(Math.random() * 64) | 0];
|
|
12
|
-
}
|
|
13
|
-
return id
|
|
14
|
-
};
|
|
15
|
-
|
|
16
5
|
var __defProp = Object.defineProperty;
|
|
17
6
|
var __defProps = Object.defineProperties;
|
|
18
7
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -145,7 +134,7 @@ function createSuiteCollector(name, factory = () => {
|
|
|
145
134
|
const mode2 = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
|
|
146
135
|
const computeMode = this.concurrent ? "concurrent" : void 0;
|
|
147
136
|
const test3 = {
|
|
148
|
-
id:
|
|
137
|
+
id: "",
|
|
149
138
|
type: "test",
|
|
150
139
|
name: name2,
|
|
151
140
|
mode: mode2,
|
|
@@ -171,7 +160,7 @@ function createSuiteCollector(name, factory = () => {
|
|
|
171
160
|
}
|
|
172
161
|
function initSuite() {
|
|
173
162
|
suite2 = {
|
|
174
|
-
id:
|
|
163
|
+
id: "",
|
|
175
164
|
type: "suite",
|
|
176
165
|
computeMode: "serial",
|
|
177
166
|
name,
|
|
@@ -1025,4 +1014,4 @@ class VitestUtils {
|
|
|
1025
1014
|
const vitest = new VitestUtils();
|
|
1026
1015
|
const vi = vitest;
|
|
1027
1016
|
|
|
1028
|
-
export { JestChaiExpect as J, getDefaultHookTimeout as a, getState as b, suite as c, describe as d, vi as e, equals as f, getCurrentSuite as g, iterableEquality as h, it as i, subsetEquality as j, isA as k, clearContext as l, defaultSuite as m,
|
|
1017
|
+
export { JestChaiExpect as J, getDefaultHookTimeout as a, getState as b, suite as c, describe as d, vi as e, equals as f, getCurrentSuite as g, iterableEquality as h, it as i, subsetEquality as j, isA as k, clearContext as l, defaultSuite as m, setHooks as n, getHooks as o, context as p, getFn as q, setState as s, test as t, vitest as v, withTimeout as w };
|
package/dist/worker.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { k as resolve, d as dirname$2, b as basename$2, p as mergeSlashes, s as slash, m as toFilePath } from './index-
|
|
1
|
+
import { k as resolve, d as dirname$2, b as basename$2, p as mergeSlashes, s as slash, m as toFilePath } from './index-bf29f0e6.js';
|
|
2
2
|
import { c as createBirpc } from './index-e909c175.js';
|
|
3
|
-
import { c as distDir } from './constants-
|
|
3
|
+
import { c as distDir } from './constants-080f26e8.js';
|
|
4
4
|
import { builtinModules, createRequire } from 'module';
|
|
5
5
|
import { pathToFileURL, fileURLToPath as fileURLToPath$2, URL as URL$1 } from 'url';
|
|
6
6
|
import vm from 'vm';
|
|
@@ -9596,7 +9596,7 @@ function init(ctx) {
|
|
|
9596
9596
|
config,
|
|
9597
9597
|
rpc: createBirpc({
|
|
9598
9598
|
functions: {},
|
|
9599
|
-
eventNames: ["onUserLog", "onCollected", "
|
|
9599
|
+
eventNames: ["onUserLog", "onCollected", "onWorkerExit"],
|
|
9600
9600
|
post(v) {
|
|
9601
9601
|
port.postMessage(v);
|
|
9602
9602
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.116",
|
|
4
4
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vite",
|
|
@@ -79,7 +79,6 @@
|
|
|
79
79
|
"micromatch": "^4.0.4",
|
|
80
80
|
"mlly": "^0.3.16",
|
|
81
81
|
"mockdate": "^3.0.5",
|
|
82
|
-
"nanoid": "^3.1.30",
|
|
83
82
|
"natural-compare": "^1.4.0",
|
|
84
83
|
"pathe": "^0.2.0",
|
|
85
84
|
"picocolors": "^1.0.0",
|
|
@@ -89,7 +88,8 @@
|
|
|
89
88
|
"rollup": "^2.62.0",
|
|
90
89
|
"source-map-js": "^1.0.1",
|
|
91
90
|
"strip-ansi": "^7.0.1",
|
|
92
|
-
"typescript": "^4.5.4"
|
|
91
|
+
"typescript": "^4.5.4",
|
|
92
|
+
"ws": "^8.4.0"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
95
|
"c8": "*",
|
|
@@ -113,8 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
"scripts": {
|
|
115
115
|
"build": "rimraf dist && rollup -c",
|
|
116
|
-
"dev": "rollup -c --watch src"
|
|
117
|
-
"typecheck": "tsc --noEmit"
|
|
116
|
+
"dev": "rollup -c --watch src"
|
|
118
117
|
},
|
|
119
118
|
"readme": "# vitest\n\n[](https://www.npmjs.com/package/vitest)\n\nA blazing fast unit test framework powered by Vite.\n\n> **This project is currently in closed beta exclusively for Sponsors.**<br>\n> Become a Sponsor of [@patak-dev](https://github.com/sponsors/patak-dev) or [@antfu](https://github.com/sponsors/antfu) to access the source code and issues tracker.\n> Learn more at [vitest.dev](https://vitest.dev)\n"
|
|
120
119
|
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { A as API_PATH } from './constants-5968a78c.js';
|
|
2
|
-
import 'url';
|
|
3
|
-
import './index-7c024e16.js';
|
|
4
|
-
import 'tty';
|
|
5
|
-
import 'local-pkg';
|
|
6
|
-
import 'path';
|
|
7
|
-
|
|
8
|
-
/*! (c) 2020 Andrea Giammarchi */
|
|
9
|
-
|
|
10
|
-
const {parse: $parse, stringify: $stringify} = JSON;
|
|
11
|
-
|
|
12
|
-
const Primitive = String; // it could be Number
|
|
13
|
-
const primitive = 'string'; // it could be 'number'
|
|
14
|
-
const object = 'object';
|
|
15
|
-
|
|
16
|
-
const noop = (_, value) => value;
|
|
17
|
-
|
|
18
|
-
const set = (known, input, value) => {
|
|
19
|
-
const index = Primitive(input.push(value) - 1);
|
|
20
|
-
known.set(value, index);
|
|
21
|
-
return index;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const stringify = (value, replacer, space) => {
|
|
25
|
-
const $ = replacer && typeof replacer === object ?
|
|
26
|
-
(k, v) => (k === '' || -1 < replacer.indexOf(k) ? v : void 0) :
|
|
27
|
-
(replacer || noop);
|
|
28
|
-
const known = new Map;
|
|
29
|
-
const input = [];
|
|
30
|
-
const output = [];
|
|
31
|
-
let i = +set(known, input, $.call({'': value}, '', value));
|
|
32
|
-
let firstRun = !i;
|
|
33
|
-
while (i < input.length) {
|
|
34
|
-
firstRun = true;
|
|
35
|
-
output[i] = $stringify(input[i++], replace, space);
|
|
36
|
-
}
|
|
37
|
-
return '[' + output.join(',') + ']';
|
|
38
|
-
function replace(key, value) {
|
|
39
|
-
if (firstRun) {
|
|
40
|
-
firstRun = !firstRun;
|
|
41
|
-
return value;
|
|
42
|
-
}
|
|
43
|
-
const after = $.call(this, key, value);
|
|
44
|
-
switch (typeof after) {
|
|
45
|
-
case object:
|
|
46
|
-
if (after === null) return after;
|
|
47
|
-
case primitive:
|
|
48
|
-
return known.get(after) || set(known, input, after);
|
|
49
|
-
}
|
|
50
|
-
return after;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
function sendFlatted(res, data) {
|
|
55
|
-
res.setHeader("Content-Type", "application/json");
|
|
56
|
-
res.write(stringify(data));
|
|
57
|
-
res.statusCode = 200;
|
|
58
|
-
res.end();
|
|
59
|
-
}
|
|
60
|
-
function middlewareAPI(ctx) {
|
|
61
|
-
return (req, res, next) => {
|
|
62
|
-
var _a;
|
|
63
|
-
if (!((_a = req.url) == null ? void 0 : _a.startsWith(API_PATH)))
|
|
64
|
-
return next();
|
|
65
|
-
const url = req.url.slice(API_PATH.length);
|
|
66
|
-
if (url === "/") {
|
|
67
|
-
return sendFlatted(res, {
|
|
68
|
-
files: ctx.state.filesMap
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
if (url === "/files") {
|
|
72
|
-
return sendFlatted(res, {
|
|
73
|
-
files: Object.keys(ctx.state.filesMap)
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
res.statusCode = 404;
|
|
77
|
-
res.end();
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export { middlewareAPI as default, sendFlatted };
|