Skip to content

Commit 278022e

Browse files
authored
chore: improved storybook prefetching (#660)
1 parent d48fa3a commit 278022e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,4 @@ jobs:
5353
- run: pnpm install --frozen-lockfile
5454
- run: pnpm exec playwright install chromium
5555
- run: pnpm build
56-
# prefetch the storybook cli to reduce fetching errors in tests
57-
- run: pnpx create-storybook@latest --version
5856
- run: pnpm test

packages/addons/_tests/storybook/test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import process from 'node:process';
2+
import { execSync } from 'node:child_process';
23
import { expect } from '@playwright/test';
4+
import { beforeAll } from 'vitest';
35
import { setupTest } from '../_setup/suite.ts';
46
import storybook from '../../storybook/index.ts';
57
import eslint from '../../eslint/index.ts';
@@ -9,6 +11,13 @@ const { test, variants, prepareServer } = setupTest({ storybook, eslint });
911

1012
let port = 6006;
1113

14+
beforeAll(() => {
15+
if (process.env.CI) {
16+
// prefetch the storybook cli during ci to reduce fetching errors in tests
17+
execSync('pnpx create-storybook@latest --version');
18+
}
19+
});
20+
1221
test.for(variants)(
1322
'storybook loaded - %s',
1423
{ concurrent: !process.env.CI },

0 commit comments

Comments
 (0)