@storybook/addon-vitest 0.0.0-pr-33592-sha-f034568e → 0.0.0-pr-33206-sha-ea030b05

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.
@@ -27,6 +27,9 @@ var storeOptions = {
27
27
  coverage: !1,
28
28
  a11y: !1
29
29
  },
30
+ componentTestStatuses: [],
31
+ a11yStatuses: [],
32
+ a11yReports: {},
30
33
  componentTestCount: {
31
34
  success: 0,
32
35
  error: 0
@@ -45,7 +48,7 @@ var storeOptions = {
45
48
  }
46
49
  }
47
50
  }, FULL_RUN_TRIGGERS = ["global", "run-all"], STORE_CHANNEL_EVENT_NAME = `UNIVERSAL_STORE:${storeOptions.id}`;
48
- var STATUS_TYPE_ID_COMPONENT_TEST = "storybook/component-test", STATUS_TYPE_ID_A11Y = "storybook/a11y";
51
+ var STATUS_TYPE_ID_COMPONENT_TEST = "storybook/component-test", STATUS_TYPE_ID_A11Y = "storybook/a11y", TRIGGER_TEST_RUN_REQUEST = `${ADDON_ID3}/trigger-test-run-request`, TRIGGER_TEST_RUN_RESPONSE = `${ADDON_ID3}/trigger-test-run-response`;
49
52
 
50
53
  export {
51
54
  PANEL_ID,
@@ -58,5 +61,7 @@ export {
58
61
  storeOptions,
59
62
  FULL_RUN_TRIGGERS,
60
63
  STATUS_TYPE_ID_COMPONENT_TEST,
61
- STATUS_TYPE_ID_A11Y
64
+ STATUS_TYPE_ID_A11Y,
65
+ TRIGGER_TEST_RUN_REQUEST,
66
+ TRIGGER_TEST_RUN_RESPONSE
62
67
  };
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_8a8d5aem92t from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_8a8d5aem92t from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_8a8d5aem92t from "node:module";
1
+ import CJS_COMPAT_NODE_URL_29g4ajfhh8o from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_29g4ajfhh8o from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_29g4ajfhh8o from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_8a8d5aem92t.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_8a8d5aem92t.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_8a8d5aem92t.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_29g4ajfhh8o.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_29g4ajfhh8o.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_29g4ajfhh8o.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -1,17 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_8a8d5aem92t from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_8a8d5aem92t from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_8a8d5aem92t from "node:module";
1
+ import CJS_COMPAT_NODE_URL_29g4ajfhh8o from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_29g4ajfhh8o from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_29g4ajfhh8o from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_8a8d5aem92t.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_8a8d5aem92t.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_8a8d5aem92t.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_29g4ajfhh8o.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_29g4ajfhh8o.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_29g4ajfhh8o.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
  __commonJS
14
- } from "./chunk-DID6LB7K.js";
14
+ } from "./chunk-HOAYN3I7.js";
15
15
 
16
16
  // ../../../node_modules/ts-dedent/dist/index.js
17
17
  var require_dist = __commonJS({
@@ -1,17 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_8a8d5aem92t from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_8a8d5aem92t from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_8a8d5aem92t from "node:module";
1
+ import CJS_COMPAT_NODE_URL_29g4ajfhh8o from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_29g4ajfhh8o from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_29g4ajfhh8o from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_8a8d5aem92t.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_8a8d5aem92t.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_8a8d5aem92t.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_29g4ajfhh8o.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_29g4ajfhh8o.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_29g4ajfhh8o.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
  __commonJS
14
- } from "./chunk-DID6LB7K.js";
14
+ } from "./chunk-HOAYN3I7.js";
15
15
 
16
16
  // ../../../node_modules/picocolors/picocolors.js
