@storybook/addon-vitest 0.0.0-pr-33169-sha-5c0c2779 → 0.0.0-pr-33206-sha-2fd88b76
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-JBTVYJV3.js → chunk-4JXZBSNX.js} +7 -7
- package/dist/_node-chunks/{chunk-34ZTIM2E.js → chunk-52GSDTBX.js} +6 -6
- package/dist/_node-chunks/{chunk-WGF3ARXX.js → chunk-GCWONSEX.js} +7 -7
- package/dist/_node-chunks/{chunk-O5TON5UR.js → chunk-HJUKMZMH.js} +6 -6
- package/dist/_node-chunks/{chunk-DC4BVB24.js → chunk-JD7SDFFJ.js} +9 -8
- package/dist/_node-chunks/{chunk-GUUTDDXP.js → chunk-KKIRYHWY.js} +7 -7
- package/dist/_node-chunks/{chunk-EHKJQTWG.js → chunk-LSSCRN52.js} +6 -6
- package/dist/_node-chunks/{chunk-KK4P6LI6.js → chunk-ON6GQNXM.js} +9 -9
- package/dist/_node-chunks/{chunk-J7GPYOQB.js → chunk-VJSSX3A5.js} +7 -7
- package/dist/index.d.ts +4 -1
- package/dist/index.js +48 -1
- package/dist/node/coverage-reporter.js +8 -8
- package/dist/node/vitest.js +26 -13
- package/dist/postinstall.js +13 -13
- package/dist/preset.js +14 -14
- package/dist/preview.d.ts +5 -0
- package/dist/preview.js +31 -0
- package/dist/vitest-plugin/global-setup.js +7 -7
- package/dist/vitest-plugin/index.js +10 -10
- package/package.json +6 -2
- package/preview.js +1 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_2nu5e4a9bxm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_2nu5e4a9bxm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_2nu5e4a9bxm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_2nu5e4a9bxm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm.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-
|
|
14
|
+
} from "./chunk-LSSCRN52.js";
|
|
15
15
|
|
|
16
16
|
// ../../node_modules/semver/internal/constants.js
|
|
17
17
|
var require_constants = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_2nu5e4a9bxm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_2nu5e4a9bxm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_2nu5e4a9bxm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_2nu5e4a9bxm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm.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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_2nu5e4a9bxm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_2nu5e4a9bxm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_2nu5e4a9bxm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_2nu5e4a9bxm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm.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-
|
|
14
|
+
} from "./chunk-LSSCRN52.js";
|
|
15
15
|
|
|
16
16
|
// ../../node_modules/ts-dedent/dist/index.js
|
|
17
17
|
var require_dist = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_2nu5e4a9bxm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_2nu5e4a9bxm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_2nu5e4a9bxm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_2nu5e4a9bxm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_2nu5e4a9bxm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_2nu5e4a9bxm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_2nu5e4a9bxm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_2nu5e4a9bxm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -55,7 +55,7 @@ var DOCUMENTATION_LINK3 = "writing-tests/integrations/vitest-addon", DOCUMENTATI
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
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";
|
|
58
|
+
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", STATUS_TYPE_ID_SCREENSHOT = "storybook/screenshot";
|
|
59
59
|
|
|
60
60
|
export {
|
|
61
61
|
ADDON_ID3 as ADDON_ID,
|
|
@@ -67,5 +67,6 @@ export {
|
|
|
67
67
|
STATUS_STORE_CHANNEL_EVENT_NAME,
|
|
68
68
|
TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME,
|
|
69
69
|
STATUS_TYPE_ID_COMPONENT_TEST,
|
|
70
|
-
STATUS_TYPE_ID_A11Y
|
|
70
|
+
STATUS_TYPE_ID_A11Y,
|
|
71
|
+
STATUS_TYPE_ID_SCREENSHOT
|
|
71
72
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_2nu5e4a9bxm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_2nu5e4a9bxm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_2nu5e4a9bxm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_2nu5e4a9bxm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm.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-
|
|
14
|
+
} from "./chunk-LSSCRN52.js";
|
|
15
15
|
|
|
16
16
|
// ../../node_modules/picocolors/picocolors.js
|
|
17
17
|
var require_picocolors = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_2nu5e4a9bxm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_2nu5e4a9bxm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_2nu5e4a9bxm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_2nu5e4a9bxm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm.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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_2nu5e4a9bxm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_2nu5e4a9bxm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_2nu5e4a9bxm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_2nu5e4a9bxm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
ADDON_ID
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JD7SDFFJ.js";
|
|
15
15
|
import {
|
|
16
16
|
require_picocolors
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-KKIRYHWY.js";
|
|
18
18
|
import {
|
|
19
19
|
__toESM
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-LSSCRN52.js";
|
|
21
21
|
|
|
22
22
|
// src/logger.ts
|
|
23
23
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_2nu5e4a9bxm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_2nu5e4a9bxm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_2nu5e4a9bxm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_2nu5e4a9bxm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm.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_bx09omj2pho.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
dirname,
|
|
14
14
|
join
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-HJUKMZMH.js";
|
|
16
16
|
|
|
17
17
|
// ../../core/src/shared/utils/module.ts
|
|
18
18
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as storybook_internal_csf from 'storybook/internal/csf';
|
|
2
|
+
import { StoryId } from 'storybook/internal/csf';
|
|
2
3
|
|
|
3
4
|
declare const _default: () => storybook_internal_csf.PreviewAddon<storybook_internal_csf.AddonTypes>;
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
declare function triggerTestRun(actor: string, storyIds?: StoryId[]): Promise<unknown>;
|
|
7
|
+
|
|
8
|
+
export { _default as default, triggerTestRun };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
STATUS_TYPE_ID_COMPONENT_TEST
|
|
3
|
+
} from "./_browser-chunks/chunk-TJXI7EIW.js";
|
|
4
|
+
|
|
1
5
|
// src/index.ts
|
|
6
|
+
import { experimental_getStatusStore } from "storybook/internal/core-server";
|
|
2
7
|
import { definePreviewAddon } from "storybook/internal/csf";
|
|
3
8
|
var index_default = () => definePreviewAddon({});
|
|
9
|
+
async function triggerTestRun(actor, storyIds) {
|
|
10
|
+
let store = globalThis.__STORYBOOK_ADDON_VITEST_STORE__;
|
|
11
|
+
if (!store)
|
|
12
|
+
throw new Error("store not ready yet");
|
|
13
|
+
await store.untilReady();
|
|
14
|
+
let {
|
|
15
|
+
currentRun: { startedAt, finishedAt }
|
|
16
|
+
} = store.getState();
|
|
17
|
+
if (startedAt && !finishedAt)
|
|
18
|
+
throw new Error("tests are already running");
|
|
19
|
+
return store.send({
|
|
20
|
+
type: "TRIGGER_RUN",
|
|
21
|
+
payload: {
|
|
22
|
+
storyIds,
|
|
23
|
+
triggeredBy: `external:${actor}`
|
|
24
|
+
}
|
|
25
|
+
}), new Promise((resolve, reject) => {
|
|
26
|
+
let unsubscribe = store.subscribe((event) => {
|
|
27
|
+
switch (event.type) {
|
|
28
|
+
case "TEST_RUN_COMPLETED": {
|
|
29
|
+
console.log("Completed!"), console.dir(event.payload, { depth: 5 }), unsubscribe();
|
|
30
|
+
let storyStatuses = Object.values(
|
|
31
|
+
experimental_getStatusStore(STATUS_TYPE_ID_COMPONENT_TEST).getAll()
|
|
32
|
+
).filter(
|
|
33
|
+
(statusByTypeId) => event.payload.storyIds?.includes(statusByTypeId[STATUS_TYPE_ID_COMPONENT_TEST].storyId)
|
|
34
|
+
);
|
|
35
|
+
resolve({ ...event.payload, storyStatuses });
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
case "FATAL_ERROR": {
|
|
39
|
+
console.log("ERROR!"), console.dir(event.payload, { depth: 5 }), unsubscribe(), reject(event.payload);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
case "CANCEL_RUN": {
|
|
43
|
+
console.log("CANCEL!"), console.dir(event, { depth: 5 }), unsubscribe(), reject("cancelled");
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
4
50
|
export {
|
|
5
|
-
index_default as default
|
|
51
|
+
index_default as default,
|
|
52
|
+
triggerTestRun
|
|
6
53
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_2nu5e4a9bxm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_2nu5e4a9bxm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_2nu5e4a9bxm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_2nu5e4a9bxm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm.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-4JXZBSNX.js";
|
|
15
15
|
import {
|
|
16
16
|
__commonJS,
|
|
17
17
|
__require,
|
|
18
18
|
__toESM
|
|
19
|
-
} from "../_node-chunks/chunk-
|
|
19
|
+
} from "../_node-chunks/chunk-LSSCRN52.js";
|
|
20
20
|
|
|
21
21
|
// ../../node_modules/istanbul-lib-report/node_modules/make-dir/index.js
|
|
22
22
|
var require_make_dir = __commonJS({
|
package/dist/node/vitest.js
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_2nu5e4a9bxm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_2nu5e4a9bxm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_2nu5e4a9bxm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_2nu5e4a9bxm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm.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-ON6GQNXM.js";
|
|
15
15
|
import {
|
|
16
16
|
any
|
|
17
|
-
} from "../_node-chunks/chunk-
|
|
17
|
+
} from "../_node-chunks/chunk-52GSDTBX.js";
|
|
18
18
|
import {
|
|
19
19
|
ADDON_ID,
|
|
20
20
|
COVERAGE_DIRECTORY,
|
|
21
21
|
STATUS_TYPE_ID_A11Y,
|
|
22
22
|
STATUS_TYPE_ID_COMPONENT_TEST,
|
|
23
|
+
STATUS_TYPE_ID_SCREENSHOT,
|
|
23
24
|
storeOptions
|
|
24
|
-
} from "../_node-chunks/chunk-
|
|
25
|
-
import "../_node-chunks/chunk-
|
|
25
|
+
} from "../_node-chunks/chunk-JD7SDFFJ.js";
|
|
26
|
+
import "../_node-chunks/chunk-KKIRYHWY.js";
|
|
26
27
|
import {
|
|
27
28
|
dirname,
|
|
28
29
|
join,
|
|
29
30
|
normalize,
|
|
30
31
|
path
|
|
31
|
-
} from "../_node-chunks/chunk-
|
|
32
|
-
import "../_node-chunks/chunk-
|
|
32
|
+
} from "../_node-chunks/chunk-HJUKMZMH.js";
|
|
33
|
+
import "../_node-chunks/chunk-LSSCRN52.js";
|
|
33
34
|
|
|
34
35
|
// src/node/vitest.ts
|
|
35
36
|
import process2 from "node:process";
|
|
@@ -476,8 +477,19 @@ var testStateToStatusValueMap = {
|
|
|
476
477
|
}))
|
|
477
478
|
).filter((a11yStatus) => a11yStatus !== void 0);
|
|
478
479
|
a11yStatuses.length > 0 && this.a11yStatusStore.set(a11yStatuses);
|
|
480
|
+
let screenshotStatuses = testCaseResultsToFlush.flatMap(
|
|
481
|
+
({ storyId, reports }) => reports?.filter((r) => r.type === "screenshot").map((screenshotReport) => ({
|
|
482
|
+
storyId,
|
|
483
|
+
typeId: STATUS_TYPE_ID_SCREENSHOT,
|
|
484
|
+
value: testStateToStatusValueMap[screenshotReport.status],
|
|
485
|
+
title: "Screenshot",
|
|
486
|
+
description: screenshotReport.result,
|
|
487
|
+
sidebarContextMenu: !1
|
|
488
|
+
}))
|
|
489
|
+
).filter((screenshotStatus) => screenshotStatus !== void 0);
|
|
490
|
+
screenshotStatuses.length > 0 && this.screenshotStatusStore.set(screenshotStatuses);
|
|
479
491
|
}, 500);
|
|
480
|
-
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) => {
|
|
492
|
+
this.store = options.store, this.componentTestStatusStore = options.componentTestStatusStore, this.a11yStatusStore = options.a11yStatusStore, this.screenshotStatusStore = options.screenshotStatusStore, 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) => {
|
|
481
493
|
this.reportFatalError("Failed to start Vitest", e);
|
|
482
494
|
});
|
|
483
495
|
}
|
|
@@ -603,6 +615,7 @@ new TestManager({
|
|
|
603
615
|
store,
|
|
604
616
|
componentTestStatusStore: getStatusStore(STATUS_TYPE_ID_COMPONENT_TEST),
|
|
605
617
|
a11yStatusStore: getStatusStore(STATUS_TYPE_ID_A11Y),
|
|
618
|
+
screenshotStatusStore: getStatusStore(STATUS_TYPE_ID_SCREENSHOT),
|
|
606
619
|
testProviderStore: getTestProviderStore(ADDON_ID),
|
|
607
620
|
onReady: () => {
|
|
608
621
|
process2.send?.({ type: "ready" });
|
package/dist/postinstall.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_2nu5e4a9bxm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_2nu5e4a9bxm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_2nu5e4a9bxm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_2nu5e4a9bxm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm.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-
|
|
14
|
+
} from "./_node-chunks/chunk-VJSSX3A5.js";
|
|
15
15
|
import {
|
|
16
16
|
any
|
|
17
|
-
} from "./_node-chunks/chunk-
|
|
17
|
+
} from "./_node-chunks/chunk-52GSDTBX.js";
|
|
18
18
|
import {
|
|
19
19
|
DOCUMENTATION_LINK
|
|
20
|
-
} from "./_node-chunks/chunk-
|
|
20
|
+
} from "./_node-chunks/chunk-JD7SDFFJ.js";
|
|
21
21
|
import {
|
|
22
22
|
require_dist
|
|
23
|
-
} from "./_node-chunks/chunk-
|
|
23
|
+
} from "./_node-chunks/chunk-GCWONSEX.js";
|
|
24
24
|
import {
|
|
25
25
|
dirname,
|
|
26
26
|
join,
|
|
27
27
|
relative,
|
|
28
28
|
resolve
|
|
29
|
-
} from "./_node-chunks/chunk-
|
|
29
|
+
} from "./_node-chunks/chunk-HJUKMZMH.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-
|
|
39
|
+
} from "./_node-chunks/chunk-4JXZBSNX.js";
|
|
40
40
|
import {
|
|
41
41
|
__commonJS,
|
|
42
42
|
__toESM
|
|
43
|
-
} from "./_node-chunks/chunk-
|
|
43
|
+
} from "./_node-chunks/chunk-LSSCRN52.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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_2nu5e4a9bxm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_2nu5e4a9bxm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_2nu5e4a9bxm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_2nu5e4a9bxm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,10 +12,10 @@ var require = CJS_COMPAT_NODE_MODULE_bx09omj2pho.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
log,
|
|
14
14
|
noop
|
|
15
|
-
} from "./_node-chunks/chunk-
|
|
15
|
+
} from "./_node-chunks/chunk-ON6GQNXM.js";
|
|
16
16
|
import {
|
|
17
17
|
importMetaResolve
|
|
18
|
-
} from "./_node-chunks/chunk-
|
|
18
|
+
} from "./_node-chunks/chunk-VJSSX3A5.js";
|
|
19
19
|
import {
|
|
20
20
|
ADDON_ID,
|
|
21
21
|
COVERAGE_DIRECTORY,
|
|
@@ -24,19 +24,19 @@ import {
|
|
|
24
24
|
STORYBOOK_ADDON_TEST_CHANNEL,
|
|
25
25
|
TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME,
|
|
26
26
|
storeOptions
|
|
27
|
-
} from "./_node-chunks/chunk-
|
|
27
|
+
} from "./_node-chunks/chunk-JD7SDFFJ.js";
|
|
28
28
|
import {
|
|
29
29
|
require_picocolors
|
|
30
|
-
} from "./_node-chunks/chunk-
|
|
30
|
+
} from "./_node-chunks/chunk-KKIRYHWY.js";
|
|
31
31
|
import {
|
|
32
32
|
require_dist
|
|
33
|
-
} from "./_node-chunks/chunk-
|
|
33
|
+
} from "./_node-chunks/chunk-GCWONSEX.js";
|
|
34
34
|
import {
|
|
35
35
|
normalize
|
|
36
|
-
} from "./_node-chunks/chunk-
|
|
36
|
+
} from "./_node-chunks/chunk-HJUKMZMH.js";
|
|
37
37
|
import {
|
|
38
38
|
__toESM
|
|
39
|
-
} from "./_node-chunks/chunk-
|
|
39
|
+
} from "./_node-chunks/chunk-LSSCRN52.js";
|
|
40
40
|
|
|
41
41
|
// src/preset.ts
|
|
42
42
|
import { mkdir } from "node:fs/promises";
|
|
@@ -333,7 +333,7 @@ var experimental_serverChannel = async (channel, options) => {
|
|
|
333
333
|
});
|
|
334
334
|
store.onStateChange((state, previousState) => {
|
|
335
335
|
isEqual(selectCachedState(state), selectCachedState(previousState)) || fsCache.set("state", selectCachedState(state));
|
|
336
|
-
});
|
|
336
|
+
}), globalThis.__STORYBOOK_ADDON_VITEST_STORE__ = store;
|
|
337
337
|
let testProviderStore = experimental_getTestProviderStore(ADDON_ID);
|
|
338
338
|
if (store.subscribe("TRIGGER_RUN", (event, eventInfo) => {
|
|
339
339
|
testProviderStore.setState("test-provider-state:running"), store.setState((s) => ({
|
package/dist/preview.js
ADDED
|
@@ -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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_2nu5e4a9bxm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_2nu5e4a9bxm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_2nu5e4a9bxm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_2nu5e4a9bxm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm.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-
|
|
16
|
+
} from "../_node-chunks/chunk-LSSCRN52.js";
|
|
17
17
|
|
|
18
18
|
// ../../node_modules/tree-kill/index.js
|
|
19
19
|
var require_tree_kill = __commonJS({
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_2nu5e4a9bxm from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_2nu5e4a9bxm from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_2nu5e4a9bxm.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_2nu5e4a9bxm.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_2nu5e4a9bxm.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-KKIRYHWY.js";
|
|
15
15
|
import {
|
|
16
16
|
require_dist
|
|
17
|
-
} from "../_node-chunks/chunk-
|
|
17
|
+
} from "../_node-chunks/chunk-GCWONSEX.js";
|
|
18
18
|
import {
|
|
19
19
|
join,
|
|
20
20
|
normalize,
|
|
21
21
|
relative,
|
|
22
22
|
resolve,
|
|
23
23
|
sep
|
|
24
|
-
} from "../_node-chunks/chunk-
|
|
24
|
+
} from "../_node-chunks/chunk-HJUKMZMH.js";
|
|
25
25
|
import {
|
|
26
26
|
__commonJS,
|
|
27
27
|
__require,
|
|
28
28
|
__toESM
|
|
29
|
-
} from "../_node-chunks/chunk-
|
|
29
|
+
} from "../_node-chunks/chunk-LSSCRN52.js";
|
|
30
30
|
|
|
31
31
|
// ../../node_modules/braces/lib/utils.js
|
|
32
32
|
var require_utils = __commonJS({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-vitest",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-33206-sha-2fd88b76",
|
|
4
4
|
"description": "Storybook Vitest addon: Blazing fast component testing using stories",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -50,6 +50,10 @@
|
|
|
50
50
|
"./package.json": "./package.json",
|
|
51
51
|
"./postinstall": "./dist/postinstall.js",
|
|
52
52
|
"./preset": "./dist/preset.js",
|
|
53
|
+
"./preview": {
|
|
54
|
+
"types": "./dist/preview.d.ts",
|
|
55
|
+
"default": "./dist/preview.js"
|
|
56
|
+
},
|
|
53
57
|
"./vitest": "./dist/node/vitest.js",
|
|
54
58
|
"./vitest-plugin": {
|
|
55
59
|
"types": "./dist/vitest-plugin/index.d.ts",
|
|
@@ -103,7 +107,7 @@
|
|
|
103
107
|
"@vitest/browser": "^3.0.0 || ^4.0.0",
|
|
104
108
|
"@vitest/browser-playwright": "^4.0.0",
|
|
105
109
|
"@vitest/runner": "^3.0.0 || ^4.0.0",
|
|
106
|
-
"storybook": "^0.0.0-pr-
|
|
110
|
+
"storybook": "^0.0.0-pr-33206-sha-2fd88b76",
|
|
107
111
|
"vitest": "^3.0.0 || ^4.0.0"
|
|
108
112
|
},
|
|
109
113
|
"peerDependenciesMeta": {
|
package/preview.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/preview.js';
|