vitest 0.0.84 → 0.0.89
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/bin/vitest.mjs +2 -0
- package/dist/cli.js +25 -9
- package/dist/entry.js +61 -77
- package/dist/{error-c651f5ae.js → error-309196c9.js} +5 -68
- package/dist/{global-e172af93.js → global-f3eab75a.js} +2 -2
- package/dist/index-722fb5a5.js +122 -0
- package/dist/{index-ad1b10e4.js → index-733e7378.js} +178 -162
- package/dist/index.d.ts +49 -5
- package/dist/index.js +2 -2
- package/dist/node.js +5 -5
- package/dist/{suite-0e21bf9b.js → suite-b8c6cb53.js} +2 -2
- package/dist/utils-385e2d09.js +143 -0
- package/dist/utils.js +3 -0
- package/dist/worker.js +8273 -52
- package/package.json +6 -3
- package/dist/index-906ac3f9.js +0 -34
- package/dist/utils-9dcc4050.js +0 -64
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.89",
|
|
4
4
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vite",
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
"micromatch": "^4.0.4",
|
|
57
57
|
"piscina": "^3.2.0",
|
|
58
58
|
"source-map": "^0.7.3",
|
|
59
|
-
"tinyspy": "^0.0
|
|
59
|
+
"tinyspy": "^0.1.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/diff": "^5.0.1",
|
|
63
63
|
"@types/jsdom": "^16.2.13",
|
|
64
64
|
"@types/micromatch": "^4.0.2",
|
|
65
65
|
"@types/natural-compare": "^1.4.1",
|
|
66
|
-
"@types/node": "^16.11.
|
|
66
|
+
"@types/node": "^16.11.13",
|
|
67
67
|
"c8": "^7.10.0",
|
|
68
68
|
"cac": "^6.7.12",
|
|
69
69
|
"cli-truncate": "^3.1.0",
|
|
@@ -72,9 +72,12 @@
|
|
|
72
72
|
"happy-dom": "^2.24.5",
|
|
73
73
|
"jsdom": "^19.0.0",
|
|
74
74
|
"log-update": "^5.0.0",
|
|
75
|
+
"mlly": "^0.3.15",
|
|
75
76
|
"nanoid": "^3.1.30",
|
|
76
77
|
"natural-compare": "^1.4.0",
|
|
78
|
+
"pathe": "^0.2.0",
|
|
77
79
|
"picocolors": "^1.0.0",
|
|
80
|
+
"pkg-types": "^0.3.2",
|
|
78
81
|
"pretty-format": "^27.4.2",
|
|
79
82
|
"rollup": "^2.61.1",
|
|
80
83
|
"strip-ansi": "^7.0.1"
|
package/dist/index-906ac3f9.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, s as suite, t as test, d as describe, i as it } from './suite-0e21bf9b.js';
|
|
2
|
-
import chai, { assert, should, expect } from 'chai';
|
|
3
|
-
import { spyOn, spy } from 'tinyspy';
|
|
4
|
-
|
|
5
|
-
const beforeAll = (fn, timeout) => getCurrentSuite().on("beforeAll", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
|
|
6
|
-
const afterAll = (fn, timeout) => getCurrentSuite().on("afterAll", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
|
|
7
|
-
const beforeEach = (fn, timeout) => getCurrentSuite().on("beforeEach", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
|
|
8
|
-
const afterEach = (fn, timeout) => getCurrentSuite().on("afterEach", withTimeout(fn, timeout ?? getDefaultHookTimeout()));
|
|
9
|
-
|
|
10
|
-
const vitest = {
|
|
11
|
-
spyOn,
|
|
12
|
-
fn: spy
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
var index = /*#__PURE__*/Object.freeze({
|
|
16
|
-
__proto__: null,
|
|
17
|
-
suite: suite,
|
|
18
|
-
test: test,
|
|
19
|
-
describe: describe,
|
|
20
|
-
it: it,
|
|
21
|
-
beforeAll: beforeAll,
|
|
22
|
-
afterAll: afterAll,
|
|
23
|
-
beforeEach: beforeEach,
|
|
24
|
-
afterEach: afterEach,
|
|
25
|
-
assert: assert,
|
|
26
|
-
should: should,
|
|
27
|
-
expect: expect,
|
|
28
|
-
chai: chai,
|
|
29
|
-
spy: spy,
|
|
30
|
-
spyOn: spyOn,
|
|
31
|
-
vitest: vitest
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
export { afterAll as a, beforeAll as b, beforeEach as c, afterEach as d, index as i, vitest as v };
|
package/dist/utils-9dcc4050.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
function toArray(array) {
|
|
2
|
-
array = array || [];
|
|
3
|
-
if (Array.isArray(array))
|
|
4
|
-
return array;
|
|
5
|
-
return [array];
|
|
6
|
-
}
|
|
7
|
-
function notNullish(v) {
|
|
8
|
-
return v != null;
|
|
9
|
-
}
|
|
10
|
-
function slash(str) {
|
|
11
|
-
return str.replace(/\\/g, "/");
|
|
12
|
-
}
|
|
13
|
-
function partitionSuiteChildren(suite) {
|
|
14
|
-
let tasksGroup = [];
|
|
15
|
-
const tasksGroups = [];
|
|
16
|
-
for (const c of suite.tasks) {
|
|
17
|
-
if (tasksGroup.length === 0 || c.computeMode === tasksGroup[0].computeMode) {
|
|
18
|
-
tasksGroup.push(c);
|
|
19
|
-
} else {
|
|
20
|
-
tasksGroups.push(tasksGroup);
|
|
21
|
-
tasksGroup = [c];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
if (tasksGroup.length > 0)
|
|
25
|
-
tasksGroups.push(tasksGroup);
|
|
26
|
-
return tasksGroups;
|
|
27
|
-
}
|
|
28
|
-
function interpretOnlyMode(items) {
|
|
29
|
-
if (items.some((i) => i.mode === "only")) {
|
|
30
|
-
items.forEach((i) => {
|
|
31
|
-
if (i.mode === "run")
|
|
32
|
-
i.mode = "skip";
|
|
33
|
-
else if (i.mode === "only")
|
|
34
|
-
i.mode = "run";
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function getTests(suite) {
|
|
39
|
-
return toArray(suite).flatMap((s) => s.tasks.flatMap((c) => c.type === "test" ? [c] : getTests(c)));
|
|
40
|
-
}
|
|
41
|
-
function getSuites(suite) {
|
|
42
|
-
return toArray(suite).flatMap((s) => s.type === "suite" ? [s, ...getSuites(s.tasks)] : []);
|
|
43
|
-
}
|
|
44
|
-
function hasTests(suite) {
|
|
45
|
-
return toArray(suite).some((s) => s.tasks.some((c) => c.type === "test" || hasTests(c)));
|
|
46
|
-
}
|
|
47
|
-
function hasFailed(suite) {
|
|
48
|
-
return toArray(suite).some((s) => {
|
|
49
|
-
var _a;
|
|
50
|
-
return ((_a = s.result) == null ? void 0 : _a.state) === "fail" || s.type === "suite" && hasFailed(s.tasks);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
function getNames(task) {
|
|
54
|
-
const names = [task.name];
|
|
55
|
-
let current = task;
|
|
56
|
-
while ((current == null ? void 0 : current.suite) || (current == null ? void 0 : current.file)) {
|
|
57
|
-
current = current.suite || current.file;
|
|
58
|
-
if (current == null ? void 0 : current.name)
|
|
59
|
-
names.unshift(current.name);
|
|
60
|
-
}
|
|
61
|
-
return names;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export { getTests as a, getSuites as b, hasTests as c, getNames as g, hasFailed as h, interpretOnlyMode as i, notNullish as n, partitionSuiteChildren as p, slash as s, toArray as t };
|