Skip to content

Commit 31d9a16

Browse files
feat: add configuration for Storybook with Vitest addon (#21)
1 parent 27fe953 commit 31d9a16

File tree

10 files changed

+11542
-5777
lines changed

10 files changed

+11542
-5777
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,18 @@ jobs:
1919
run: npm install
2020
- name: Build
2121
run: npm run build-storybook
22+
23+
test-windows:
24+
runs-on: windows-latest
25+
steps:
26+
- uses: actions/checkout@v3
27+
- uses: actions/setup-node@v3
28+
with:
29+
node-version: 22
30+
- run: corepack enable
31+
- name: Install
32+
run: npm install
33+
- name: Playwright Install
34+
run: npx playwright install
35+
- name: Test Storybook
36+
run: npm run test-storybook

.storybook/main.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import { StorybookConfig } from '@analogjs/storybook-angular';
22

33
const config: StorybookConfig = {
44
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
5-
addons: ["@storybook/addon-links", "@storybook/addon-docs"],
5+
addons: [
6+
"@storybook/addon-links",
7+
"@storybook/addon-docs",
8+
"@storybook/addon-vitest"
9+
],
610
framework: {
711
name: "@analogjs/storybook-angular",
812
options: {},

.storybook/preview.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
import 'zone.js';
2-
import { applicationConfig, type Preview } from '@analogjs/storybook-angular';
2+
import { type Preview } from '@analogjs/storybook-angular';
33
import { setCompodocJson } from '@storybook/addon-docs/angular';
4-
import { provideNoopAnimations } from '@angular/platform-browser/animations';
54
import docJson from '../documentation.json';
65
setCompodocJson(docJson);
76

87
const preview: Preview = {
9-
decorators: [
10-
applicationConfig({
11-
providers: [provideNoopAnimations()]
12-
})
13-
],
8+
decorators: [],
149

1510
parameters: {
1611
controls: {

.storybook/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
"resolveJsonModule": true
77
},
88
"exclude": ["../src/test.ts", "../src/**/*.spec.ts"],
9-
"include": ["../src/**/*", "./preview.ts"],
9+
"include": ["../src/**/*", "./preview.ts", "./vitest.setup.ts"],
1010
"files": ["./typings.d.ts"]
1111
}

.storybook/vitest.setup.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { beforeAll } from 'vitest';
2+
import { setProjectAnnotations } from '@analogjs/storybook-angular/testing';
3+
4+
import * as projectAnnotations from './preview';
5+
6+
const annotations = setProjectAnnotations([projectAnnotations]);
7+
8+
// Run Storybook's beforeAll hook
9+
beforeAll(annotations.beforeAll);

angular.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@
116116
],
117117
"outputDir": "storybook-static"
118118
}
119+
},
120+
"test-storybook": {
121+
"builder": "@analogjs/vitest-angular:test"
119122
}
120123
}
121124
}

0 commit comments

Comments
 (0)