vouchington-tooling 0.80.2 → 0.81.0
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/README.md
CHANGED
|
@@ -993,6 +993,11 @@ random suffixes, viewport sizes, a 1x1 PNG fixture, RFC 6238 TOTP codes, and a t
|
|
|
993
993
|
reporter. The reporter prints one JSON line per test with the marker `playwright-test-lifecycle`.
|
|
994
994
|
`@playwright/test` is an optional peer. TOTP setup and cleanup stay with the caller.
|
|
995
995
|
|
|
996
|
+
`storybookBundleHasStory` returns `false` for a readable index without the requested story.
|
|
997
|
+
An index request failure or non-OK HTTP response throws `StorybookIndexAccessError`, with
|
|
998
|
+
`kind` (`request` or `http`) and an HTTP `status` when available. Its diagnostic omits request
|
|
999
|
+
credentials and response bodies. Malformed JSON remains a hard failure.
|
|
1000
|
+
|
|
996
1001
|
`createBrowserErrorsFixture`, `withMonitoredPage`, and `BrowserIssueMonitor` take the narrow
|
|
997
1002
|
exported `MonitoredTestInfo` type (`attach`, `status`, `expectedStatus`, `timeout`) instead of
|
|
998
1003
|
Playwright's full `TestInfo`. A real `TestInfo` is assignable to it, so no cast is needed.
|
|
@@ -23,7 +23,7 @@ export { assertNoHorizontalScroll, getHorizontalOverflowState } from './mobile-a
|
|
|
23
23
|
export type { HorizontalOverflowState } from './mobile-assertions.mts';
|
|
24
24
|
export { openRadixDropdown } from './radix-select.mts';
|
|
25
25
|
export { randomSuffix } from './random-id.mts';
|
|
26
|
-
export { storybookBundleHasStory } from './storybook.mts';
|
|
26
|
+
export { StorybookIndexAccessError, storybookBundleHasStory } from './storybook.mts';
|
|
27
27
|
export { TEST_PNG } from './test-fixtures.mts';
|
|
28
28
|
export { TestLifecycleReporter };
|
|
29
29
|
export type { TestLifecycleReporterOptions } from './test-lifecycle-reporter.mts';
|
|
@@ -14,7 +14,7 @@ export { installImageResponseGuard } from "./expect-no-broken-images.mjs";
|
|
|
14
14
|
export { assertNoHorizontalScroll, getHorizontalOverflowState } from "./mobile-assertions.mjs";
|
|
15
15
|
export { openRadixDropdown } from "./radix-select.mjs";
|
|
16
16
|
export { randomSuffix } from "./random-id.mjs";
|
|
17
|
-
export { storybookBundleHasStory } from "./storybook.mjs";
|
|
17
|
+
export { StorybookIndexAccessError, storybookBundleHasStory } from "./storybook.mjs";
|
|
18
18
|
export { TEST_PNG } from "./test-fixtures.mjs";
|
|
19
19
|
export { TestLifecycleReporter };
|
|
20
20
|
export { generateTotpCode } from "./totp.mjs";
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { Page } from '@playwright/test';
|
|
2
|
+
export declare class StorybookIndexAccessError extends Error {
|
|
3
|
+
readonly kind: 'request' | 'http';
|
|
4
|
+
readonly status: number | undefined;
|
|
5
|
+
constructor(status?: number);
|
|
6
|
+
}
|
|
2
7
|
export declare function storybookBundleHasStory(page: Page, id: string): Promise<boolean>;
|
|
@@ -1,13 +1,28 @@
|
|
|
1
|
+
const INDEX_PATH = '/storybook/index.json';
|
|
2
|
+
const REQUEST_TIMEOUT_MS = 5000;
|
|
3
|
+
export class StorybookIndexAccessError extends Error {
|
|
4
|
+
kind;
|
|
5
|
+
status;
|
|
6
|
+
constructor(status) {
|
|
7
|
+
super(status === undefined
|
|
8
|
+
? `Storybook index ${INDEX_PATH} request failed (timeout bound: ${REQUEST_TIMEOUT_MS} ms)`
|
|
9
|
+
: `Storybook index ${INDEX_PATH} returned HTTP ${status}`);
|
|
10
|
+
this.name = 'StorybookIndexAccessError';
|
|
11
|
+
this.kind = status === undefined ? 'request' : 'http';
|
|
12
|
+
this.status = status;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
1
15
|
export async function storybookBundleHasStory(page, id) {
|
|
2
16
|
let response;
|
|
3
17
|
try {
|
|
4
|
-
response = await page.request.get(
|
|
18
|
+
response = await page.request.get(INDEX_PATH, { timeout: REQUEST_TIMEOUT_MS });
|
|
5
19
|
}
|
|
6
20
|
catch {
|
|
7
|
-
|
|
21
|
+
// Playwright transport errors can contain request URLs and headers with credentials.
|
|
22
|
+
throw new StorybookIndexAccessError();
|
|
8
23
|
}
|
|
9
24
|
if (!response.ok())
|
|
10
|
-
|
|
25
|
+
throw new StorybookIndexAccessError(response.status());
|
|
11
26
|
const storyIndex = (await response.json());
|
|
12
27
|
return id in (storyIndex.entries ?? {});
|
|
13
28
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vouchington-tooling",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.81.0",
|
|
4
4
|
"description": "Vouchington CLI and extractable tooling libraries.",
|
|
5
5
|
"homepage": "https://github.com/vouchington/vouchington-tooling/tree/main/packages/vouchington-tooling#readme",
|
|
6
6
|
"bugs": {
|
|
Binary file
|