@storybook/addon-vitest 10.0.0-beta.0 → 10.0.0-beta.10
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-EZERIZC2.js → chunk-APWLSHYM.js} +7 -7
- package/dist/_node-chunks/{chunk-2LKDLHP2.js → chunk-BVQFVFQY.js} +7 -7
- package/dist/_node-chunks/{chunk-T7EST64K.js → chunk-ECHK4VRN.js} +325 -15
- package/dist/_node-chunks/{chunk-75PF53UG.js → chunk-IGSSJNJT.js} +6 -6
- package/dist/_node-chunks/{chunk-HIDBMPI3.js → chunk-LNPEEBIV.js} +7 -7
- package/dist/_node-chunks/chunk-LXF52VQL.js +98 -0
- package/dist/_node-chunks/{chunk-FJO43W6J.js → chunk-T2EZK3NA.js} +9 -9
- package/dist/_node-chunks/{chunk-MHHQUJAV.js → chunk-UXOM2XHX.js} +6 -6
- package/dist/manager.js +9 -6
- package/dist/node/coverage-reporter.js +8 -8
- package/dist/node/vitest.js +42 -21
- package/dist/postinstall.js +39 -28
- package/dist/preset.js +12 -12
- package/dist/vitest-plugin/global-setup.js +7 -7
- package/dist/vitest-plugin/index.js +15 -12
- package/dist/vitest-plugin/test-utils.js +10 -7
- package/package.json +4 -4
- package/dist/_node-chunks/chunk-MJKNSUFZ.js +0 -295
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_dxdurso8yeb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_dxdurso8yeb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_dxdurso8yeb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_dxdurso8yeb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_dxdurso8yeb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_dxdurso8yeb.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-APWLSHYM.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-UXOM2XHX.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_dxdurso8yeb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_dxdurso8yeb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_dxdurso8yeb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_dxdurso8yeb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_dxdurso8yeb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_dxdurso8yeb.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-T2EZK3NA.js";
|
|
15
15
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} from "../_node-chunks/chunk-
|
|
16
|
+
any,
|
|
17
|
+
errorToErrorLike
|
|
18
|
+
} from "../_node-chunks/chunk-LXF52VQL.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-IGSSJNJT.js";
|
|
26
|
+
import "../_node-chunks/chunk-BVQFVFQY.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-LNPEEBIV.js";
|
|
33
33
|
import {
|
|
34
34
|
__name
|
|
35
|
-
} from "../_node-chunks/chunk-
|
|
35
|
+
} from "../_node-chunks/chunk-UXOM2XHX.js";
|
|
36
36
|
|
|
37
37
|
// src/node/vitest.ts
|
|
38
38
|
import process2 from "node:process";
|
|
@@ -84,7 +84,6 @@ function debounce(func, debounceMs, { signal, edges } = {}) {
|
|
|
84
84
|
pendingArgs = null;
|
|
85
85
|
}, "cancel");
|
|
86
86
|
const flush = /* @__PURE__ */ __name(() => {
|
|
87
|
-
cancelTimer();
|
|
88
87
|
invoke();
|
|
89
88
|
}, "flush");
|
|
90
89
|
const debounced = /* @__PURE__ */ __name(function(...args) {
|
|
@@ -243,6 +242,8 @@ var StorybookReporter = class {
|
|
|
243
242
|
var VITEST_CONFIG_FILE_EXTENSIONS = ["mts", "mjs", "cts", "cjs", "ts", "tsx", "js", "jsx"];
|
|
244
243
|
var VITEST_WORKSPACE_FILE_EXTENSION = ["ts", "js", "json"];
|
|
245
244
|
process.env.VITEST_STORYBOOK = "true";
|
|
245
|
+
var DOUBLE_SPACES = " ";
|
|
246
|
+
var getTestName = /* @__PURE__ */ __name((name) => `${name}${DOUBLE_SPACES}`, "getTestName");
|
|
246
247
|
var VitestManager = class {
|
|
247
248
|
constructor(testManager) {
|
|
248
249
|
this.testManager = testManager;
|
|
@@ -271,12 +272,12 @@ var VitestManager = class {
|
|
|
271
272
|
reporter: [["html", {}], storybookCoverageReporter],
|
|
272
273
|
reportsDirectory: resolvePathInStorybookCache(COVERAGE_DIRECTORY)
|
|
273
274
|
} : { enabled: false };
|
|
274
|
-
const vitestWorkspaceConfig =
|
|
275
|
+
const vitestWorkspaceConfig = any(
|
|
275
276
|
[
|
|
276
277
|
...VITEST_WORKSPACE_FILE_EXTENSION.map((ext) => `vitest.workspace.${ext}`),
|
|
277
278
|
...VITEST_CONFIG_FILE_EXTENSIONS.map((ext) => `vitest.config.${ext}`)
|
|
278
279
|
],
|
|
279
|
-
{
|
|
280
|
+
{ last: getProjectRoot() }
|
|
280
281
|
);
|
|
281
282
|
const projectName = "storybook:" + process.env.STORYBOOK_CONFIG_DIR;
|
|
282
283
|
try {
|
|
@@ -433,16 +434,36 @@ Please install the @vitest/${coveragePackage} package to collect coverage
|
|
|
433
434
|
this.resetGlobalTestNamePattern();
|
|
434
435
|
await this.cancelCurrentRun();
|
|
435
436
|
const testSpecifications = await this.getStorybookTestSpecifications();
|
|
436
|
-
const
|
|
437
|
+
const allStories = await this.fetchStories();
|
|
438
|
+
const filteredStories = runPayload.storyIds ? allStories.filter((story) => runPayload.storyIds?.includes(story.id)) : allStories;
|
|
437
439
|
const isSingleStoryRun = runPayload.storyIds?.length === 1;
|
|
438
440
|
if (isSingleStoryRun) {
|
|
439
|
-
const
|
|
440
|
-
|
|
441
|
+
const selectedStory = filteredStories.find((story) => story.id === runPayload.storyIds?.[0]);
|
|
442
|
+
if (!selectedStory) {
|
|
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
|
+
}
|
|
441
462
|
this.vitest.setGlobalTestNamePattern(regex);
|
|
442
463
|
}
|
|
443
464
|
const { filteredTestSpecifications, filteredStoryIds } = this.filterTestSpecifications(
|
|
444
465
|
testSpecifications,
|
|
445
|
-
|
|
466
|
+
filteredStories
|
|
446
467
|
);
|
|
447
468
|
this.testManager.store.setState((s) => ({
|
|
448
469
|
...s,
|
package/dist/postinstall.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_dxdurso8yeb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_dxdurso8yeb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_dxdurso8yeb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_dxdurso8yeb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_dxdurso8yeb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_dxdurso8yeb.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,21 +12,22 @@ var require = CJS_COMPAT_NODE_MODULE_nt0sybtpwl.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
execa,
|
|
14
14
|
resolvePackageDir
|
|
15
|
-
} from "./_node-chunks/chunk-
|
|
15
|
+
} from "./_node-chunks/chunk-ECHK4VRN.js";
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
getAddonNames
|
|
19
|
-
|
|
17
|
+
any,
|
|
18
|
+
getAddonNames,
|
|
19
|
+
up
|
|
20
|
+
} from "./_node-chunks/chunk-LXF52VQL.js";
|
|
20
21
|
import {
|
|
21
22
|
DOCUMENTATION_LINK,
|
|
22
23
|
SUPPORTED_FRAMEWORKS
|
|
23
|
-
} from "./_node-chunks/chunk-
|
|
24
|
+
} from "./_node-chunks/chunk-IGSSJNJT.js";
|
|
24
25
|
import {
|
|
25
26
|
dirname,
|
|
26
27
|
join,
|
|
27
28
|
relative,
|
|
28
29
|
resolve
|
|
29
|
-
} from "./_node-chunks/chunk-
|
|
30
|
+
} from "./_node-chunks/chunk-LNPEEBIV.js";
|
|
30
31
|
import {
|
|
31
32
|
require_compare,
|
|
32
33
|
require_constants,
|
|
@@ -36,12 +37,12 @@ import {
|
|
|
36
37
|
require_parse_options,
|
|
37
38
|
require_re,
|
|
38
39
|
require_semver
|
|
39
|
-
} from "./_node-chunks/chunk-
|
|
40
|
+
} from "./_node-chunks/chunk-APWLSHYM.js";
|
|
40
41
|
import {
|
|
41
42
|
__commonJS,
|
|
42
43
|
__name,
|
|
43
44
|
__toESM
|
|
44
|
-
} from "./_node-chunks/chunk-
|
|
45
|
+
} from "./_node-chunks/chunk-UXOM2XHX.js";
|
|
45
46
|
|
|
46
47
|
// ../../node_modules/semver/functions/parse.js
|
|
47
48
|
var require_parse = __commonJS({
|
|
@@ -1528,6 +1529,14 @@ import {
|
|
|
1528
1529
|
import { experimental_loadStorybook } from "storybook/internal/core-server";
|
|
1529
1530
|
import { readConfig, writeConfig } from "storybook/internal/csf-tools";
|
|
1530
1531
|
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
|
|
1531
1540
|
var import_semver = __toESM(require_semver2(), 1);
|
|
1532
1541
|
import prompts from "prompts";
|
|
1533
1542
|
import { dedent } from "ts-dedent";
|
|
@@ -1677,9 +1686,9 @@ var logErrors = /* @__PURE__ */ __name((...args) => {
|
|
|
1677
1686
|
hasErrors = true;
|
|
1678
1687
|
printError(...args);
|
|
1679
1688
|
}, "logErrors");
|
|
1680
|
-
var findFile = /* @__PURE__ */ __name(
|
|
1689
|
+
var findFile = /* @__PURE__ */ __name((basename, extensions = EXTENSIONS) => any(
|
|
1681
1690
|
extensions.map((ext) => basename + ext),
|
|
1682
|
-
{
|
|
1691
|
+
{ last: getProjectRoot() }
|
|
1683
1692
|
), "findFile");
|
|
1684
1693
|
async function postInstall(options) {
|
|
1685
1694
|
printSuccess(
|
|
@@ -1874,12 +1883,16 @@ async function postInstall(options) {
|
|
|
1874
1883
|
} else {
|
|
1875
1884
|
logger2.plain(`${step} Configuring Playwright with Chromium (this might take some time):`);
|
|
1876
1885
|
logger2.plain(" npx playwright install chromium --with-deps");
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1886
|
+
try {
|
|
1887
|
+
await packageManager.executeCommand({
|
|
1888
|
+
command: "npx",
|
|
1889
|
+
args: ["playwright", "install", "chromium", "--with-deps"]
|
|
1890
|
+
});
|
|
1891
|
+
} catch (e) {
|
|
1892
|
+
console.error("Failed to install Playwright. Please install it manually");
|
|
1893
|
+
}
|
|
1881
1894
|
}
|
|
1882
|
-
const fileExtension = allDeps.typescript ||
|
|
1895
|
+
const fileExtension = allDeps.typescript || findFile("tsconfig", [...EXTENSIONS, ".json"]) ? "ts" : "js";
|
|
1883
1896
|
const vitestSetupFile = resolve(options.configDir, `vitest.setup.${fileExtension}`);
|
|
1884
1897
|
if (existsSync(vitestSetupFile)) {
|
|
1885
1898
|
logErrors(
|
|
@@ -1917,10 +1930,10 @@ async function postInstall(options) {
|
|
|
1917
1930
|
setProjectAnnotations([${projectAnnotations.join(", ")}]);
|
|
1918
1931
|
`
|
|
1919
1932
|
);
|
|
1920
|
-
const vitestWorkspaceFile =
|
|
1921
|
-
const viteConfigFile =
|
|
1922
|
-
const vitestConfigFile =
|
|
1923
|
-
const vitestShimFile =
|
|
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
1937
|
const rootConfig = vitestConfigFile || viteConfigFile;
|
|
1925
1938
|
const browserConfig = `{
|
|
1926
1939
|
enabled: true,
|
|
@@ -2090,9 +2103,7 @@ async function getPackageNameFromPath(input) {
|
|
|
2090
2103
|
if (!isAbsolute(path)) {
|
|
2091
2104
|
return path;
|
|
2092
2105
|
}
|
|
2093
|
-
const packageJsonPath =
|
|
2094
|
-
cwd: path
|
|
2095
|
-
});
|
|
2106
|
+
const packageJsonPath = up2({ cwd: path });
|
|
2096
2107
|
if (!packageJsonPath) {
|
|
2097
2108
|
throw new Error(`Could not find package.json in path: ${path}`);
|
|
2098
2109
|
}
|
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_dxdurso8yeb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_dxdurso8yeb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_dxdurso8yeb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_dxdurso8yeb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_dxdurso8yeb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_dxdurso8yeb.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_nt0sybtpwl.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
log,
|
|
14
14
|
noop
|
|
15
|
-
} from "./_node-chunks/chunk-
|
|
15
|
+
} from "./_node-chunks/chunk-T2EZK3NA.js";
|
|
16
16
|
import {
|
|
17
17
|
execaNode,
|
|
18
18
|
importMetaResolve
|
|
19
|
-
} from "./_node-chunks/chunk-
|
|
19
|
+
} from "./_node-chunks/chunk-ECHK4VRN.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-IGSSJNJT.js";
|
|
29
29
|
import {
|
|
30
30
|
require_picocolors
|
|
31
|
-
} from "./_node-chunks/chunk-
|
|
31
|
+
} from "./_node-chunks/chunk-BVQFVFQY.js";
|
|
32
32
|
import {
|
|
33
33
|
normalize
|
|
34
|
-
} from "./_node-chunks/chunk-
|
|
34
|
+
} from "./_node-chunks/chunk-LNPEEBIV.js";
|
|
35
35
|
import {
|
|
36
36
|
__name,
|
|
37
37
|
__toESM
|
|
38
|
-
} from "./_node-chunks/chunk-
|
|
38
|
+
} from "./_node-chunks/chunk-UXOM2XHX.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_dxdurso8yeb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_dxdurso8yeb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_dxdurso8yeb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_dxdurso8yeb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_dxdurso8yeb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_dxdurso8yeb.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-UXOM2XHX.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_dxdurso8yeb from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_dxdurso8yeb from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_dxdurso8yeb from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_dxdurso8yeb.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_dxdurso8yeb.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_dxdurso8yeb.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-BVQFVFQY.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-LNPEEBIV.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-UXOM2XHX.js";
|
|
28
28
|
|
|
29
29
|
// ../../node_modules/braces/lib/utils.js
|
|
30
30
|
var require_utils = __commonJS({
|
|
@@ -3592,7 +3592,8 @@ var storybookTest = /* @__PURE__ */ __name(async (options) => {
|
|
|
3592
3592
|
staticDirs,
|
|
3593
3593
|
previewLevelTags,
|
|
3594
3594
|
core,
|
|
3595
|
-
extraOptimizeDeps
|
|
3595
|
+
extraOptimizeDeps,
|
|
3596
|
+
features
|
|
3596
3597
|
] = await Promise.all([
|
|
3597
3598
|
getStoryGlobsAndFiles(presets, directories),
|
|
3598
3599
|
presets.apply("framework", void 0),
|
|
@@ -3601,7 +3602,8 @@ var storybookTest = /* @__PURE__ */ __name(async (options) => {
|
|
|
3601
3602
|
presets.apply("staticDirs", []),
|
|
3602
3603
|
extractTagsFromPreview(finalOptions.configDir),
|
|
3603
3604
|
presets.apply("core"),
|
|
3604
|
-
presets.apply("optimizeViteDeps", [])
|
|
3605
|
+
presets.apply("optimizeViteDeps", []),
|
|
3606
|
+
presets.apply("features", {})
|
|
3605
3607
|
]);
|
|
3606
3608
|
const pluginsToIgnore = [
|
|
3607
3609
|
"storybook:react-docgen-plugin",
|
|
@@ -3731,7 +3733,8 @@ var storybookTest = /* @__PURE__ */ __name(async (options) => {
|
|
|
3731
3733
|
]
|
|
3732
3734
|
},
|
|
3733
3735
|
define: {
|
|
3734
|
-
...frameworkName?.includes("vue3") ? { __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "false" } : {}
|
|
3736
|
+
...frameworkName?.includes("vue3") ? { __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "false" } : {},
|
|
3737
|
+
FEATURES: JSON.stringify(features)
|
|
3735
3738
|
}
|
|
3736
3739
|
};
|
|
3737
3740
|
const config = mergeConfig(
|
|
@@ -3,6 +3,7 @@ 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";
|
|
6
7
|
import { server } from "@vitest/browser/context";
|
|
7
8
|
import { composeStory, getCsfFactoryAnnotations } from "storybook/preview-api";
|
|
8
9
|
|
|
@@ -53,15 +54,15 @@ var setViewport = /* @__PURE__ */ __name(async (parameters = {}, globals = {}) =
|
|
|
53
54
|
if (!page || !globalThis.__vitest_browser__) {
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
|
-
const
|
|
57
|
+
const options = {
|
|
57
58
|
...MINIMAL_VIEWPORTS,
|
|
58
59
|
...viewportsParam.viewports,
|
|
59
60
|
...viewportsParam.options
|
|
60
61
|
};
|
|
61
62
|
let viewportWidth = DEFAULT_VIEWPORT_DIMENSIONS.width;
|
|
62
63
|
let viewportHeight = DEFAULT_VIEWPORT_DIMENSIONS.height;
|
|
63
|
-
if (defaultViewport && defaultViewport in
|
|
64
|
-
const styles =
|
|
64
|
+
if (defaultViewport && defaultViewport in options) {
|
|
65
|
+
const { styles } = options[defaultViewport];
|
|
65
66
|
if (styles?.width && styles?.height) {
|
|
66
67
|
const { width, height } = styles;
|
|
67
68
|
viewportWidth = parseDimension(width, "width");
|
|
@@ -78,11 +79,13 @@ var convertToFilePath = /* @__PURE__ */ __name((url) => {
|
|
|
78
79
|
const normalizedPath = path.replace(/^\/+([a-zA-Z]:)/, "$1");
|
|
79
80
|
return normalizedPath.replace(/%20/g, " ");
|
|
80
81
|
}, "convertToFilePath");
|
|
81
|
-
var testStory = /* @__PURE__ */ __name((exportName, story, meta, skipTags) => {
|
|
82
|
+
var testStory = /* @__PURE__ */ __name((exportName, story, meta, skipTags, storyId, testName) => {
|
|
82
83
|
return async (context) => {
|
|
83
84
|
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;
|
|
84
87
|
const composedStory = composeStory(
|
|
85
|
-
|
|
88
|
+
storyAnnotations,
|
|
86
89
|
annotations.meta,
|
|
87
90
|
{ initialGlobals: await getInitialGlobals?.() ?? {} },
|
|
88
91
|
annotations.preview ?? globalThis.globalProjectAnnotations,
|
|
@@ -93,9 +96,9 @@ var testStory = /* @__PURE__ */ __name((exportName, story, meta, skipTags) => {
|
|
|
93
96
|
}
|
|
94
97
|
context.story = composedStory;
|
|
95
98
|
const _task = context.task;
|
|
96
|
-
_task.meta.storyId =
|
|
99
|
+
_task.meta.storyId = storyId;
|
|
97
100
|
await setViewport(composedStory.parameters, composedStory.globals);
|
|
98
|
-
await composedStory.run();
|
|
101
|
+
await composedStory.run(void 0);
|
|
99
102
|
_task.meta.reports = composedStory.reporting.reports;
|
|
100
103
|
};
|
|
101
104
|
}, "testStory");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-vitest",
|
|
3
|
-
"version": "10.0.0-beta.
|
|
3
|
+
"version": "10.0.0-beta.10",
|
|
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.6.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",
|
|
88
89
|
"es-toolkit": "^1.36.0",
|
|
89
90
|
"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": "^10.0.0-beta.
|
|
109
|
+
"storybook": "^10.0.0-beta.10",
|
|
110
110
|
"vitest": "^3.0.0"
|
|
111
111
|
},
|
|
112
112
|
"peerDependenciesMeta": {
|