17
17
  var require_picocolors = __commonJS({
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_8a8d5aem92t from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_8a8d5aem92t from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_8a8d5aem92t from "node:module";
1
+ import CJS_COMPAT_NODE_URL_29g4ajfhh8o from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_29g4ajfhh8o from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_29g4ajfhh8o from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_8a8d5aem92t.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_8a8d5aem92t.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_8a8d5aem92t.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_29g4ajfhh8o.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_29g4ajfhh8o.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_29g4ajfhh8o.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -19,8 +19,7 @@ var ADDON_ID2 = "storybook/a11y", PANEL_ID2 = `${ADDON_ID2}/panel`;
19
19
  var UI_STATE_ID = `${ADDON_ID2}/ui`, RESULT = `${ADDON_ID2}/result`, REQUEST = `${ADDON_ID2}/request`, RUNNING = `${ADDON_ID2}/running`, ERROR = `${ADDON_ID2}/error`, MANUAL = `${ADDON_ID2}/manual`, SELECT = `${ADDON_ID2}/select`, DOCUMENTATION_LINK2 = "writing-tests/accessibility-testing", DOCUMENTATION_DISCREPANCY_LINK2 = `${DOCUMENTATION_LINK2}#why-are-my-tests-failing-in-different-environments`;
20
20
 
21
21
  // src/constants.ts
22
- var ADDON_ID3 = "storybook/test", TEST_PROVIDER_ID = `${ADDON_ID3}/test-provider`, STORYBOOK_ADDON_TEST_CHANNEL = `${ADDON_ID3}/channel`;
23
- var DOCUMENTATION_LINK3 = "writing-tests/integrations/vitest-addon", DOCUMENTATION_FATAL_ERROR_LINK = `${DOCUMENTATION_LINK3}#what-happens-if-vitest-itself-has-an-error`, COVERAGE_DIRECTORY = "coverage", storeOptions = {
22
+ var ADDON_ID3 = "storybook/test", TEST_PROVIDER_ID = `${ADDON_ID3}/test-provider`, STORYBOOK_ADDON_TEST_CHANNEL = `${ADDON_ID3}/channel`, TUTORIAL_VIDEO_LINK = "https://youtu.be/Waht9qq7AoA", DOCUMENTATION_LINK3 = "writing-tests/integrations/vitest-addon", DOCUMENTATION_FATAL_ERROR_LINK = `${DOCUMENTATION_LINK3}#what-happens-if-vitest-itself-has-an-error`, COVERAGE_DIRECTORY = "coverage", storeOptions = {
24
23
  id: ADDON_ID3,
25
24
  initialState: {
26
25
  config: {
@@ -38,6 +37,9 @@ var DOCUMENTATION_LINK3 = "writing-tests/integrations/vitest-addon", DOCUMENTATI
38
37
  coverage: !1,
39
38
  a11y: !1
40
39
  },
40
+ componentTestStatuses: [],
41
+ a11yStatuses: [],
42
+ a11yReports: {},
41
43
  componentTestCount: {
42
44
  success: 0,
43
45
  error: 0
@@ -55,18 +57,26 @@ var DOCUMENTATION_LINK3 = "writing-tests/integrations/vitest-addon", DOCUMENTATI
55
57
  coverageSummary: void 0
56
58
  }
57
59
  }
58
- };
59
- var STORE_CHANNEL_EVENT_NAME = `UNIVERSAL_STORE:${storeOptions.id}`, STATUS_STORE_CHANNEL_EVENT_NAME = "UNIVERSAL_STORE:storybook/status", TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME = "UNIVERSAL_STORE:storybook/test-provider", STATUS_TYPE_ID_COMPONENT_TEST = "storybook/component-test", STATUS_TYPE_ID_A11Y = "storybook/a11y";
60
+ }, FULL_RUN_TRIGGERS = ["global", "run-all"], STORE_CHANNEL_EVENT_NAME = `UNIVERSAL_STORE:${storeOptions.id}`, STATUS_STORE_CHANNEL_EVENT_NAME = "UNIVERSAL_STORE:storybook/status", TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME = "UNIVERSAL_STORE:storybook/test-provider", STATUS_TYPE_ID_COMPONENT_TEST = "storybook/component-test", STATUS_TYPE_ID_A11Y = "storybook/a11y", TRIGGER_TEST_RUN_REQUEST = `${ADDON_ID3}/trigger-test-run-request`, TRIGGER_TEST_RUN_RESPONSE = `${ADDON_ID3}/trigger-test-run-response`;
60
61
 
61
62
  export {
62
- ADDON_ID3 as ADDON_ID,
63
+ PANEL_ID,
64
+ ADDON_ID2 as ADDON_ID,
65
+ PANEL_ID2,
66
+ ADDON_ID3 as ADDON_ID2,
67
+ TEST_PROVIDER_ID,
63
68
  STORYBOOK_ADDON_TEST_CHANNEL,
69
+ TUTORIAL_VIDEO_LINK,
64
70
  DOCUMENTATION_LINK3 as DOCUMENTATION_LINK,
71
+ DOCUMENTATION_FATAL_ERROR_LINK,
65
72
  COVERAGE_DIRECTORY,
66
73
  storeOptions,
74
+ FULL_RUN_TRIGGERS,
67
75
  STORE_CHANNEL_EVENT_NAME,
68
76
  STATUS_STORE_CHANNEL_EVENT_NAME,
69
77
  TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME,
70
78
  STATUS_TYPE_ID_COMPONENT_TEST,
71
- STATUS_TYPE_ID_A11Y
79
+ STATUS_TYPE_ID_A11Y,
80
+ TRIGGER_TEST_RUN_REQUEST,
81
+ TRIGGER_TEST_RUN_RESPONSE
72
82
  };
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_8a8d5aem92t from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_8a8d5aem92t from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_8a8d5aem92t from "node:module";
1
+ import CJS_COMPAT_NODE_URL_29g4ajfhh8o from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_29g4ajfhh8o from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_29g4ajfhh8o from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_8a8d5aem92t.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_8a8d5aem92t.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_8a8d5aem92t.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_29g4ajfhh8o.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_29g4ajfhh8o.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_29g4ajfhh8o.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -1,23 +1,23 @@
1
- import CJS_COMPAT_NODE_URL_8a8d5aem92t from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_8a8d5aem92t from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_8a8d5aem92t from "node:module";
1
+ import CJS_COMPAT_NODE_URL_29g4ajfhh8o from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_29g4ajfhh8o from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_29g4ajfhh8o from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_8a8d5aem92t.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_8a8d5aem92t.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_8a8d5aem92t.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_29g4ajfhh8o.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_29g4ajfhh8o.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_29g4ajfhh8o.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
- ADDON_ID
14
- } from "./chunk-3IOFXV3A.js";
13
+ ADDON_ID2 as ADDON_ID
14
+ } from "./chunk-FJKNQMC3.js";
15
15
  import {
16
16
  require_picocolors
17
- } from "./chunk-EEIATC6R.js";
17
+ } from "./chunk-EUUTIZXU.js";
18
18
  import {
19
19
  __toESM
20
- } from "./chunk-DID6LB7K.js";
20
+ } from "./chunk-HOAYN3I7.js";
21
21
 
22
22
  // src/logger.ts
23
23
  var import_picocolors = __toESM(require_picocolors(), 1);
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_8a8d5aem92t from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_8a8d5aem92t from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_8a8d5aem92t from "node:module";
1
+ import CJS_COMPAT_NODE_URL_29g4ajfhh8o from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_29g4ajfhh8o from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_29g4ajfhh8o from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_8a8d5aem92t.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_8a8d5aem92t.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_8a8d5aem92t.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_29g4ajfhh8o.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_29g4ajfhh8o.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_29g4ajfhh8o.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 CJS_COMPAT_NODE_URL_8a8d5aem92t from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_8a8d5aem92t from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_8a8d5aem92t from "node:module";
1
+ import CJS_COMPAT_NODE_URL_29g4ajfhh8o from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_29g4ajfhh8o from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_29g4ajfhh8o from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_8a8d5aem92t.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_8a8d5aem92t.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_8a8d5aem92t.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_29g4ajfhh8o.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_29g4ajfhh8o.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_29g4ajfhh8o.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_8a8d5aem92t.createRequire(import.meta.url);
12
12
  import {
13
13
  dirname,
14
14
  join
15
- } from "./chunk-C66KDXDP.js";
15
+ } from "./chunk-JJK3H6IZ.js";
16
16
 
