@storybook/addon-vitest 11.0.0-rc.0 → 11.0.0-rc.1
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/_browser-chunks/{chunk-SOJUMPVB.js → chunk-JNYCH5SZ.js} +1 -0
- package/dist/_node-chunks/{chunk-FKKCPNLJ.js → chunk-4HVYW5B2.js} +1 -1
- package/dist/_node-chunks/chunk-PQZIOGBY.js +1 -1
- package/dist/_node-chunks/{chunk-G4HWSAOC.js → chunk-U3I4JYDP.js} +1 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +1 -1
- package/dist/manager.js +1 -1
- package/dist/node/vitest.js +21 -8
- package/dist/postinstall.js +1 -1
- package/dist/preset.js +86 -28
- package/dist/vitest-plugin/index.js +2 -2
- package/dist/vitest-plugin/setup-file.js +1 -1
- package/dist/vitest-plugin/test-utils.js +1 -1
- package/package.json +4 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRequire as
|
|
1
|
+
import { createRequire as CJS_COMPAT_CREATE_REQUIRE_au1pgcspllh } from "node:module";var require = CJS_COMPAT_CREATE_REQUIRE_au1pgcspllh(import.meta.url);
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/dist/constants.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ type CurrentRun = {
|
|
|
38
38
|
a11yReports: Record<StoryId, A11yRunReport[]>;
|
|
39
39
|
reports: Record<StoryId, Report[]>;
|
|
40
40
|
totalTestCount: number | undefined;
|
|
41
|
+
matchedFileCount: number | undefined;
|
|
41
42
|
storyIds: StoryId[] | undefined;
|
|
42
43
|
startedAt: number | undefined;
|
|
43
44
|
finishedAt: number | undefined;
|
|
@@ -94,6 +95,7 @@ declare const storeOptions: {
|
|
|
94
95
|
};
|
|
95
96
|
storyIds: undefined;
|
|
96
97
|
totalTestCount: undefined;
|
|
98
|
+
matchedFileCount: undefined;
|
|
97
99
|
startedAt: undefined;
|
|
98
100
|
finishedAt: undefined;
|
|
99
101
|
unhandledErrors: never[];
|
|
@@ -119,6 +121,8 @@ type TriggerTestRunRequestPayload = {
|
|
|
119
121
|
requestId: string;
|
|
120
122
|
actor: string;
|
|
121
123
|
storyIds?: string[];
|
|
124
|
+
fileFilters?: string[];
|
|
125
|
+
storyFiles?: string[];
|
|
122
126
|
config?: Record<string, unknown>;
|
|
123
127
|
};
|
|
124
128
|
type TestRunResult = CurrentRun;
|
package/dist/constants.js
CHANGED
package/dist/manager.js
CHANGED
package/dist/node/vitest.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
errorToErrorLike,
|
|
3
3
|
log
|
|
4
|
-
} from "../_node-chunks/chunk-
|
|
4
|
+
} from "../_node-chunks/chunk-4HVYW5B2.js";
|
|
5
5
|
import {
|
|
6
6
|
any,
|
|
7
7
|
up
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
STORYBOOK_TEST_PROVIDE_KEY,
|
|
23
23
|
STORY_INDEX_CHANNEL_EVENT_NAME,
|
|
24
24
|
storeOptions
|
|
25
|
-
} from "../_node-chunks/chunk-
|
|
25
|
+
} from "../_node-chunks/chunk-U3I4JYDP.js";
|
|
26
26
|
import "../_node-chunks/chunk-PQZIOGBY.js";
|
|
27
27
|
|
|
28
28
|
// src/node/vitest.ts
|
|
@@ -319,9 +319,11 @@ Please install the @vitest/${isIstanbul ? "coverage-istanbul" : "coverage-v8"} p
|
|
|
319
319
|
this.vitest?.provide(STORYBOOK_TEST_PROVIDE_KEY, this.getCurrentRunConfig());
|
|
320
320
|
}
|
|
321
321
|
async runTests(runPayload) {
|
|
322
|
-
let { watching } = this.testManager.store.getState(), coverageShouldBeEnabled = !!this.getCurrentRunConfig().coverage && !watching && (runPayload?.storyIds?.length ?? 0) === 0;
|
|
322
|
+
let { watching } = this.testManager.store.getState(), coverageShouldBeEnabled = !!this.getCurrentRunConfig().coverage && !watching && !runPayload.fileFilters && !runPayload.storyFiles && (runPayload?.storyIds?.length ?? 0) === 0;
|
|
323
323
|
this.vitest ? await this.setCoverage(coverageShouldBeEnabled) : await this.startVitest({ coverage: coverageShouldBeEnabled }), this.provideRunConfig(), this.resetGlobalTestNamePattern(), await this.cancelCurrentRun();
|
|
324
|
-
let allStories = this.getStories(),
|
|
324
|
+
let allStories = this.getStories(), matchedSpecifications = await this.getStorybookTestSpecifications(runPayload.fileFilters), storyFiles = runPayload.storyFiles && new Set(runPayload.storyFiles.map(toModuleId)), testSpecifications = storyFiles ? matchedSpecifications.filter(({ moduleId }) => storyFiles.has(moduleId)) : matchedSpecifications, matchedFiles = (runPayload.fileFilters || storyFiles) && new Set(testSpecifications.map(({ moduleId }) => moduleId)), filteredStories = allStories.filter(
|
|
325
|
+
(story) => (!runPayload.storyIds || runPayload.storyIds.includes(story.id)) && (!matchedFiles || matchedFiles.has(toModuleId(story.importPath)))
|
|
326
|
+
);
|
|
325
327
|
if (runPayload.storyIds?.length) {
|
|
326
328
|
let regex = this.buildTestNamePatternForStories(filteredStories, allStories);
|
|
327
329
|
regex && this.vitest.setGlobalTestNamePattern(regex);
|
|
@@ -330,7 +332,10 @@ Please install the @vitest/${isIstanbul ? "coverage-istanbul" : "coverage-v8"} p
|
|
|
330
332
|
testSpecifications,
|
|
331
333
|
filteredStories
|
|
332
334
|
);
|
|
333
|
-
this.testManager.
|
|
335
|
+
matchedFiles && this.testManager.setRunStories(
|
|
336
|
+
filteredStories.map((story) => story.id),
|
|
337
|
+
runPayload.fileFilters && new Set(matchedSpecifications.map(({ moduleId }) => moduleId)).size
|
|
338
|
+
), this.testManager.store.setState((s) => ({
|
|
334
339
|
...s,
|
|
335
340
|
currentRun: {
|
|
336
341
|
...s.currentRun,
|
|
@@ -363,8 +368,9 @@ Please install the @vitest/${isIstanbul ? "coverage-istanbul" : "coverage-v8"} p
|
|
|
363
368
|
logger.debug(`Could not check ${moduleId} against the Vitest test globs: ${e}`);
|
|
364
369
|
}
|
|
365
370
|
}
|
|
366
|
-
|
|
367
|
-
|
|
371
|
+
// With file filters: the story files they match, as `vitest Button` finds its test files
|
|
372
|
+
async getStorybookTestSpecifications(fileFilters) {
|
|
373
|
+
return (await this.vitest?.globTestSpecifications(fileFilters) ?? []).filter(
|
|
368
374
|
(workspaceSpec) => this.isStorybookProject(workspaceSpec.project)
|
|
369
375
|
) ?? [];
|
|
370
376
|
}
|
|
@@ -564,7 +570,8 @@ var testStateToStatusValueMap = {
|
|
|
564
570
|
}
|
|
565
571
|
async handleTriggerRunEvent(event) {
|
|
566
572
|
await this.runTestsWithState({
|
|
567
|
-
|
|
573
|
+
// The stories of a run of files are known once Vitest has matched the files
|
|
574
|
+
storyIds: event.payload.fileFilters || event.payload.storyFiles ? [] : event.payload.storyIds,
|
|
568
575
|
triggeredBy: event.payload.triggeredBy,
|
|
569
576
|
configOverride: event.payload.configOverride,
|
|
570
577
|
callback: async () => {
|
|
@@ -622,6 +629,12 @@ var testStateToStatusValueMap = {
|
|
|
622
629
|
throw new Error("Tests completed but there are unhandled errors");
|
|
623
630
|
});
|
|
624
631
|
}
|
|
632
|
+
setRunStories(storyIds, matchedFileCount) {
|
|
633
|
+
this.componentTestStatusStore.unset(storyIds), this.a11yStatusStore.unset(storyIds), this.store.setState((s) => ({
|
|
634
|
+
...s,
|
|
635
|
+
currentRun: { ...s.currentRun, storyIds, matchedFileCount }
|
|
636
|
+
}));
|
|
637
|
+
}
|
|
625
638
|
onTestModuleCollected(collectedTestCount) {
|
|
626
639
|
this.store.setState((s) => ({
|
|
627
640
|
...s,
|
package/dist/postinstall.js
CHANGED
package/dist/preset.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
errorToErrorLike,
|
|
3
3
|
log,
|
|
4
4
|
noop
|
|
5
|
-
} from "./_node-chunks/chunk-
|
|
5
|
+
} from "./_node-chunks/chunk-4HVYW5B2.js";
|
|
6
6
|
import {
|
|
7
7
|
require_picocolors
|
|
8
8
|
} from "./_node-chunks/chunk-MTTYIP6M.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
TRIGGER_TEST_RUN_REQUEST,
|
|
26
26
|
TRIGGER_TEST_RUN_RESPONSE,
|
|
27
27
|
storeOptions
|
|
28
|
-
} from "./_node-chunks/chunk-
|
|
28
|
+
} from "./_node-chunks/chunk-U3I4JYDP.js";
|
|
29
29
|
import {
|
|
30
30
|
__toESM
|
|
31
31
|
} from "./_node-chunks/chunk-PQZIOGBY.js";
|
|
@@ -439,7 +439,7 @@ var resolvePreviewBuilderName = (core) => typeof core?.builder == "string" ? cor
|
|
|
439
439
|
"vite"
|
|
440
440
|
), requestInFlight = !1;
|
|
441
441
|
channel.on(TRIGGER_TEST_RUN_REQUEST, async (payload) => {
|
|
442
|
-
let { requestId, actor, storyIds, config: configOverride } = payload, sendResponse = (response) => {
|
|
442
|
+
let { requestId, actor, storyIds, fileFilters, storyFiles, config: configOverride } = payload, sendResponse = (response) => {
|
|
443
443
|
channel.emit(TRIGGER_TEST_RUN_RESPONSE, { requestId, ...response });
|
|
444
444
|
};
|
|
445
445
|
if (!viteBuilder) {
|
|
@@ -497,6 +497,8 @@ var resolvePreviewBuilderName = (core) => typeof core?.builder == "string" ? cor
|
|
|
497
497
|
type: "TRIGGER_RUN",
|
|
498
498
|
payload: {
|
|
499
499
|
storyIds,
|
|
500
|
+
fileFilters,
|
|
501
|
+
storyFiles,
|
|
500
502
|
triggeredBy: `external:${actor}`,
|
|
501
503
|
...configOverride && {
|
|
502
504
|
configOverride: { ...config, ...configOverride }
|
|
@@ -605,6 +607,21 @@ function minLength(requirement, message$1) {
|
|
|
605
607
|
}
|
|
606
608
|
};
|
|
607
609
|
}
|
|
610
|
+
// @__NO_SIDE_EFFECTS__
|
|
611
|
+
function regex(requirement, message$1) {
|
|
612
|
+
return {
|
|
613
|
+
kind: "validation",
|
|
614
|
+
type: "regex",
|
|
615
|
+
reference: regex,
|
|
616
|
+
async: !1,
|
|
617
|
+
expects: `${requirement}`,
|
|
618
|
+
requirement,
|
|
619
|
+
message: message$1,
|
|
620
|
+
"~run"(dataset, config$1) {
|
|
621
|
+
return dataset.typed && !this.requirement.test(dataset.value) && _addIssue(this, "format", dataset, config$1), dataset;
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
}
|
|
608
625
|
var ABORT_EARLY_CONFIG = { abortEarly: !0 };
|
|
609
626
|
// @__NO_SIDE_EFFECTS__
|
|
610
627
|
function getFallback(schema, dataset, config$1) {
|
|
@@ -1320,7 +1337,7 @@ function formatChangedConfigFiles(changed) {
|
|
|
1320
1337
|
function formatSelection(selection) {
|
|
1321
1338
|
let parts = [];
|
|
1322
1339
|
if (selection.files) {
|
|
1323
|
-
let { filters, storyFileCount } = selection.files;
|
|
1340
|
+
let { filters, storyFileCount = 0 } = selection.files;
|
|
1324
1341
|
parts.push(
|
|
1325
1342
|
`${pluralize(storyFileCount, "story file")} ${storyFileCount === 1 ? "matches" : "match"} ${filters.map((filter) => code(displayPath(filter))).join(", ")}`
|
|
1326
1343
|
);
|
|
@@ -1427,7 +1444,11 @@ function formatTestRun(data, ctx, { a11yEnabled }) {
|
|
|
1427
1444
|
|
|
1428
1445
|
// src/node/toolset/run.ts
|
|
1429
1446
|
import {
|
|
1430
|
-
|
|
1447
|
+
detectBlockedNetwork,
|
|
1448
|
+
formatBlockedNetwork,
|
|
1449
|
+
RERUN_OUTSIDE_SANDBOX
|
|
1450
|
+
} from "storybook/internal/common";
|
|
1451
|
+
import {
|
|
1431
1452
|
findStoryIds
|
|
1432
1453
|
} from "storybook/internal/core-server";
|
|
1433
1454
|
import { OpenServiceTestRunTimeoutError } from "storybook/internal/server-errors";
|
|
@@ -1451,6 +1472,8 @@ function triggerTestRun({
|
|
|
1451
1472
|
requestEvent,
|
|
1452
1473
|
responseEvent,
|
|
1453
1474
|
storyIds,
|
|
1475
|
+
fileFilters,
|
|
1476
|
+
storyFiles,
|
|
1454
1477
|
config,
|
|
1455
1478
|
actor,
|
|
1456
1479
|
timeoutMs = DEFAULT_TEST_RUN_TIMEOUT_MS
|
|
@@ -1482,6 +1505,8 @@ function triggerTestRun({
|
|
|
1482
1505
|
requestId,
|
|
1483
1506
|
actor,
|
|
1484
1507
|
storyIds,
|
|
1508
|
+
fileFilters,
|
|
1509
|
+
storyFiles,
|
|
1485
1510
|
config
|
|
1486
1511
|
});
|
|
1487
1512
|
} catch (error) {
|
|
@@ -1489,6 +1514,17 @@ function triggerTestRun({
|
|
|
1489
1514
|
}
|
|
1490
1515
|
});
|
|
1491
1516
|
}
|
|
1517
|
+
function blockedRunResult(blocked) {
|
|
1518
|
+
return {
|
|
1519
|
+
status: "error",
|
|
1520
|
+
error: {
|
|
1521
|
+
message: `The tests did not run: ${formatBlockedNetwork(blocked)}. This is not a problem in the code. ${RERUN_OUTSIDE_SANDBOX}`
|
|
1522
|
+
}
|
|
1523
|
+
};
|
|
1524
|
+
}
|
|
1525
|
+
function blockedBeforeAnyTest(result) {
|
|
1526
|
+
return result.componentTestCount.success + result.componentTestCount.error === 0 ? result.unhandledErrors.map((error) => detectBlockedNetwork(error)).find(Boolean) : void 0;
|
|
1527
|
+
}
|
|
1492
1528
|
async function runStoryTests({
|
|
1493
1529
|
channel,
|
|
1494
1530
|
getIndex,
|
|
@@ -1502,25 +1538,19 @@ async function runStoryTests({
|
|
|
1502
1538
|
responseEvent = TRIGGER_TEST_RUN_RESPONSE,
|
|
1503
1539
|
timeoutMs = DEFAULT_TEST_RUN_TIMEOUT_MS
|
|
1504
1540
|
}) {
|
|
1505
|
-
let storyIds, selection, notFoundMessages = [], filters = files?.length ? files : void 0;
|
|
1541
|
+
let storyIds, storyFiles, selection, notFoundMessages = [], filters = files?.length ? files : void 0;
|
|
1506
1542
|
if (stories || filters || changed) {
|
|
1507
1543
|
let since = typeof changed == "string" ? changed : void 0, changedStories = changed ? await getChangedStories2(since) : void 0, index = await getIndex(), candidates, narrow = (ids) => {
|
|
1508
1544
|
candidates = new Set(candidates ? ids.filter((id) => candidates.has(id)) : ids);
|
|
1509
1545
|
};
|
|
1510
|
-
if (selection = {}, filters) {
|
|
1511
|
-
let matched = filterStoryFiles({ index, filters });
|
|
1512
|
-
selection.files = { filters, storyFileCount: matched.storyFiles.length }, matched.storyFiles.length === 0 && !changed && notFoundMessages.push(
|
|
1513
|
-
`No story files found for ${filters.map((file) => `\`${displayPath(file)}\``).join(", ")}.`
|
|
1514
|
-
), narrow(matched.storyIds);
|
|
1515
|
-
}
|
|
1516
|
-
if (changedStories) {
|
|
1546
|
+
if (selection = {}, filters && (selection.files = { filters }), changedStories) {
|
|
1517
1547
|
let { storyIds: changedIds, changedConfigFiles, pendingFiles } = changedStories;
|
|
1518
1548
|
selection.changed = {
|
|
1519
1549
|
storyCount: changedIds.length,
|
|
1520
1550
|
changedConfigFiles,
|
|
1521
1551
|
pendingFiles,
|
|
1522
1552
|
...since === void 0 ? {} : { since }
|
|
1523
|
-
}, narrow(changedIds);
|
|
1553
|
+
}, stories ? narrow(changedIds) : storyFiles = changedStories.storyFiles;
|
|
1524
1554
|
}
|
|
1525
1555
|
if (stories) {
|
|
1526
1556
|
selection.inputStoryCount = stories.length;
|
|
@@ -1531,7 +1561,7 @@ async function runStoryTests({
|
|
|
1531
1561
|
resolved.filter((story) => "entry" in story).map((story) => story.entry.id)
|
|
1532
1562
|
);
|
|
1533
1563
|
}
|
|
1534
|
-
if (candidates?.size === 0)
|
|
1564
|
+
if (candidates?.size === 0 || storyFiles?.length === 0)
|
|
1535
1565
|
return { status: "no-stories", notFoundMessages, selection };
|
|
1536
1566
|
storyIds = candidates ? [...candidates] : void 0, selection.storyCount = storyIds?.length;
|
|
1537
1567
|
}
|
|
@@ -1542,6 +1572,8 @@ async function runStoryTests({
|
|
|
1542
1572
|
requestEvent,
|
|
1543
1573
|
responseEvent,
|
|
1544
1574
|
storyIds,
|
|
1575
|
+
fileFilters: filters,
|
|
1576
|
+
storyFiles,
|
|
1545
1577
|
config: { a11y },
|
|
1546
1578
|
actor,
|
|
1547
1579
|
timeoutMs
|
|
@@ -1555,24 +1587,32 @@ async function runStoryTests({
|
|
|
1555
1587
|
};
|
|
1556
1588
|
}
|
|
1557
1589
|
switch (response.status) {
|
|
1558
|
-
case "completed":
|
|
1559
|
-
|
|
1590
|
+
case "completed": {
|
|
1591
|
+
if (!response.result)
|
|
1592
|
+
return {
|
|
1593
|
+
status: "error",
|
|
1594
|
+
error: { message: "Test run completed but no result was returned" }
|
|
1595
|
+
};
|
|
1596
|
+
let { result } = response, blocked = blockedBeforeAnyTest(result);
|
|
1597
|
+
return blocked ? blockedRunResult(blocked) : (selection?.files && (selection.files.storyFileCount = result.matchedFileCount ?? 0, selection.files.storyFileCount === 0 && !changed && notFoundMessages.push(
|
|
1598
|
+
`No story files found for ${selection.files.filters.map((file) => `\`${displayPath(file)}\``).join(", ")}.`
|
|
1599
|
+
)), selection && (filters || storyFiles) && (selection.storyCount = result.storyIds?.length, filters && result.storyIds?.length === 0) ? { status: "no-stories", notFoundMessages, selection } : {
|
|
1560
1600
|
status: "completed",
|
|
1561
|
-
result
|
|
1601
|
+
result,
|
|
1562
1602
|
...selection ? { selection } : {},
|
|
1563
1603
|
...notFoundMessages.length > 0 ? { notFoundMessages } : {}
|
|
1564
|
-
}
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
return {
|
|
1604
|
+
});
|
|
1605
|
+
}
|
|
1606
|
+
case "error": {
|
|
1607
|
+
let blocked = detectBlockedNetwork(response.error) ?? detectBlockedNetwork(response.error?.error);
|
|
1608
|
+
return blocked ? blockedRunResult(blocked) : {
|
|
1570
1609
|
status: "error",
|
|
1571
1610
|
error: {
|
|
1572
1611
|
message: response.error?.message ?? "Test run failed with unknown error",
|
|
1573
1612
|
...response.error?.error !== void 0 ? { error: response.error.error } : {}
|
|
1574
1613
|
}
|
|
1575
1614
|
};
|
|
1615
|
+
}
|
|
1576
1616
|
case "cancelled":
|
|
1577
1617
|
return { status: "cancelled" };
|
|
1578
1618
|
default:
|
|
@@ -1612,6 +1652,7 @@ var errorLikeSchema = object({
|
|
|
1612
1652
|
a11yReports: record(string(), array(any())),
|
|
1613
1653
|
reports: record(string(), array(any())),
|
|
1614
1654
|
totalTestCount: optional(number()),
|
|
1655
|
+
matchedFileCount: optional(number()),
|
|
1615
1656
|
storyIds: optional(array(string())),
|
|
1616
1657
|
startedAt: optional(number()),
|
|
1617
1658
|
finishedAt: optional(number()),
|
|
@@ -1628,7 +1669,13 @@ var errorLikeSchema = object({
|
|
|
1628
1669
|
})
|
|
1629
1670
|
)
|
|
1630
1671
|
}), selectionSchema = object({
|
|
1631
|
-
files: optional(
|
|
1672
|
+
files: optional(
|
|
1673
|
+
object({
|
|
1674
|
+
filters: array(string()),
|
|
1675
|
+
/** How many story files Vitest matched. Not there when the call stopped before that. */
|
|
1676
|
+
storyFileCount: optional(number())
|
|
1677
|
+
})
|
|
1678
|
+
),
|
|
1632
1679
|
changed: optional(
|
|
1633
1680
|
object({
|
|
1634
1681
|
/** How many stories `stories changed` listed. */
|
|
@@ -1680,8 +1727,18 @@ var errorLikeSchema = object({
|
|
|
1680
1727
|
),
|
|
1681
1728
|
files: optional(
|
|
1682
1729
|
pipe(
|
|
1683
|
-
|
|
1684
|
-
|
|
1730
|
+
array(
|
|
1731
|
+
pipe(
|
|
1732
|
+
string(),
|
|
1733
|
+
// An empty entry, as from an unset variable, would match every story file.
|
|
1734
|
+
minLength(1),
|
|
1735
|
+
// Vitest reads `Button.stories.tsx:12` as the test at that line, which the runner cannot run.
|
|
1736
|
+
regex(
|
|
1737
|
+
/^(?!.*:\d+(-\d+)?$)/,
|
|
1738
|
+
"A line number after a file is not supported. To test one story, pass it in stories."
|
|
1739
|
+
)
|
|
1740
|
+
)
|
|
1741
|
+
),
|
|
1685
1742
|
description(
|
|
1686
1743
|
"Story files to test: each entry selects the story files whose path contains it (case-insensitive), or that an absolute path or directory points to. Only story files match; to test the stories that depend on a changed component, use `changed`."
|
|
1687
1744
|
)
|
|
@@ -1692,7 +1749,7 @@ var errorLikeSchema = object({
|
|
|
1692
1749
|
// An empty ref, as from an unset variable in CI, must not read as "not changed".
|
|
1693
1750
|
union([boolean(), pipe(string(), minLength(1))]),
|
|
1694
1751
|
description(
|
|
1695
|
-
"Test the changed stories
|
|
1752
|
+
"Test the story files of the changed stories that the stories changed tool lists: new and modified stories, and the stories that depend on changed files. true for the uncommitted changes, or a git ref (a branch, tag or commit) for what this branch committed since it forked from that ref, plus the uncommitted changes. Combined with files or stories, only the stories that match both run."
|
|
1696
1753
|
)
|
|
1697
1754
|
)
|
|
1698
1755
|
),
|
|
@@ -1761,6 +1818,7 @@ async function getChangedStories(ctx, since) {
|
|
|
1761
1818
|
);
|
|
1762
1819
|
return {
|
|
1763
1820
|
storyIds: data.stories.map((story) => story.storyId),
|
|
1821
|
+
storyFiles: [...new Set(data.stories.map((story) => story.importPath))],
|
|
1764
1822
|
changedConfigFiles: data.changedConfigFiles,
|
|
1765
1823
|
pendingFiles: [...data.unindexedStoryFiles, ...data.pendingFiles]
|
|
1766
1824
|
};
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
STORYBOOK_CORE_RENDER_ANALYSIS_PROVIDE_KEY,
|
|
18
18
|
STORYBOOK_TEST_FEATURES_PROVIDE_KEY,
|
|
19
19
|
STORYBOOK_TEST_INITIAL_GLOBALS_PROVIDE_KEY
|
|
20
|
-
} from "../_node-chunks/chunk-
|
|
20
|
+
} from "../_node-chunks/chunk-U3I4JYDP.js";
|
|
21
21
|
import {
|
|
22
22
|
__commonJS,
|
|
23
23
|
__esm,
|
|
@@ -2354,7 +2354,7 @@ import {
|
|
|
2354
2354
|
var import_picocolors = __toESM(require_picocolors(), 1), import_sirv = __toESM(require_build(), 1), import_ts_dedent2 = __toESM(require_dist(), 1);
|
|
2355
2355
|
|
|
2356
2356
|
// package.json
|
|
2357
|
-
var version = "11.0.0-rc.
|
|
2357
|
+
var version = "11.0.0-rc.1";
|
|
2358
2358
|
|
|
2359
2359
|
// ../../builders/builder-vite/src/utils/without-vite-plugins.ts
|
|
2360
2360
|
var withoutVitePlugins = async (plugins = [], namesToRemove) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PANEL_ID,
|
|
3
3
|
STORYBOOK_TEST_FEATURES_PROVIDE_KEY
|
|
4
|
-
} from "../_browser-chunks/chunk-
|
|
4
|
+
} from "../_browser-chunks/chunk-JNYCH5SZ.js";
|
|
5
5
|
|
|
6
6
|
// src/vitest-plugin/setup-file.ts
|
|
7
7
|
import { afterEach, beforeAll, beforeEach, inject, vi } from "vitest";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
STORYBOOK_CORE_RENDER_ANALYSIS_PROVIDE_KEY,
|
|
4
4
|
STORYBOOK_TEST_INITIAL_GLOBALS_PROVIDE_KEY,
|
|
5
5
|
STORYBOOK_TEST_PROVIDE_KEY
|
|
6
|
-
} from "../_browser-chunks/chunk-
|
|
6
|
+
} from "../_browser-chunks/chunk-JNYCH5SZ.js";
|
|
7
7
|
|
|
8
8
|
// src/vitest-plugin/test-utils.ts
|
|
9
9
|
import { inject } from "vitest";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-vitest",
|
|
3
|
-
"version": "11.0.0-rc.
|
|
3
|
+
"version": "11.0.0-rc.1",
|
|
4
4
|
"description": "Storybook Vitest addon: Blazing fast component testing using stories",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -77,12 +77,11 @@
|
|
|
77
77
|
"!src/**/*"
|
|
78
78
|
],
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@storybook/global": "^5.0.0",
|
|
81
80
|
"@storybook/icons": "^2.0.2"
|
|
82
81
|
},
|
|
83
82
|
"devDependencies": {
|
|
84
|
-
"@storybook/addon-a11y": "11.0.0-rc.
|
|
85
|
-
"@storybook/builder-vite": "11.0.0-rc.
|
|
83
|
+
"@storybook/addon-a11y": "11.0.0-rc.1",
|
|
84
|
+
"@storybook/builder-vite": "11.0.0-rc.1",
|
|
86
85
|
"@types/istanbul-lib-report": "^3.0.3",
|
|
87
86
|
"@types/micromatch": "^4.0.0",
|
|
88
87
|
"@types/node": "^22.19.1",
|
|
@@ -110,7 +109,7 @@
|
|
|
110
109
|
"peerDependencies": {
|
|
111
110
|
"@vitest/browser": "^4.0.0 || ^5.0.0",
|
|
112
111
|
"@vitest/browser-playwright": "^4.0.0 || ^5.0.0",
|
|
113
|
-
"storybook": "^11.0.0-rc.
|
|
112
|
+
"storybook": "^11.0.0-rc.1",
|
|
114
113
|
"vitest": "^4.0.0 || ^5.0.0"
|
|
115
114
|
},
|
|
116
115
|
"peerDependenciesMeta": {
|