@storybook/addon-vitest 0.0.0-pr-32565-sha-8f903c5d → 0.0.0-pr-32412-sha-f670336d
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/dist/_node-chunks/{chunk-AHE2UYFC.js → chunk-BH6F467E.js} +7 -7
- package/dist/_node-chunks/{chunk-KRURVMKM.js → chunk-DVLGX7KC.js} +7 -7
- package/dist/_node-chunks/{chunk-BXMZWF45.js → chunk-GEFSDVGO.js} +6 -6
- package/dist/_node-chunks/{chunk-5UHXCOLZ.js → chunk-KS3JRSUN.js} +8 -8
- package/dist/_node-chunks/{chunk-F2DQAZRF.js → chunk-KZ5LF3T5.js} +7 -7
- package/dist/_node-chunks/{chunk-3EI5NE3R.js → chunk-RP6WLMKP.js} +6 -6
- package/dist/_node-chunks/{chunk-AJNF3TZN.js → chunk-V7LY2TOV.js} +9 -9
- package/dist/_node-chunks/chunk-XVEIRRY6.js +295 -0
- package/dist/manager.js +6 -9
- package/dist/node/coverage-reporter.js +8 -8
- package/dist/node/vitest.js +21 -42
- package/dist/postinstall.js +24 -31
- package/dist/preset.js +12 -12
- package/dist/vitest-plugin/global-setup.js +7 -7
- package/dist/vitest-plugin/index.js +12 -15
- package/dist/vitest-plugin/test-utils.js +7 -10
- package/package.json +4 -4
- package/dist/_node-chunks/chunk-L5S4YRY2.js +0 -98
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_o9do0xuxool from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_o9do0xuxool from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_o9do0xuxool from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_o9do0xuxool.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_o9do0xuxool.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_o9do0xuxool.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,7 +12,7 @@ var require = CJS_COMPAT_NODE_MODULE_e8dl72afsp.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
__commonJS,
|
|
14
14
|
__name
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-RP6WLMKP.js";
|
|
16
16
|
|
|
17
17
|
// ../../node_modules/picocolors/picocolors.js
|
|
18
18
|
var require_picocolors = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_o9do0xuxool from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_o9do0xuxool from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_o9do0xuxool from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_o9do0xuxool.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_o9do0xuxool.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_o9do0xuxool.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,7 +12,7 @@ var require = CJS_COMPAT_NODE_MODULE_e8dl72afsp.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
__commonJS,
|
|
14
14
|
__name
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-RP6WLMKP.js";
|
|
16
16
|
|
|
17
17
|
// ../../node_modules/semver/internal/constants.js
|
|
18
18
|
var require_constants = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_o9do0xuxool from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_o9do0xuxool from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_o9do0xuxool from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_o9do0xuxool.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_o9do0xuxool.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_o9do0xuxool.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_o9do0xuxool from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_o9do0xuxool from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_o9do0xuxool from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_o9do0xuxool.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_o9do0xuxool.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_o9do0xuxool.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,13 +12,13 @@ var require = CJS_COMPAT_NODE_MODULE_e8dl72afsp.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
dirname,
|
|
14
14
|
join
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-KZ5LF3T5.js";
|
|
16
16
|
import {
|
|
17
17
|
__commonJS,
|
|
18
18
|
__name,
|
|
19
19
|
__require,
|
|
20
20
|
__toESM
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-RP6WLMKP.js";
|
|
22
22
|
|
|
23
23
|
// ../../node_modules/isexe/windows.js
|
|
24
24
|
var require_windows = __commonJS({
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_o9do0xuxool from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_o9do0xuxool from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_o9do0xuxool from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_o9do0xuxool.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_o9do0xuxool.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_o9do0xuxool.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
__name
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-RP6WLMKP.js";
|
|
15
15
|
|
|
16
16
|
// ../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
|
|
17
17
|
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_o9do0xuxool from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_o9do0xuxool from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_o9do0xuxool from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_o9do0xuxool.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_o9do0xuxool.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_o9do0xuxool.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_o9do0xuxool from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_o9do0xuxool from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_o9do0xuxool from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_o9do0xuxool.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_o9do0xuxool.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_o9do0xuxool.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
ADDON_ID
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GEFSDVGO.js";
|
|
15
15
|
import {
|
|
16
16
|
require_picocolors
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-BH6F467E.js";
|
|
18
18
|
import {
|
|
19
19
|
__name,
|
|
20
20
|
__toESM
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-RP6WLMKP.js";
|
|
22
22
|
|
|
23
23
|
// src/logger.ts
|
|
24
24
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_o9do0xuxool from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_o9do0xuxool from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_o9do0xuxool from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_o9do0xuxool.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_o9do0xuxool.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_o9do0xuxool.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
__name
|
|
14
|
+
} from "./chunk-RP6WLMKP.js";
|
|
15
|
+
|
|
16
|
+
// src/utils.ts
|
|
17
|
+
function getAddonNames(mainConfig) {
|
|
18
|
+
const addons = mainConfig.addons || [];
|
|
19
|
+
const addonList = addons.map((addon) => {
|
|
20
|
+
let name = "";
|
|
21
|
+
if (typeof addon === "string") {
|
|
22
|
+
name = addon;
|
|
23
|
+
} else if (typeof addon === "object") {
|
|
24
|
+
name = addon.name;
|
|
25
|
+
}
|
|
26
|
+
return name;
|
|
27
|
+
});
|
|
28
|
+
return addonList.filter((item) => item != null);
|
|
29
|
+
}
|
|
30
|
+
__name(getAddonNames, "getAddonNames");
|
|
31
|
+
function errorToErrorLike(error) {
|
|
32
|
+
return {
|
|
33
|
+
message: error.message,
|
|
34
|
+
name: error.name,
|
|
35
|
+
// avoid duplicating the error message in the stack trace
|
|
36
|
+
stack: error.stack?.replace(error.message, ""),
|
|
37
|
+
cause: error.cause && error.cause instanceof Error ? errorToErrorLike(error.cause) : void 0
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
__name(errorToErrorLike, "errorToErrorLike");
|
|
41
|
+
|
|
42
|
+
// ../../node_modules/find-up/index.js
|
|
43
|
+
import path2 from "node:path";
|
|
44
|
+
|
|
45
|
+
// ../../node_modules/locate-path/index.js
|
|
46
|
+
import process from "node:process";
|
|
47
|
+
import path from "node:path";
|
|
48
|
+
import fs, { promises as fsPromises } from "node:fs";
|
|
49
|
+
import { fileURLToPath } from "node:url";
|
|
50
|
+
|
|
51
|
+
// ../../node_modules/yocto-queue/index.js
|
|
52
|
+
var Node = class {
|
|
53
|
+
static {
|
|
54
|
+
__name(this, "Node");
|
|
55
|
+
}
|
|
56
|
+
value;
|
|
57
|
+
next;
|
|
58
|
+
constructor(value) {
|
|
59
|
+
this.value = value;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var Queue = class {
|
|
63
|
+
static {
|
|
64
|
+
__name(this, "Queue");
|
|
65
|
+
}
|
|
66
|
+
#head;
|
|
67
|
+
#tail;
|
|
68
|
+
#size;
|
|
69
|
+
constructor() {
|
|
70
|
+
this.clear();
|
|
71
|
+
}
|
|
72
|
+
enqueue(value) {
|
|
73
|
+
const node = new Node(value);
|
|
74
|
+
if (this.#head) {
|
|
75
|
+
this.#tail.next = node;
|
|
76
|
+
this.#tail = node;
|
|
77
|
+
} else {
|
|
78
|
+
this.#head = node;
|
|
79
|
+
this.#tail = node;
|
|
80
|
+
}
|
|
81
|
+
this.#size++;
|
|
82
|
+
}
|
|
83
|
+
dequeue() {
|
|
84
|
+
const current = this.#head;
|
|
85
|
+
if (!current) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this.#head = this.#head.next;
|
|
89
|
+
this.#size--;
|
|
90
|
+
return current.value;
|
|
91
|
+
}
|
|
92
|
+
peek() {
|
|
93
|
+
if (!this.#head) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
return this.#head.value;
|
|
97
|
+
}
|
|
98
|
+
clear() {
|
|
99
|
+
this.#head = void 0;
|
|
100
|
+
this.#tail = void 0;
|
|
101
|
+
this.#size = 0;
|
|
102
|
+
}
|
|
103
|
+
get size() {
|
|
104
|
+
return this.#size;
|
|
105
|
+
}
|
|
106
|
+
*[Symbol.iterator]() {
|
|
107
|
+
let current = this.#head;
|
|
108
|
+
while (current) {
|
|
109
|
+
yield current.value;
|
|
110
|
+
current = current.next;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
*drain() {
|
|
114
|
+
while (this.#head) {
|
|
115
|
+
yield this.dequeue();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// ../../node_modules/locate-path/node_modules/p-limit/index.js
|
|
121
|
+
function pLimit(concurrency) {
|
|
122
|
+
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
123
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
124
|
+
}
|
|
125
|
+
const queue = new Queue();
|
|
126
|
+
let activeCount = 0;
|
|
127
|
+
const next = /* @__PURE__ */ __name(() => {
|
|
128
|
+
activeCount--;
|
|
129
|
+
if (queue.size > 0) {
|
|
130
|
+
queue.dequeue()();
|
|
131
|
+
}
|
|
132
|
+
}, "next");
|
|
133
|
+
const run = /* @__PURE__ */ __name(async (fn, resolve, args) => {
|
|
134
|
+
activeCount++;
|
|
135
|
+
const result = (async () => fn(...args))();
|
|
136
|
+
resolve(result);
|
|
137
|
+
try {
|
|
138
|
+
await result;
|
|
139
|
+
} catch {
|
|
140
|
+
}
|
|
141
|
+
next();
|
|
142
|
+
}, "run");
|
|
143
|
+
const enqueue = /* @__PURE__ */ __name((fn, resolve, args) => {
|
|
144
|
+
queue.enqueue(run.bind(void 0, fn, resolve, args));
|
|
145
|
+
(async () => {
|
|
146
|
+
await Promise.resolve();
|
|
147
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
148
|
+
queue.dequeue()();
|
|
149
|
+
}
|
|
150
|
+
})();
|
|
151
|
+
}, "enqueue");
|
|
152
|
+
const generator = /* @__PURE__ */ __name((fn, ...args) => new Promise((resolve) => {
|
|
153
|
+
enqueue(fn, resolve, args);
|
|
154
|
+
}), "generator");
|
|
155
|
+
Object.defineProperties(generator, {
|
|
156
|
+
activeCount: {
|
|
157
|
+
get: /* @__PURE__ */ __name(() => activeCount, "get")
|
|
158
|
+
},
|
|
159
|
+
pendingCount: {
|
|
160
|
+
get: /* @__PURE__ */ __name(() => queue.size, "get")
|
|
161
|
+
},
|
|
162
|
+
clearQueue: {
|
|
163
|
+
value: /* @__PURE__ */ __name(() => {
|
|
164
|
+
queue.clear();
|
|
165
|
+
}, "value")
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
return generator;
|
|
169
|
+
}
|
|
170
|
+
__name(pLimit, "pLimit");
|
|
171
|
+
|
|
172
|
+
// ../../node_modules/locate-path/node_modules/p-locate/index.js
|
|
173
|
+
var EndError = class extends Error {
|
|
174
|
+
static {
|
|
175
|
+
__name(this, "EndError");
|
|
176
|
+
}
|
|
177
|
+
constructor(value) {
|
|
178
|
+
super();
|
|
179
|
+
this.value = value;
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
var testElement = /* @__PURE__ */ __name(async (element, tester) => tester(await element), "testElement");
|
|
183
|
+
var finder = /* @__PURE__ */ __name(async (element) => {
|
|
184
|
+
const values = await Promise.all(element);
|
|
185
|
+
if (values[1] === true) {
|
|
186
|
+
throw new EndError(values[0]);
|
|
187
|
+
}
|
|
188
|
+
return false;
|
|
189
|
+
}, "finder");
|
|
190
|
+
async function pLocate(iterable, tester, {
|
|
191
|
+
concurrency = Number.POSITIVE_INFINITY,
|
|
192
|
+
preserveOrder = true
|
|
193
|
+
} = {}) {
|
|
194
|
+
const limit = pLimit(concurrency);
|
|
195
|
+
const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
|
|
196
|
+
const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
|
|
197
|
+
try {
|
|
198
|
+
await Promise.all(items.map((element) => checkLimit(finder, element)));
|
|
199
|
+
} catch (error) {
|
|
200
|
+
if (error instanceof EndError) {
|
|
201
|
+
return error.value;
|
|
202
|
+
}
|
|
203
|
+
throw error;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
__name(pLocate, "pLocate");
|
|
207
|
+
|
|
208
|
+
// ../../node_modules/locate-path/index.js
|
|
209
|
+
var typeMappings = {
|
|
210
|
+
directory: "isDirectory",
|
|
211
|
+
file: "isFile"
|
|
212
|
+
};
|
|
213
|
+
function checkType(type) {
|
|
214
|
+
if (Object.hasOwnProperty.call(typeMappings, type)) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
throw new Error(`Invalid type specified: ${type}`);
|
|
218
|
+
}
|
|
219
|
+
__name(checkType, "checkType");
|
|
220
|
+
var matchType = /* @__PURE__ */ __name((type, stat) => stat[typeMappings[type]](), "matchType");
|
|
221
|
+
var toPath = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath, "toPath");
|
|
222
|
+
async function locatePath(paths, {
|
|
223
|
+
cwd = process.cwd(),
|
|
224
|
+
type = "file",
|
|
225
|
+
allowSymlinks = true,
|
|
226
|
+
concurrency,
|
|
227
|
+
preserveOrder
|
|
228
|
+
} = {}) {
|
|
229
|
+
checkType(type);
|
|
230
|
+
cwd = toPath(cwd);
|
|
231
|
+
const statFunction = allowSymlinks ? fsPromises.stat : fsPromises.lstat;
|
|
232
|
+
return pLocate(paths, async (path_) => {
|
|
233
|
+
try {
|
|
234
|
+
const stat = await statFunction(path.resolve(cwd, path_));
|
|
235
|
+
return matchType(type, stat);
|
|
236
|
+
} catch {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
}, { concurrency, preserveOrder });
|
|
240
|
+
}
|
|
241
|
+
__name(locatePath, "locatePath");
|
|
242
|
+
|
|
243
|
+
// ../../node_modules/find-up/node_modules/unicorn-magic/node.js
|
|
244
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
245
|
+
function toPath2(urlOrPath) {
|
|
246
|
+
return urlOrPath instanceof URL ? fileURLToPath2(urlOrPath) : urlOrPath;
|
|
247
|
+
}
|
|
248
|
+
__name(toPath2, "toPath");
|
|
249
|
+
|
|
250
|
+
// ../../node_modules/find-up/index.js
|
|
251
|
+
var findUpStop = Symbol("findUpStop");
|
|
252
|
+
async function findUpMultiple(name, options = {}) {
|
|
253
|
+
let directory = path2.resolve(toPath2(options.cwd) ?? "");
|
|
254
|
+
const { root } = path2.parse(directory);
|
|
255
|
+
const stopAt = path2.resolve(directory, toPath2(options.stopAt ?? root));
|
|
256
|
+
const limit = options.limit ?? Number.POSITIVE_INFINITY;
|
|
257
|
+
const paths = [name].flat();
|
|
258
|
+
const runMatcher = /* @__PURE__ */ __name(async (locateOptions) => {
|
|
259
|
+
if (typeof name !== "function") {
|
|
260
|
+
return locatePath(paths, locateOptions);
|
|
261
|
+
}
|
|
262
|
+
const foundPath = await name(locateOptions.cwd);
|
|
263
|
+
if (typeof foundPath === "string") {
|
|
264
|
+
return locatePath([foundPath], locateOptions);
|
|
265
|
+
}
|
|
266
|
+
return foundPath;
|
|
267
|
+
}, "runMatcher");
|
|
268
|
+
const matches = [];
|
|
269
|
+
while (true) {
|
|
270
|
+
const foundPath = await runMatcher({ ...options, cwd: directory });
|
|
271
|
+
if (foundPath === findUpStop) {
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
if (foundPath) {
|
|
275
|
+
matches.push(path2.resolve(directory, foundPath));
|
|
276
|
+
}
|
|
277
|
+
if (directory === stopAt || matches.length >= limit) {
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
directory = path2.dirname(directory);
|
|
281
|
+
}
|
|
282
|
+
return matches;
|
|
283
|
+
}
|
|
284
|
+
__name(findUpMultiple, "findUpMultiple");
|
|
285
|
+
async function findUp(name, options = {}) {
|
|
286
|
+
const matches = await findUpMultiple(name, { ...options, limit: 1 });
|
|
287
|
+
return matches[0];
|
|
288
|
+
}
|
|
289
|
+
__name(findUp, "findUp");
|
|
290
|
+
|
|
291
|
+
export {
|
|
292
|
+
getAddonNames,
|
|
293
|
+
errorToErrorLike,
|
|
294
|
+
findUp
|
|
295
|
+
};
|
package/dist/manager.js
CHANGED
|
@@ -702,16 +702,13 @@ var TestProviderRender = /* @__PURE__ */ __name(({
|
|
|
702
702
|
{
|
|
703
703
|
"aria-label": "Start test run",
|
|
704
704
|
size: "medium",
|
|
705
|
-
onClick: () => {
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
storyIds
|
|
705
|
+
onClick: () => store.send({
|
|
706
|
+
type: "TRIGGER_RUN",
|
|
707
|
+
payload: {
|
|
708
|
+
storyIds: entry ? api.findAllLeafStoryIds(entry.id) : void 0,
|
|
709
|
+
triggeredBy: entry ? entry.type : "global"
|
|
709
710
|
}
|
|
710
|
-
|
|
711
|
-
type: "TRIGGER_RUN",
|
|
712
|
-
payload: { storyIds, triggeredBy: entry?.type ?? "global" }
|
|
713
|
-
});
|
|
714
|
-
}
|
|
711
|
+
})
|
|
715
712
|
},
|
|
716
713
|
React3.createElement(PlayHollowIcon, null)
|
|
717
714
|
)
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_o9do0xuxool from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_o9do0xuxool from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_o9do0xuxool from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_o9do0xuxool.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_o9do0xuxool.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_o9do0xuxool.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
require_gte
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
14
|
+
} from "../_node-chunks/chunk-DVLGX7KC.js";
|
|
15
15
|
import {
|
|
16
16
|
__commonJS,
|
|
17
17
|
__name,
|
|
18
18
|
__require,
|
|
19
19
|
__toESM
|
|
20
|
-
} from "../_node-chunks/chunk-
|
|
20
|
+
} from "../_node-chunks/chunk-RP6WLMKP.js";
|
|
21
21
|
|
|
22
22
|
// ../../node_modules/istanbul-lib-report/node_modules/make-dir/index.js
|
|
23
23
|
var require_make_dir = __commonJS({
|
package/dist/node/vitest.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_o9do0xuxool from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_o9do0xuxool from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_o9do0xuxool from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_o9do0xuxool.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_o9do0xuxool.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_o9do0xuxool.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
log
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
14
|
+
} from "../_node-chunks/chunk-V7LY2TOV.js";
|
|
15
15
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} from "../_node-chunks/chunk-
|
|
16
|
+
errorToErrorLike,
|
|
17
|
+
findUp
|
|
18
|
+
} from "../_node-chunks/chunk-XVEIRRY6.js";
|
|
19
19
|
import {
|
|
20
20
|
ADDON_ID,
|
|
21
21
|
COVERAGE_DIRECTORY,
|
|
22
22
|
STATUS_TYPE_ID_A11Y,
|
|
23
23
|
STATUS_TYPE_ID_COMPONENT_TEST,
|
|
24
24
|
storeOptions
|
|
25
|
-
} from "../_node-chunks/chunk-
|
|
26
|
-
import "../_node-chunks/chunk-
|
|
25
|
+
} from "../_node-chunks/chunk-GEFSDVGO.js";
|
|
26
|
+
import "../_node-chunks/chunk-BH6F467E.js";
|
|
27
27
|
import {
|
|
28
28
|
dirname,
|
|
29
29
|
join,
|
|
30
30
|
normalize,
|
|
31
31
|
path
|
|
32
|
-
} from "../_node-chunks/chunk-
|
|
32
|
+
} from "../_node-chunks/chunk-KZ5LF3T5.js";
|
|
33
33
|
import {
|
|
34
34
|
__name
|
|
35
|
-
} from "../_node-chunks/chunk-
|
|
35
|
+
} from "../_node-chunks/chunk-RP6WLMKP.js";
|
|
36
36
|
|
|
37
37
|
// src/node/vitest.ts
|
|
38
38
|
import process2 from "node:process";
|
|
@@ -84,6 +84,7 @@ function debounce(func, debounceMs, { signal, edges } = {}) {
|
|
|
84
84
|
pendingArgs = null;
|
|
85
85
|
}, "cancel");
|
|
86
86
|
const flush = /* @__PURE__ */ __name(() => {
|
|
87
|
+
cancelTimer();
|
|
87
88
|
invoke();
|
|
88
89
|
}, "flush");
|
|
89
90
|
const debounced = /* @__PURE__ */ __name(function(...args) {
|
|
@@ -242,8 +243,6 @@ var StorybookReporter = class {
|
|
|
242
243
|
var VITEST_CONFIG_FILE_EXTENSIONS = ["mts", "mjs", "cts", "cjs", "ts", "tsx", "js", "jsx"];
|
|
243
244
|
var VITEST_WORKSPACE_FILE_EXTENSION = ["ts", "js", "json"];
|
|
244
245
|
process.env.VITEST_STORYBOOK = "true";
|
|
245
|
-
var DOUBLE_SPACES = " ";
|
|
246
|
-
var getTestName = /* @__PURE__ */ __name((name) => `${name}${DOUBLE_SPACES}`, "getTestName");
|
|
247
246
|
var VitestManager = class {
|
|
248
247
|
constructor(testManager) {
|
|
249
248
|
this.testManager = testManager;
|
|
@@ -272,12 +271,12 @@ var VitestManager = class {
|
|
|
272
271
|
reporter: [["html", {}], storybookCoverageReporter],
|
|
273
272
|
reportsDirectory: resolvePathInStorybookCache(COVERAGE_DIRECTORY)
|
|
274
273
|
} : { enabled: false };
|
|
275
|
-
const vitestWorkspaceConfig =
|
|
274
|
+
const vitestWorkspaceConfig = await findUp(
|
|
276
275
|
[
|
|
277
276
|
...VITEST_WORKSPACE_FILE_EXTENSION.map((ext) => `vitest.workspace.${ext}`),
|
|
278
277
|
...VITEST_CONFIG_FILE_EXTENSIONS.map((ext) => `vitest.config.${ext}`)
|
|
279
278
|
],
|
|
280
|
-
{
|
|
279
|
+
{ stopAt: getProjectRoot() }
|
|
281
280
|
);
|
|
282
281
|
const projectName = "storybook:" + process.env.STORYBOOK_CONFIG_DIR;
|
|
283
282
|
try {
|
|
@@ -434,36 +433,16 @@ Please install the @vitest/${coveragePackage} package to collect coverage
|
|
|
434
433
|
this.resetGlobalTestNamePattern();
|
|
435
434
|
await this.cancelCurrentRun();
|
|
436
435
|
const testSpecifications = await this.getStorybookTestSpecifications();
|
|
437
|
-
const
|
|
438
|
-
const filteredStories = runPayload.storyIds ? allStories.filter((story) => runPayload.storyIds?.includes(story.id)) : allStories;
|
|
436
|
+
const stories = await this.fetchStories(runPayload?.storyIds);
|
|
439
437
|
const isSingleStoryRun = runPayload.storyIds?.length === 1;
|
|
440
438
|
if (isSingleStoryRun) {
|
|
441
|
-
const
|
|
442
|
-
|
|
443
|
-
throw new Error(`Story ${runPayload.storyIds?.[0]} not found`);
|
|
444
|
-
}
|
|
445
|
-
const storyName = selectedStory.name;
|
|
446
|
-
let regex;
|
|
447
|
-
const isParentStory = allStories.some((story) => selectedStory.id === story.parent);
|
|
448
|
-
const hasParentStory = allStories.some((story) => selectedStory.parent === story.id);
|
|
449
|
-
if (isParentStory) {
|
|
450
|
-
const parentName = getTestName(selectedStory.name);
|
|
451
|
-
regex = new RegExp(`^${parentName}`);
|
|
452
|
-
} else if (hasParentStory) {
|
|
453
|
-
const parentStory = allStories.find((story) => story.id === selectedStory.parent);
|
|
454
|
-
if (!parentStory) {
|
|
455
|
-
throw new Error(`Parent story not found for story ${selectedStory.id}`);
|
|
456
|
-
}
|
|
457
|
-
const parentName = getTestName(parentStory.name);
|
|
458
|
-
regex = new RegExp(`^${parentName} ${storyName}$`);
|
|
459
|
-
} else {
|
|
460
|
-
regex = new RegExp(`^${storyName}$`);
|
|
461
|
-
}
|
|
439
|
+
const storyName = stories[0].name;
|
|
440
|
+
const regex = new RegExp(`^${storyName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`);
|
|
462
441
|
this.vitest.setGlobalTestNamePattern(regex);
|
|
463
442
|
}
|
|
464
443
|
const { filteredTestSpecifications, filteredStoryIds } = this.filterTestSpecifications(
|
|
465
444
|
testSpecifications,
|
|
466
|
-
|
|
445
|
+
stories
|
|
467
446
|
);
|
|
468
447
|
this.testManager.store.setState((s) => ({
|
|
469
448
|
...s,
|
package/dist/postinstall.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_o9do0xuxool from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_o9do0xuxool from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_o9do0xuxool from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_o9do0xuxool.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_o9do0xuxool.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_o9do0xuxool.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,22 +12,21 @@ var require = CJS_COMPAT_NODE_MODULE_e8dl72afsp.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
execa,
|
|
14
14
|
resolvePackageDir
|
|
15
|
-
} from "./_node-chunks/chunk-
|
|
15
|
+
} from "./_node-chunks/chunk-KS3JRSUN.js";
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
getAddonNames
|
|
19
|
-
|
|
20
|
-
} from "./_node-chunks/chunk-L5S4YRY2.js";
|
|
17
|
+
findUp,
|
|
18
|
+
getAddonNames
|
|
19
|
+
} from "./_node-chunks/chunk-XVEIRRY6.js";
|
|
21
20
|
import {
|
|
22
21
|
DOCUMENTATION_LINK,
|
|
23
22
|
SUPPORTED_FRAMEWORKS
|
|
24
|
-
} from "./_node-chunks/chunk-
|
|
23
|
+
} from "./_node-chunks/chunk-GEFSDVGO.js";
|
|
25
24
|
import {
|
|
26
25
|
dirname,
|
|
27
26
|
join,
|
|
28
27
|
relative,
|
|
29
28
|
resolve
|
|
30
|
-
} from "./_node-chunks/chunk-
|
|
29
|
+
} from "./_node-chunks/chunk-KZ5LF3T5.js";
|
|
31
30
|
import {
|
|
32
31
|
require_compare,
|
|
33
32
|
require_constants,
|
|
@@ -37,12 +36,12 @@ import {
|
|
|
37
36
|
require_parse_options,
|
|
38
37
|
require_re,
|
|
39
38
|
require_semver
|
|
40
|
-
} from "./_node-chunks/chunk-
|
|
39
|
+
} from "./_node-chunks/chunk-DVLGX7KC.js";
|
|
41
40
|
import {
|
|
42
41
|
__commonJS,
|
|
43
42
|
__name,
|
|
44
43
|
__toESM
|
|
45
|
-
} from "./_node-chunks/chunk-
|
|
44
|
+
} from "./_node-chunks/chunk-RP6WLMKP.js";
|
|
46
45
|
|
|
47
46
|
// ../../node_modules/semver/functions/parse.js
|
|
48
47
|
var require_parse = __commonJS({
|
|
@@ -1529,14 +1528,6 @@ import {
|
|
|
1529
1528
|
import { experimental_loadStorybook } from "storybook/internal/core-server";
|
|
1530
1529
|
import { readConfig, writeConfig } from "storybook/internal/csf-tools";
|
|
1531
1530
|
import { logger as logger2 } from "storybook/internal/node-logger";
|
|
1532
|
-
|
|
1533
|
-
// ../../node_modules/empathic/package.mjs
|
|
1534
|
-
function up2(options) {
|
|
1535
|
-
return up("package.json", options);
|
|
1536
|
-
}
|
|
1537
|
-
__name(up2, "up");
|
|
1538
|
-
|
|
1539
|
-
// src/postinstall.ts
|
|
1540
1531
|
var import_semver = __toESM(require_semver2(), 1);
|
|
1541
1532
|
import prompts from "prompts";
|
|
1542
1533
|
import { dedent } from "ts-dedent";
|
|
@@ -1686,9 +1677,9 @@ var logErrors = /* @__PURE__ */ __name((...args) => {
|
|
|
1686
1677
|
hasErrors = true;
|
|
1687
1678
|
printError(...args);
|
|
1688
1679
|
}, "logErrors");
|
|
1689
|
-
var findFile = /* @__PURE__ */ __name((basename, extensions = EXTENSIONS) =>
|
|
1680
|
+
var findFile = /* @__PURE__ */ __name(async (basename, extensions = EXTENSIONS) => findUp(
|
|
1690
1681
|
extensions.map((ext) => basename + ext),
|
|
1691
|
-
{
|
|
1682
|
+
{ stopAt: getProjectRoot() }
|
|
1692
1683
|
), "findFile");
|
|
1693
1684
|
async function postInstall(options) {
|
|
1694
1685
|
printSuccess(
|
|
@@ -1892,7 +1883,7 @@ async function postInstall(options) {
|
|
|
1892
1883
|
console.error("Failed to install Playwright. Please install it manually");
|
|
1893
1884
|
}
|
|
1894
1885
|
}
|
|
1895
|
-
const fileExtension = allDeps.typescript || findFile("tsconfig", [...EXTENSIONS, ".json"]) ? "ts" : "js";
|
|
1886
|
+
const fileExtension = allDeps.typescript || await findFile("tsconfig", [...EXTENSIONS, ".json"]) ? "ts" : "js";
|
|
1896
1887
|
const vitestSetupFile = resolve(options.configDir, `vitest.setup.${fileExtension}`);
|
|
1897
1888
|
if (existsSync(vitestSetupFile)) {
|
|
1898
1889
|
logErrors(
|
|
@@ -1930,10 +1921,10 @@ async function postInstall(options) {
|
|
|
1930
1921
|
setProjectAnnotations([${projectAnnotations.join(", ")}]);
|
|
1931
1922
|
`
|
|
1932
1923
|
);
|
|
1933
|
-
const vitestWorkspaceFile = findFile("vitest.workspace", [".ts", ".js", ".json"]) || findFile("vitest.projects", [".ts", ".js", ".json"]);
|
|
1934
|
-
const viteConfigFile = findFile("vite.config");
|
|
1935
|
-
const vitestConfigFile = findFile("vitest.config");
|
|
1936
|
-
const vitestShimFile = findFile("vitest.shims.d");
|
|
1924
|
+
const vitestWorkspaceFile = await findFile("vitest.workspace", [".ts", ".js", ".json"]) || await findFile("vitest.projects", [".ts", ".js", ".json"]);
|
|
1925
|
+
const viteConfigFile = await findFile("vite.config");
|
|
1926
|
+
const vitestConfigFile = await findFile("vitest.config");
|
|
1927
|
+
const vitestShimFile = await findFile("vitest.shims.d");
|
|
1937
1928
|
const rootConfig = vitestConfigFile || viteConfigFile;
|
|
1938
1929
|
const browserConfig = `{
|
|
1939
1930
|
enabled: true,
|
|
@@ -2103,7 +2094,9 @@ async function getPackageNameFromPath(input) {
|
|
|
2103
2094
|
if (!isAbsolute(path)) {
|
|
2104
2095
|
return path;
|
|
2105
2096
|
}
|
|
2106
|
-
const packageJsonPath =
|
|
2097
|
+
const packageJsonPath = await findUp("package.json", {
|
|
2098
|
+
cwd: path
|
|
2099
|
+
});
|
|
2107
2100
|
if (!packageJsonPath) {
|
|
2108
2101
|
throw new Error(`Could not find package.json in path: ${path}`);
|
|
2109
2102
|
}
|
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_o9do0xuxool from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_o9do0xuxool from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_o9do0xuxool from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_o9do0xuxool.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_o9do0xuxool.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_o9do0xuxool.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,11 +12,11 @@ var require = CJS_COMPAT_NODE_MODULE_e8dl72afsp.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
log,
|
|
14
14
|
noop
|
|
15
|
-
} from "./_node-chunks/chunk-
|
|
15
|
+
} from "./_node-chunks/chunk-V7LY2TOV.js";
|
|
16
16
|
import {
|
|
17
17
|
execaNode,
|
|
18
18
|
importMetaResolve
|
|
19
|
-
} from "./_node-chunks/chunk-
|
|
19
|
+
} from "./_node-chunks/chunk-KS3JRSUN.js";
|
|
20
20
|
import {
|
|
21
21
|
ADDON_ID,
|
|
22
22
|
COVERAGE_DIRECTORY,
|
|
@@ -25,17 +25,17 @@ import {
|
|
|
25
25
|
STORYBOOK_ADDON_TEST_CHANNEL,
|
|
26
26
|
TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME,
|
|
27
27
|
storeOptions
|
|
28
|
-
} from "./_node-chunks/chunk-
|
|
28
|
+
} from "./_node-chunks/chunk-GEFSDVGO.js";
|
|
29
29
|
import {
|
|
30
30
|
require_picocolors
|
|
31
|
-
} from "./_node-chunks/chunk-
|
|
31
|
+
} from "./_node-chunks/chunk-BH6F467E.js";
|
|
32
32
|
import {
|
|
33
33
|
normalize
|
|
34
|
-
} from "./_node-chunks/chunk-
|
|
34
|
+
} from "./_node-chunks/chunk-KZ5LF3T5.js";
|
|
35
35
|
import {
|
|
36
36
|
__name,
|
|
37
37
|
__toESM
|
|
38
|
-
} from "./_node-chunks/chunk-
|
|
38
|
+
} from "./_node-chunks/chunk-RP6WLMKP.js";
|
|
39
39
|
|
|
40
40
|
// src/preset.ts
|
|
41
41
|
import { mkdir } from "node:fs/promises";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_o9do0xuxool from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_o9do0xuxool from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_o9do0xuxool from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_o9do0xuxool.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_o9do0xuxool.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_o9do0xuxool.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
__name,
|
|
15
15
|
__require,
|
|
16
16
|
__toESM
|
|
17
|
-
} from "../_node-chunks/chunk-
|
|
17
|
+
} from "../_node-chunks/chunk-RP6WLMKP.js";
|
|
18
18
|
|
|
19
19
|
// ../../node_modules/tree-kill/index.js
|
|
20
20
|
var require_tree_kill = __commonJS({
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_o9do0xuxool from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_o9do0xuxool from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_o9do0xuxool from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_o9do0xuxool.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_o9do0xuxool.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_o9do0xuxool.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
require_picocolors
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
14
|
+
} from "../_node-chunks/chunk-BH6F467E.js";
|
|
15
15
|
import {
|
|
16
16
|
join,
|
|
17
17
|
normalize,
|
|
18
18
|
relative,
|
|
19
19
|
resolve,
|
|
20
20
|
sep
|
|
21
|
-
} from "../_node-chunks/chunk-
|
|
21
|
+
} from "../_node-chunks/chunk-KZ5LF3T5.js";
|
|
22
22
|
import {
|
|
23
23
|
__commonJS,
|
|
24
24
|
__name,
|
|
25
25
|
__require,
|
|
26
26
|
__toESM
|
|
27
|
-
} from "../_node-chunks/chunk-
|
|
27
|
+
} from "../_node-chunks/chunk-RP6WLMKP.js";
|
|
28
28
|
|
|
29
29
|
// ../../node_modules/braces/lib/utils.js
|
|
30
30
|
var require_utils = __commonJS({
|
|
@@ -3592,8 +3592,7 @@ var storybookTest = /* @__PURE__ */ __name(async (options) => {
|
|
|
3592
3592
|
staticDirs,
|
|
3593
3593
|
previewLevelTags,
|
|
3594
3594
|
core,
|
|
3595
|
-
extraOptimizeDeps
|
|
3596
|
-
features
|
|
3595
|
+
extraOptimizeDeps
|
|
3597
3596
|
] = await Promise.all([
|
|
3598
3597
|
getStoryGlobsAndFiles(presets, directories),
|
|
3599
3598
|
presets.apply("framework", void 0),
|
|
@@ -3602,8 +3601,7 @@ var storybookTest = /* @__PURE__ */ __name(async (options) => {
|
|
|
3602
3601
|
presets.apply("staticDirs", []),
|
|
3603
3602
|
extractTagsFromPreview(finalOptions.configDir),
|
|
3604
3603
|
presets.apply("core"),
|
|
3605
|
-
presets.apply("optimizeViteDeps", [])
|
|
3606
|
-
presets.apply("features", {})
|
|
3604
|
+
presets.apply("optimizeViteDeps", [])
|
|
3607
3605
|
]);
|
|
3608
3606
|
const pluginsToIgnore = [
|
|
3609
3607
|
"storybook:react-docgen-plugin",
|
|
@@ -3733,8 +3731,7 @@ var storybookTest = /* @__PURE__ */ __name(async (options) => {
|
|
|
3733
3731
|
]
|
|
3734
3732
|
},
|
|
3735
3733
|
define: {
|
|
3736
|
-
...frameworkName?.includes("vue3") ? { __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "false" } : {}
|
|
3737
|
-
FEATURES: JSON.stringify(features)
|
|
3734
|
+
...frameworkName?.includes("vue3") ? { __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "false" } : {}
|
|
3738
3735
|
}
|
|
3739
3736
|
};
|
|
3740
3737
|
const config = mergeConfig(
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
} from "../_browser-chunks/chunk-JK72E6FR.js";
|
|
4
4
|
|
|
5
5
|
// src/vitest-plugin/test-utils.ts
|
|
6
|
-
import { getStoryChildren, isStory } from "storybook/internal/csf";
|
|
7
6
|
import { server } from "@vitest/browser/context";
|
|
8
7
|
import { composeStory, getCsfFactoryAnnotations } from "storybook/preview-api";
|
|
9
8
|
|
|
@@ -54,15 +53,15 @@ var setViewport = /* @__PURE__ */ __name(async (parameters = {}, globals = {}) =
|
|
|
54
53
|
if (!page || !globalThis.__vitest_browser__) {
|
|
55
54
|
return;
|
|
56
55
|
}
|
|
57
|
-
const
|
|
56
|
+
const viewports = {
|
|
58
57
|
...MINIMAL_VIEWPORTS,
|
|
59
58
|
...viewportsParam.viewports,
|
|
60
59
|
...viewportsParam.options
|
|
61
60
|
};
|
|
62
61
|
let viewportWidth = DEFAULT_VIEWPORT_DIMENSIONS.width;
|
|
63
62
|
let viewportHeight = DEFAULT_VIEWPORT_DIMENSIONS.height;
|
|
64
|
-
if (defaultViewport && defaultViewport in
|
|
65
|
-
const
|
|
63
|
+
if (defaultViewport && defaultViewport in viewports) {
|
|
64
|
+
const styles = viewports[defaultViewport].styles;
|
|
66
65
|
if (styles?.width && styles?.height) {
|
|
67
66
|
const { width, height } = styles;
|
|
68
67
|
viewportWidth = parseDimension(width, "width");
|
|
@@ -79,13 +78,11 @@ var convertToFilePath = /* @__PURE__ */ __name((url) => {
|
|
|
79
78
|
const normalizedPath = path.replace(/^\/+([a-zA-Z]:)/, "$1");
|
|
80
79
|
return normalizedPath.replace(/%20/g, " ");
|
|
81
80
|
}, "convertToFilePath");
|
|
82
|
-
var testStory = /* @__PURE__ */ __name((exportName, story, meta, skipTags
|
|
81
|
+
var testStory = /* @__PURE__ */ __name((exportName, story, meta, skipTags) => {
|
|
83
82
|
return async (context) => {
|
|
84
83
|
const annotations = getCsfFactoryAnnotations(story, meta);
|
|
85
|
-
const test = isStory(story) && testName ? getStoryChildren(story).find((child) => child.input.name === testName) : void 0;
|
|
86
|
-
const storyAnnotations = test ? test.input : annotations.story;
|
|
87
84
|
const composedStory = composeStory(
|
|
88
|
-
|
|
85
|
+
annotations.story,
|
|
89
86
|
annotations.meta,
|
|
90
87
|
{ initialGlobals: await getInitialGlobals?.() ?? {} },
|
|
91
88
|
annotations.preview ?? globalThis.globalProjectAnnotations,
|
|
@@ -96,9 +93,9 @@ var testStory = /* @__PURE__ */ __name((exportName, story, meta, skipTags, story
|
|
|
96
93
|
}
|
|
97
94
|
context.story = composedStory;
|
|
98
95
|
const _task = context.task;
|
|
99
|
-
_task.meta.storyId =
|
|
96
|
+
_task.meta.storyId = composedStory.id;
|
|
100
97
|
await setViewport(composedStory.parameters, composedStory.globals);
|
|
101
|
-
await composedStory.run(
|
|
98
|
+
await composedStory.run();
|
|
102
99
|
_task.meta.reports = composedStory.reporting.reports;
|
|
103
100
|
};
|
|
104
101
|
}, "testStory");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-vitest",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-32412-sha-f670336d",
|
|
4
4
|
"description": "Storybook Vitest addon: Blazing fast component testing using stories",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@storybook/global": "^5.0.0",
|
|
76
|
-
"@storybook/icons": "^1.
|
|
76
|
+
"@storybook/icons": "^1.4.0",
|
|
77
77
|
"prompts": "^2.4.0",
|
|
78
78
|
"ts-dedent": "^2.2.0"
|
|
79
79
|
},
|
|
@@ -85,9 +85,9 @@
|
|
|
85
85
|
"@vitest/browser": "^3.2.4",
|
|
86
86
|
"@vitest/runner": "^3.2.4",
|
|
87
87
|
"boxen": "^8.0.1",
|
|
88
|
-
"empathic": "^2.0.0",
|
|
89
88
|
"es-toolkit": "^1.36.0",
|
|
90
89
|
"execa": "^8.0.1",
|
|
90
|
+
"find-up": "^7.0.0",
|
|
91
91
|
"istanbul-lib-report": "^3.0.1",
|
|
92
92
|
"micromatch": "^4.0.8",
|
|
93
93
|
"pathe": "^1.1.2",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"peerDependencies": {
|
|
107
107
|
"@vitest/browser": "^3.0.0",
|
|
108
108
|
"@vitest/runner": "^3.0.0",
|
|
109
|
-
"storybook": "^0.0.0-pr-
|
|
109
|
+
"storybook": "^0.0.0-pr-32412-sha-f670336d",
|
|
110
110
|
"vitest": "^3.0.0"
|
|
111
111
|
},
|
|
112
112
|
"peerDependenciesMeta": {
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_e8dl72afsp from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_e8dl72afsp from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_e8dl72afsp from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_e8dl72afsp.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_e8dl72afsp.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_e8dl72afsp.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
|
-
import {
|
|
13
|
-
__name
|
|
14
|
-
} from "./chunk-3EI5NE3R.js";
|
|
15
|
-
|
|
16
|
-
// src/utils.ts
|
|
17
|
-
function getAddonNames(mainConfig) {
|
|
18
|
-
const addons = mainConfig.addons || [];
|
|
19
|
-
const addonList = addons.map((addon) => {
|
|
20
|
-
let name = "";
|
|
21
|
-
if (typeof addon === "string") {
|
|
22
|
-
name = addon;
|
|
23
|
-
} else if (typeof addon === "object") {
|
|
24
|
-
name = addon.name;
|
|
25
|
-
}
|
|
26
|
-
return name;
|
|
27
|
-
});
|
|
28
|
-
return addonList.filter((item) => item != null);
|
|
29
|
-
}
|
|
30
|
-
__name(getAddonNames, "getAddonNames");
|
|
31
|
-
function errorToErrorLike(error) {
|
|
32
|
-
return {
|
|
33
|
-
message: error.message,
|
|
34
|
-
name: error.name,
|
|
35
|
-
// avoid duplicating the error message in the stack trace
|
|
36
|
-
stack: error.stack?.replace(error.message, ""),
|
|
37
|
-
cause: error.cause && error.cause instanceof Error ? errorToErrorLike(error.cause) : void 0
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
__name(errorToErrorLike, "errorToErrorLike");
|
|
41
|
-
|
|
42
|
-
// ../../node_modules/empathic/find.mjs
|
|
43
|
-
import { join as join2 } from "node:path";
|
|
44
|
-
import { existsSync, statSync } from "node:fs";
|
|
45
|
-
|
|
46
|
-
// ../../node_modules/empathic/walk.mjs
|
|
47
|
-
import { dirname } from "node:path";
|
|
48
|
-
|
|
49
|
-
// ../../node_modules/empathic/resolve.mjs
|
|
50
|
-
import { isAbsolute, join, resolve } from "node:path";
|
|
51
|
-
function absolute(input, root) {
|
|
52
|
-
return isAbsolute(input) ? input : resolve(root || ".", input);
|
|
53
|
-
}
|
|
54
|
-
__name(absolute, "absolute");
|
|
55
|
-
|
|
56
|
-
// ../../node_modules/empathic/walk.mjs
|
|
57
|
-
function up(base, options) {
|
|
58
|
-
let { last, cwd } = options || {};
|
|
59
|
-
let tmp = absolute(base, cwd);
|
|
60
|
-
let root = absolute(last || "/", cwd);
|
|
61
|
-
let prev, arr = [];
|
|
62
|
-
while (prev !== root) {
|
|
63
|
-
arr.push(tmp);
|
|
64
|
-
tmp = dirname(prev = tmp);
|
|
65
|
-
if (tmp === prev) break;
|
|
66
|
-
}
|
|
67
|
-
return arr;
|
|
68
|
-
}
|
|
69
|
-
__name(up, "up");
|
|
70
|
-
|
|
71
|
-
// ../../node_modules/empathic/find.mjs
|
|
72
|
-
function up2(name, options) {
|
|
73
|
-
let dir, tmp;
|
|
74
|
-
let start = options && options.cwd || "";
|
|
75
|
-
for (dir of up(start, options)) {
|
|
76
|
-
tmp = join2(dir, name);
|
|
77
|
-
if (existsSync(tmp)) return tmp;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
__name(up2, "up");
|
|
81
|
-
function any(names, options) {
|
|
82
|
-
let dir, start = options && options.cwd || "";
|
|
83
|
-
let j = 0, len = names.length, tmp;
|
|
84
|
-
for (dir of up(start, options)) {
|
|
85
|
-
for (j = 0; j < len; j++) {
|
|
86
|
-
tmp = join2(dir, names[j]);
|
|
87
|
-
if (existsSync(tmp)) return tmp;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
__name(any, "any");
|
|
92
|
-
|
|
93
|
-
export {
|
|
94
|
-
getAddonNames,
|
|
95
|
-
errorToErrorLike,
|
|
96
|
-
up2 as up,
|
|
97
|
-
any
|
|
98
|
-
};
|