17
17
  // ../../core/src/shared/utils/module.ts
18
18
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -1,17 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_8a8d5aem92t from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_8a8d5aem92t from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_8a8d5aem92t from "node:module";
1
+ import CJS_COMPAT_NODE_URL_29g4ajfhh8o from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_29g4ajfhh8o from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_29g4ajfhh8o from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_8a8d5aem92t.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_8a8d5aem92t.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_8a8d5aem92t.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_29g4ajfhh8o.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_29g4ajfhh8o.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_29g4ajfhh8o.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
  __commonJS
14
- } from "./chunk-DID6LB7K.js";
14
+ } from "./chunk-HOAYN3I7.js";
15
15
 
16
16
  // ../../../node_modules/semver/internal/constants.js
17
17
  var require_constants = __commonJS({
@@ -0,0 +1,137 @@
1
+ import { API_HashEntry, PreviewAnnotation, Status, StoryId } from 'storybook/internal/types';
2
+
3
+ type A11yReport = any;
4
+ interface VitestError extends Error {
5
+ VITEST_TEST_PATH?: string;
6
+ VITEST_TEST_NAME?: string;
7
+ stacks?: Array<{
8
+ line: number;
9
+ column: number;
10
+ file: string;
11
+ method: string;
12
+ }>;
13
+ }
14
+ type ErrorLike = {
15
+ message: string;
16
+ name?: string;
17
+ stack?: string;
18
+ cause?: ErrorLike;
19
+ };
20
+ type RunTrigger = 'run-all' | 'global' | 'watch' | Extract<API_HashEntry['type'], string> | `external:${string}`;
21
+ type CurrentRun = {
22
+ triggeredBy: RunTrigger | undefined;
23
+ config: StoreState['config'];
24
+ componentTestStatuses: Status[];
25
+ a11yStatuses: Status[];
26
+ componentTestCount: {
27
+ success: number;
28
+ error: number;
29
+ };
30
+ a11yCount: {
31
+ success: number;
32
+ warning: number;
33
+ error: number;
34
+ };
35
+ a11yReports: Record<StoryId, A11yReport[]>;
36
+ totalTestCount: number | undefined;
37
+ storyIds: StoryId[] | undefined;
38
+ startedAt: number | undefined;
39
+ finishedAt: number | undefined;
40
+ unhandledErrors: VitestError[];
41
+ coverageSummary: {
42
+ status: 'positive' | 'warning' | 'negative' | 'unknown';
43
+ percentage: number;
44
+ } | undefined;
45
+ };
46
+ type StoreState = {
47
+ config: {
48
+ coverage: boolean;
49
+ a11y: boolean;
50
+ };
51
+ watching: boolean;
52
+ cancelling: boolean;
53
+ indexUrl: string | undefined;
54
+ previewAnnotations: PreviewAnnotation[];
55
+ fatalError: {
56
+ message: string | undefined;
57
+ error: ErrorLike;
58
+ } | undefined;
59
+ currentRun: CurrentRun;
60
+ };
61
+
62
+ declare const PANEL_ID$1 = "storybook/interactions/panel";
63
+
64
+ declare const ADDON_ID$1 = "storybook/a11y";
65
+ declare const PANEL_ID = "storybook/a11y/panel";
66
+
67
+ declare const ADDON_ID = "storybook/test";
68
+ declare const TEST_PROVIDER_ID = "storybook/test/test-provider";
69
+ declare const STORYBOOK_ADDON_TEST_CHANNEL = "storybook/test/channel";
70
+ declare const TUTORIAL_VIDEO_LINK = "https://youtu.be/Waht9qq7AoA";
71
+ declare const DOCUMENTATION_LINK = "writing-tests/integrations/vitest-addon";
72
+ declare const DOCUMENTATION_FATAL_ERROR_LINK = "writing-tests/integrations/vitest-addon#what-happens-if-vitest-itself-has-an-error";
73
+ declare const COVERAGE_DIRECTORY = "coverage";
74
+ declare const storeOptions: {
75
+ id: string;
76
+ initialState: {
77
+ config: {
78
+ coverage: false;
79
+ a11y: false;
80
+ };
81
+ watching: false;
82
+ cancelling: false;
83
+ fatalError: undefined;
84
+ indexUrl: undefined;
85
+ previewAnnotations: never[];
86
+ currentRun: {
87
+ triggeredBy: undefined;
88
+ config: {
89
+ coverage: false;
90
+ a11y: false;
91
+ };
92
+ componentTestStatuses: never[];
93
+ a11yStatuses: never[];
94
+ a11yReports: {};
95
+ componentTestCount: {
96
+ success: number;
97
+ error: number;
98
+ };
99
+ a11yCount: {
100
+ success: number;
101
+ warning: number;
102
+ error: number;
103
+ };
104
+ storyIds: undefined;
105
+ totalTestCount: undefined;
106
+ startedAt: undefined;
107
+ finishedAt: undefined;
108
+ unhandledErrors: never[];
109
+ coverageSummary: undefined;
110
+ };
111
+ };
112
+ };
113
+ declare const FULL_RUN_TRIGGERS: RunTrigger[];
114
+ declare const STORE_CHANNEL_EVENT_NAME: string;
115
+ declare const STATUS_STORE_CHANNEL_EVENT_NAME = "UNIVERSAL_STORE:storybook/status";
116
+ declare const TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME = "UNIVERSAL_STORE:storybook/test-provider";
117
+ declare const STATUS_TYPE_ID_COMPONENT_TEST = "storybook/component-test";
118
+ declare const STATUS_TYPE_ID_A11Y = "storybook/a11y";
119
+ declare const TRIGGER_TEST_RUN_REQUEST = "storybook/test/trigger-test-run-request";
120
+ declare const TRIGGER_TEST_RUN_RESPONSE = "storybook/test/trigger-test-run-response";
121
+ type TriggerTestRunRequestPayload = {
122
+ requestId: string;
123
+ actor: string;
124
+ storyIds?: string[];
125
+ };
126
+ type TestRunResult = CurrentRun;
127
+ type TriggerTestRunResponsePayload = {
128
+ requestId: string;
129
+ status: 'completed' | 'error' | 'cancelled';
130
+ result?: TestRunResult;
131
+ error?: {
132
+ message: string;
133
+ error?: ErrorLike;
134
+ };
135
+ };
136
+
137
+ export { ADDON_ID$1 as A11Y_ADDON_ID, PANEL_ID as A11Y_PANEL_ID, ADDON_ID, PANEL_ID$1 as COMPONENT_TESTING_PANEL_ID, COVERAGE_DIRECTORY, DOCUMENTATION_FATAL_ERROR_LINK, DOCUMENTATION_LINK, FULL_RUN_TRIGGERS, STATUS_STORE_CHANNEL_EVENT_NAME, STATUS_TYPE_ID_A11Y, STATUS_TYPE_ID_COMPONENT_TEST, STORE_CHANNEL_EVENT_NAME, STORYBOOK_ADDON_TEST_CHANNEL, TEST_PROVIDER_ID, TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME, TRIGGER_TEST_RUN_REQUEST, TRIGGER_TEST_RUN_RESPONSE, TUTORIAL_VIDEO_LINK, type TestRunResult, type TriggerTestRunRequestPayload, type TriggerTestRunResponsePayload, storeOptions };
@@ -0,0 +1,54 @@
1
+ import CJS_COMPAT_NODE_URL_29g4ajfhh8o from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_29g4ajfhh8o from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_29g4ajfhh8o from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_29g4ajfhh8o.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_29g4ajfhh8o.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_29g4ajfhh8o.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ ADDON_ID,
14
+ ADDON_ID2,
15
+ COVERAGE_DIRECTORY,
16
+ DOCUMENTATION_FATAL_ERROR_LINK,
17
+ DOCUMENTATION_LINK,
18
+ FULL_RUN_TRIGGERS,
19
+ PANEL_ID,
20
+ PANEL_ID2,
21
+ STATUS_STORE_CHANNEL_EVENT_NAME,
22
+ STATUS_TYPE_ID_A11Y,
23
+ STATUS_TYPE_ID_COMPONENT_TEST,
24
+ STORE_CHANNEL_EVENT_NAME,
25
+ STORYBOOK_ADDON_TEST_CHANNEL,
26
+ TEST_PROVIDER_ID,
27
+ TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME,
28
+ TRIGGER_TEST_RUN_REQUEST,
29
+ TRIGGER_TEST_RUN_RESPONSE,
30
+ TUTORIAL_VIDEO_LINK,
31
+ storeOptions
32
+ } from "./_node-chunks/chunk-FJKNQMC3.js";
33
+ import "./_node-chunks/chunk-HOAYN3I7.js";
34
+ export {
35
+ ADDON_ID as A11Y_ADDON_ID,
36
+ PANEL_ID2 as A11Y_PANEL_ID,
37
+ ADDON_ID2 as ADDON_ID,
38
+ PANEL_ID as COMPONENT_TESTING_PANEL_ID,
39
+ COVERAGE_DIRECTORY,
40
+ DOCUMENTATION_FATAL_ERROR_LINK,
41
+ DOCUMENTATION_LINK,
42
+ FULL_RUN_TRIGGERS,
43
+ STATUS_STORE_CHANNEL_EVENT_NAME,
44
+ STATUS_TYPE_ID_A11Y,
45
+ STATUS_TYPE_ID_COMPONENT_TEST,
46
+ STORE_CHANNEL_EVENT_NAME,
47
+ STORYBOOK_ADDON_TEST_CHANNEL,
48
+ TEST_PROVIDER_ID,
49
+ TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME,
50
+ TRIGGER_TEST_RUN_REQUEST,
51
+ TRIGGER_TEST_RUN_RESPONSE,
52
+ TUTORIAL_VIDEO_LINK,
53
+ storeOptions
54
+ };
package/dist/manager.js CHANGED
@@ -9,8 +9,10 @@ import {
9
9
  STATUS_TYPE_ID_COMPONENT_TEST,
10
10
  STORYBOOK_ADDON_TEST_CHANNEL,
11
11
  TEST_PROVIDER_ID,
12
+ TRIGGER_TEST_RUN_REQUEST,
13
+ TRIGGER_TEST_RUN_RESPONSE,
12
14
  storeOptions
13
- } from "./_browser-chunks/chunk-QHH5JRC6.js";
15
+ } from "./_browser-chunks/chunk-AX7G72AU.js";
14
16
 
