vitest 0.0.88 → 0.0.92

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.
@@ -1,34 +0,0 @@
1
- import { stringify } from 'flatted';
2
- import { A as API_PATH } from './constants-adef7ffb.js';
3
- import 'path';
4
- import 'url';
5
-
6
- function sendFlatted(res, data) {
7
- res.setHeader("Content-Type", "application/json");
8
- res.write(stringify(data));
9
- res.statusCode = 200;
10
- res.end();
11
- }
12
- function middlewareAPI() {
13
- return (req, res, next) => {
14
- var _a;
15
- if (!((_a = req.url) == null ? void 0 : _a.startsWith(API_PATH)))
16
- return next();
17
- const url = req.url.slice(API_PATH.length);
18
- const ctx = process.__vitest__;
19
- if (url === "/") {
20
- return sendFlatted(res, {
21
- files: ctx.state.filesMap
22
- });
23
- }
24
- if (url === "/files") {
25
- return sendFlatted(res, {
26
- files: Object.keys(ctx.state.filesMap)
27
- });
28
- }
29
- res.statusCode = 404;
30
- res.end();
31
- };
32
- }
33
-
34
- export { middlewareAPI as default, sendFlatted };
@@ -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 };