15
17
  // src/manager.tsx
16
18
  import React5, { useState as useState3 } from "react";
@@ -28,7 +30,7 @@ var store = experimental_UniversalStore.create({
28
30
  }), componentTestStatusStore = experimental_getStatusStore(STATUS_TYPE_ID_COMPONENT_TEST), a11yStatusStore = experimental_getStatusStore(STATUS_TYPE_ID_A11Y), testProviderStore = experimental_getTestProviderStore(ADDON_ID2);
29
31
 
30
32
  // src/manager.tsx
31
- import { Tag, addons as addons2 } from "storybook/manager-api";
33
+ import { Tag, addons as addons3 } from "storybook/manager-api";
32
34
 
33
35
  // src/components/GlobalErrorModal.tsx
34
36
  import React, { useContext } from "react";
@@ -82,6 +84,7 @@ function GlobalErrorModal({ onRerun, storeState }) {
82
84
 
83
85
  // src/components/SidebarContextMenu.tsx
84
86
  import React4 from "react";
87
+ import { addons as addons2 } from "storybook/manager-api";
85
88
 
86
89
  // src/use-test-provider-state.ts
87
90
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
@@ -618,7 +621,16 @@ var SidebarContextMenu = ({ context, api }) => {
618
621
  storeState,
619
622
  setStoreState
620
623
  } = useTestProvider(api, context.id);
621
- return React4.createElement(
624
+ return React4.createElement(React4.Fragment, null, React4.createElement("button", { onClick: () => {
625
+ let channel = addons2.getChannel(), requestId = `test-${Date.now()}`, handleResponse = (payload) => {
626
+ payload.requestId === requestId && (channel.off(TRIGGER_TEST_RUN_RESPONSE, handleResponse), console.log("Test run response:", payload), alert(`Test run ${payload.status}!`));
627
+ };
628
+ channel.on(TRIGGER_TEST_RUN_RESPONSE, handleResponse), channel.emit(TRIGGER_TEST_RUN_REQUEST, {
629
+ requestId,
630
+ actor: "sidebar-test-button",
631
+ storyIds: context.type === "story" ? [context.id] : void 0
632
+ });
633
+ }, style: { margin: 8 } }, "Test Channel Trigger API"), React4.createElement(
622
634
  TestProviderRender,
623
635
  {
624
636
  api,
@@ -631,11 +643,11 @@ var SidebarContextMenu = ({ context, api }) => {
631
643
  setStoreState,
632
644
  isSettingsUpdated: !1
633
645
  }
634
- );
646
+ ));
635
647
  };
636
648
 
637
649
  // src/manager.tsx
638
- addons2.register(ADDON_ID2, (api) => {
650
+ addons3.register(ADDON_ID2, (api) => {
639
651
  if (globalThis.STORYBOOK_BUILDER === SupportedBuilder.VITE) {
640
652
  let openPanel2 = (panelId) => {
641
653
  api.setSelectedPanel(panelId), api.togglePanel(!0);
@@ -658,7 +670,7 @@ addons2.register(ADDON_ID2, (api) => {
658
670
  })), store.subscribe("TEST_RUN_COMPLETED", ({ payload }) => {
659
671
  api.emit(STORYBOOK_ADDON_TEST_CHANNEL, { type: "test-run-completed", payload });
660
672
  });
661
- }), addons2.add(TEST_PROVIDER_ID, {
673
+ }), addons3.add(TEST_PROVIDER_ID, {
662
674
  type: Addon_TypesEnum.experimental_TEST_PROVIDER,
663
675
  render: () => {
664
676
  let [isModalOpen, setModalOpen] = useState3(!1), {
@@ -1,22 +1,22 @@
1
- import CJS_COMPAT_NODE_URL_8a8d5aem92t from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_8a8d5aem92t from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_8a8d5aem92t from "node:module";
1
+ import CJS_COMPAT_NODE_URL_29g4ajfhh8o from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_29g4ajfhh8o from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_29g4ajfhh8o from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_8a8d5aem92t.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_8a8d5aem92t.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_8a8d5aem92t.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_29g4ajfhh8o.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_29g4ajfhh8o.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_29g4ajfhh8o.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-AV4NY4PY.js";
14
+ } from "../_node-chunks/chunk-ZWY5I7ZC.js";
15
15
  import {
16
16
  __commonJS,
17
17
  __require,
18
18
  __toESM
19
- } from "../_node-chunks/chunk-DID6LB7K.js";
19
+ } from "../_node-chunks/chunk-HOAYN3I7.js";
20
20
 
21
21
  // ../../../node_modules/istanbul-lib-report/node_modules/make-dir/index.js
22
22
  var require_make_dir = __commonJS({
@@ -1,35 +1,35 @@
1
- import CJS_COMPAT_NODE_URL_8a8d5aem92t from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_8a8d5aem92t from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_8a8d5aem92t from "node:module";
1
+ import CJS_COMPAT_NODE_URL_29g4ajfhh8o from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_29g4ajfhh8o from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_29g4ajfhh8o from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_8a8d5aem92t.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_8a8d5aem92t.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_8a8d5aem92t.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_29g4ajfhh8o.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_29g4ajfhh8o.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_29g4ajfhh8o.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-F4RSZFIS.js";
14
+ } from "../_node-chunks/chunk-ILLYE7DT.js";
15
15
  import {
16
16
  any
17
- } from "../_node-chunks/chunk-NZIOFOGM.js";
17
+ } from "../_node-chunks/chunk-5ML6G3JQ.js";
18
18
  import {
19
- ADDON_ID,
19
+ ADDON_ID2 as ADDON_ID,
20
20
  COVERAGE_DIRECTORY,
21
21
  STATUS_TYPE_ID_A11Y,
22
22
  STATUS_TYPE_ID_COMPONENT_TEST,
23
23
  storeOptions
24
- } from "../_node-chunks/chunk-3IOFXV3A.js";
25
- import "../_node-chunks/chunk-EEIATC6R.js";
24
+ } from "../_node-chunks/chunk-FJKNQMC3.js";
25
+ import "../_node-chunks/chunk-EUUTIZXU.js";
26
26
  import {
27
27
  dirname,
28
28
  join,
29
29
  normalize,
30
30
  path
31
- } from "../_node-chunks/chunk-C66KDXDP.js";
32
- import "../_node-chunks/chunk-DID6LB7K.js";
31
+ } from "../_node-chunks/chunk-JJK3H6IZ.js";
32
+ import "../_node-chunks/chunk-HOAYN3I7.js";
33
33
 
34
34
  // src/node/vitest.ts
35
35
  import process2 from "node:process";
@@ -441,7 +441,34 @@ var testStateToStatusValueMap = {
441
441
  */
442
442
  this.throttledFlushTestCaseResults = throttle(() => {
443
443
  let testCaseResultsToFlush = this.batchedTestCaseResults;
444
- this.batchedTestCaseResults = [], this.store.setState((s) => {
444
+ this.batchedTestCaseResults = [];
445
+ let componentTestStatuses = testCaseResultsToFlush.map(({ storyId, testResult }) => ({
446
+ storyId,
447
+ typeId: STATUS_TYPE_ID_COMPONENT_TEST,
448
+ value: testStateToStatusValueMap[testResult.state],
449
+ title: "Component tests",
450
+ description: testResult.errors?.map((error) => error.stack || error.message).join(`
451
+ `) ?? "",
452
+ sidebarContextMenu: !1
453
+ }));
454
+ this.componentTestStatusStore.set(componentTestStatuses);
455
+ let a11yReportsByStoryId = {}, a11yStatuses = [];
456
+ for (let { storyId, reports } of testCaseResultsToFlush) {
457
+ let storyA11yReports = reports?.filter((r) => r.type === "a11y");
458
+ if (storyA11yReports?.length) {
459
+ a11yReportsByStoryId[storyId] = storyA11yReports.map((r) => r.result);
460
+ for (let a11yReport of storyA11yReports)
461
+ a11yStatuses.push({
462
+ storyId,
463
+ typeId: STATUS_TYPE_ID_A11Y,
464
+ value: testStateToStatusValueMap[a11yReport.status],
465
+ title: "Accessibility tests",
466
+ description: "",
467
+ sidebarContextMenu: !1
468
+ });
469
+ }
470
+ }
471
+ a11yStatuses.length > 0 && this.a11yStatusStore.set(a11yStatuses), this.store.setState((s) => {
445
472
  let { success: ctSuccess, error: ctError } = s.currentRun.componentTestCount, { success: a11ySuccess, warning: a11yWarning, error: a11yError } = s.currentRun.a11yCount;
446
473
  testCaseResultsToFlush.forEach(({ testResult, reports }) => {
447
474
  testResult.state === "passed" ? ctSuccess++ : testResult.state === "failed" && ctError++, reports?.filter((r) => r.type === "a11y").forEach((report) => {
@@ -455,6 +482,12 @@ var testStateToStatusValueMap = {
455
482
  ...s.currentRun,
456
483
  componentTestCount: { success: ctSuccess, error: ctError },
457
484
  a11yCount: { success: a11ySuccess, warning: a11yWarning, error: a11yError },
485
+ componentTestStatuses: s.currentRun.componentTestStatuses.concat(componentTestStatuses),
486
+ a11yStatuses: s.currentRun.a11yStatuses.concat(a11yStatuses),
487
+ a11yReports: {
488
+ ...s.currentRun.a11yReports,
489
+ ...a11yReportsByStoryId
490
+ },
458
491
  // in some cases successes and errors can exceed the anticipated totalTestCount
459
492
  // e.g. when testing more tests than the stories we know about upfront
460
493
  // in those cases, we set the totalTestCount to the sum of successes and errors
@@ -462,27 +495,6 @@ var testStateToStatusValueMap = {
462
495
  }
463
496
  };
464
497
  });
465
- let componentTestStatuses = testCaseResultsToFlush.map(({ storyId, testResult }) => ({
466
- storyId,
467
- typeId: STATUS_TYPE_ID_COMPONENT_TEST,
468
- value: testStateToStatusValueMap[testResult.state],
469
- title: "Component tests",
470
- description: testResult.errors?.map((error) => error.stack || error.message).join(`
471
- `) ?? "",
472
- sidebarContextMenu: !1
473
- }));
474
- this.componentTestStatusStore.set(componentTestStatuses);
475
- let a11yStatuses = testCaseResultsToFlush.flatMap(
476
- ({ storyId, reports }) => reports?.filter((r) => r.type === "a11y").map((a11yReport) => ({
477
- storyId,
478
- typeId: STATUS_TYPE_ID_A11Y,
479
- value: testStateToStatusValueMap[a11yReport.status],
480
- title: "Accessibility tests",
481
- description: "",
482
- sidebarContextMenu: !1
483
- }))
484
- ).filter((a11yStatus) => a11yStatus !== void 0);
485
- a11yStatuses.length > 0 && this.a11yStatusStore.set(a11yStatuses);
486
498
  }, 500);
487
499
  this.store = options.store, this.componentTestStatusStore = options.componentTestStatusStore, this.a11yStatusStore = options.a11yStatusStore, this.testProviderStore = options.testProviderStore, this.onReady = options.onReady, this.storybookOptions = options.storybookOptions, this.vitestManager = new VitestManager(this), this.store.subscribe("TRIGGER_RUN", this.handleTriggerRunEvent.bind(this)), this.store.subscribe("CANCEL_RUN", this.handleCancelEvent.bind(this)), this.store.untilReady().then(() => this.vitestManager.startVitest({ coverage: this.store.getState().config.coverage })).then(() => this.onReady?.()).catch((e) => {
488
500
  this.reportFatalError("Failed to start Vitest", e);
@@ -1,32 +1,32 @@
1
- import CJS_COMPAT_NODE_URL_8a8d5aem92t from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_8a8d5aem92t from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_8a8d5aem92t from "node:module";
1
+ import CJS_COMPAT_NODE_URL_29g4ajfhh8o from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_29g4ajfhh8o from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_29g4ajfhh8o from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_8a8d5aem92t.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_8a8d5aem92t.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_8a8d5aem92t.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_29g4ajfhh8o.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_29g4ajfhh8o.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_29g4ajfhh8o.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
  resolvePackageDir
14
- } from "./_node-chunks/chunk-FVEQ2WIN.js";
14
+ } from "./_node-chunks/chunk-KH4OXXWA.js";
15
15
  import {
16
16
  any
17
- } from "./_node-chunks/chunk-NZIOFOGM.js";
17
+ } from "./_node-chunks/chunk-5ML6G3JQ.js";
18
18
  import {
19
19
  DOCUMENTATION_LINK
20
- } from "./_node-chunks/chunk-3IOFXV3A.js";
20
+ } from "./_node-chunks/chunk-FJKNQMC3.js";
21
21
  import {
22
22
  require_dist
23
- } from "./_node-chunks/chunk-GZSX5CFZ.js";
23
+ } from "./_node-chunks/chunk-6BIWWITF.js";
24
24
  import {
25
25
  dirname,
26
26
  join,
27
27
  relative,
28
28
  resolve
29
- } from "./_node-chunks/chunk-C66KDXDP.js";
29
+ } from "./_node-chunks/chunk-JJK3H6IZ.js";
30
30
  import {
31
31
  require_compare,
32
32
  require_constants,
@@ -36,11 +36,11 @@ import {
36
36
  require_parse_options,
37
37
  require_re,
38
38
  require_semver
39
- } from "./_node-chunks/chunk-AV4NY4PY.js";
39
+ } from "./_node-chunks/chunk-ZWY5I7ZC.js";
40
40
  import {
41
41
  __commonJS,
42
42
  __toESM
43
- } from "./_node-chunks/chunk-DID6LB7K.js";
43
+ } from "./_node-chunks/chunk-HOAYN3I7.js";
44
44
 
45
45
  // ../../../node_modules/semver/functions/parse.js
46
46
  var require_parse = __commonJS({
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_8a8d5aem92t from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_8a8d5aem92t from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_8a8d5aem92t from "node:module";
1
+ import CJS_COMPAT_NODE_URL_29g4ajfhh8o from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_29g4ajfhh8o from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_29g4ajfhh8o from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_8a8d5aem92t.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_8a8d5aem92t.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_8a8d5aem92t.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_29g4ajfhh8o.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_29g4ajfhh8o.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_29g4ajfhh8o.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -12,31 +12,33 @@ var require = CJS_COMPAT_NODE_MODULE_8a8d5aem92t.createRequire(import.meta.url);
12
12
  import {
13
13
  log,
14
14
  noop
15
- } from "./_node-chunks/chunk-F4RSZFIS.js";
15
+ } from "./_node-chunks/chunk-ILLYE7DT.js";
16
16
  import {
17
17
  importMetaResolve
18
- } from "./_node-chunks/chunk-FVEQ2WIN.js";
18
+ } from "./_node-chunks/chunk-KH4OXXWA.js";
19
19
  import {
20
- ADDON_ID,
20
+ ADDON_ID2 as ADDON_ID,
21
21
  COVERAGE_DIRECTORY,
22
22
  STATUS_STORE_CHANNEL_EVENT_NAME,
23
23
  STORE_CHANNEL_EVENT_NAME,
24
24
  STORYBOOK_ADDON_TEST_CHANNEL,
25
25
  TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME,
26
+ TRIGGER_TEST_RUN_REQUEST,
27
+ TRIGGER_TEST_RUN_RESPONSE,
26
28
  storeOptions
27
- } from "./_node-chunks/chunk-3IOFXV3A.js";
29
+ } from "./_node-chunks/chunk-FJKNQMC3.js";
28
30
  import {
29
31
  require_picocolors
30
- } from "./_node-chunks/chunk-EEIATC6R.js";
32
+ } from "./_node-chunks/chunk-EUUTIZXU.js";
31
33
  import {
32
34
  require_dist
33
- } from "./_node-chunks/chunk-GZSX5CFZ.js";
35
+ } from "./_node-chunks/chunk-6BIWWITF.js";
34
36
  import {
35
37
  normalize
36
- } from "./_node-chunks/chunk-C66KDXDP.js";
38
+ } from "./_node-chunks/chunk-JJK3H6IZ.js";
37
39
  import {
38
40
  __toESM
39
- } from "./_node-chunks/chunk-DID6LB7K.js";
41
+ } from "./_node-chunks/chunk-HOAYN3I7.js";
40
42
 
41
43
  // src/preset.ts
42
44
  import { mkdir } from "node:fs/promises";
@@ -382,6 +384,44 @@ var experimental_serverChannel = async (channel, options) => {
382
384
  ...s,
383
385
  currentRun: { ...s.currentRun, coverageSummary: void 0, unhandledErrors: [] }
384
386
  }));
387
+ }), channel.on(TRIGGER_TEST_RUN_REQUEST, async (payload) => {
388
+ let { requestId, actor, storyIds } = payload, sendResponse = (response) => {
389
+ channel.emit(TRIGGER_TEST_RUN_RESPONSE, { requestId, ...response });
390
+ };
391
+ await store.untilReady();
392
+ let {
393
+ currentRun: { startedAt, finishedAt }
394
+ } = store.getState();
395
+ if (startedAt && !finishedAt) {
396
+ sendResponse({
397
+ status: "error",
398
+ error: { message: "Tests are already running" }
399
+ });
400
+ return;
401
+ }
402
+ store.send({
403
+ type: "TRIGGER_RUN",
404
+ payload: {
405
+ storyIds,
406
+ triggeredBy: `external:${actor}`
407
+ }
408
+ });
409
+ let unsubscribe = store.subscribe((event) => {
410
+ switch (event.type) {
411
+ case "TEST_RUN_COMPLETED": {
412
+ unsubscribe(), sendResponse({ status: "completed", result: event.payload });
413
+ return;
414
+ }
415
+ case "FATAL_ERROR": {
416
+ unsubscribe(), sendResponse({ status: "error", error: event.payload });
417
+ return;
418
+ }
419
+ case "CANCEL_RUN": {
420
+ unsubscribe(), sendResponse({ status: "cancelled" });
421
+ return;
422
+ }
423
+ }
424
+ });
385
425
  }), !core.disableTelemetry) {
386
426
  let enableCrashReports = core.enableCrashReports || options.enableCrashReports;
387
427
  channel.on(STORYBOOK_ADDON_TEST_CHANNEL, (event) => {
@@ -0,0 +1,5 @@
1
+ import { StoryAnnotations } from 'storybook/internal/types';
2
+
3
+ declare const preview: StoryAnnotations;
4
+
5
+ export { preview as default };
@@ -0,0 +1,31 @@
1
+ // src/preview.ts
2
+ console.log("addon vitest preview!");
3
+ var preview = {
4
+ afterEach: async ({ title, name, canvasElement, reporting }) => {
5
+ if (globalThis.__vitest_browser__)
6
+ try {
7
+ console.log(`Taking screenshot for "${name}"`);
8
+ let { page } = await import("@vitest/browser/context"), base64 = await page.screenshot({
9
+ path: `screenshots/${title}/${name}.png`,
10
+ base64: !0,
11
+ element: canvasElement.firstChild
12
+ });
13
+ reporting.addReport({
14
+ type: "screenshot",
15
+ version: 1,
16
+ result: base64,
17
+ status: "passed"
18
+ });
19
+ } catch (error) {
20
+ console.error("Error taking screenshot", error), reporting.addReport({
21
+ type: "screenshot",
22
+ version: 1,
23
+ result: error,
24
+ status: "failed"
25
+ });
26
+ }
27
+ }
28
+ }, preview_default = preview;
29
+ export {
30
+ preview_default as default
31
+ };
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_8a8d5aem92t from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_8a8d5aem92t from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_8a8d5aem92t from "node:module";
1
+ import CJS_COMPAT_NODE_URL_29g4ajfhh8o from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_29g4ajfhh8o from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_29g4ajfhh8o from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_8a8d5aem92t.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_8a8d5aem92t.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_8a8d5aem92t.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_29g4ajfhh8o.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_29g4ajfhh8o.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_29g4ajfhh8o.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -13,7 +13,7 @@ import {
13
13
  __commonJS,
14
14
  __require,
15
15
  __toESM
16
- } from "../_node-chunks/chunk-DID6LB7K.js";
16
+ } from "../_node-chunks/chunk-HOAYN3I7.js";
17
17
 
18
18
  // ../../../node_modules/tree-kill/index.js
19
19
  var require_tree_kill = __commonJS({
@@ -1,20 +1,20 @@
1
- import CJS_COMPAT_NODE_URL_8a8d5aem92t from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_8a8d5aem92t from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_8a8d5aem92t from "node:module";
1
+ import CJS_COMPAT_NODE_URL_29g4ajfhh8o from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_29g4ajfhh8o from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_29g4ajfhh8o from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_8a8d5aem92t.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_8a8d5aem92t.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_8a8d5aem92t.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_29g4ajfhh8o.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_29g4ajfhh8o.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_29g4ajfhh8o.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-EEIATC6R.js";
14
+ } from "../_node-chunks/chunk-EUUTIZXU.js";
15
15
  import {
16
16
  require_dist
17
- } from "../_node-chunks/chunk-GZSX5CFZ.js";
17
+ } from "../_node-chunks/chunk-6BIWWITF.js";
18
18
  import {
19
19
  join,
20
20
  normalize,
@@ -22,12 +22,12 @@ import {
22
22
  relative,
23
23
  resolve,
24
24
  sep
25
- } from "../_node-chunks/chunk-C66KDXDP.js";
25
+ } from "../_node-chunks/chunk-JJK3H6IZ.js";
26
26
  import {
27
27
  __commonJS,
28
28
  __require,
29
29
  __toESM
30
- } from "../_node-chunks/chunk-DID6LB7K.js";
30
+ } from "../_node-chunks/chunk-HOAYN3I7.js";
31
31
 
32
32
  // ../../../node_modules/braces/lib/utils.js
33
33
  var require_utils = __commonJS({
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PANEL_ID
3
- } from "../_browser-chunks/chunk-QHH5JRC6.js";
3
+ } from "../_browser-chunks/chunk-AX7G72AU.js";
4
4
 
5
5
  // src/vitest-plugin/setup-file.ts
6
6
  import { afterEach, beforeAll, vi } from "vitest";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-vitest",
3
- "version": "0.0.0-pr-33592-sha-f034568e",
3
+ "version": "0.0.0-pr-33206-sha-ea030b05",
4
4
  "description": "Storybook Vitest addon: Blazing fast component testing using stories",
5
5
  "keywords": [
6
6
  "storybook",
@@ -42,6 +42,10 @@
42
42
  "types": "./dist/index.d.ts",
43
43
  "default": "./dist/index.js"
44
44
  },
45
+ "./constants": {
46
+ "types": "./dist/constants.d.ts",
47
+ "default": "./dist/constants.js"
48
+ },
45
49
  "./internal/coverage-reporter": "./dist/node/coverage-reporter.js",
46
50
  "./internal/global-setup": "./dist/vitest-plugin/global-setup.js",
47
51
  "./internal/setup-file": "./dist/vitest-plugin/setup-file.js",
@@ -50,6 +54,10 @@
50
54
  "./package.json": "./package.json",
51
55
  "./postinstall": "./dist/postinstall.js",
52
56
  "./preset": "./dist/preset.js",
57
+ "./preview": {
58
+ "types": "./dist/preview.d.ts",
59
+ "default": "./dist/preview.js"
60
+ },
53
61
  "./vitest": "./dist/node/vitest.js",
54
62
  "./vitest-plugin": {
55
63
  "types": "./dist/vitest-plugin/index.d.ts",
@@ -72,6 +80,7 @@
72
80
  "@storybook/icons": "^2.0.1"
73
81
  },
74
82
  "devDependencies": {
83
+ "@storybook/addon-a11y": "0.0.0-pr-33206-sha-ea030b05",
75
84
  "@types/istanbul-lib-report": "^3.0.3",
76
85
  "@types/micromatch": "^4.0.0",
77
86
  "@types/node": "^22.19.1",
@@ -99,7 +108,7 @@
99
108
  "@vitest/browser": "^3.0.0 || ^4.0.0",
100
109
  "@vitest/browser-playwright": "^4.0.0",
101
110
  "@vitest/runner": "^3.0.0 || ^4.0.0",
102
- "storybook": "^0.0.0-pr-33592-sha-f034568e",
111
+ "storybook": "^0.0.0-pr-33206-sha-ea030b05",
103
112
  "vitest": "^3.0.0 || ^4.0.0"
104
113
  },
105
114
  "peerDependenciesMeta": {
package/preview.js ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/preview.js';