Skip to content

Commit adddf52

Browse files
Merge pull request #2042 from analogjs/beta
chore: release 2.2.2
2 parents 1b74e06 + 5799698 commit adddf52

File tree

23 files changed

+314
-67
lines changed

23 files changed

+314
-67
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [2.2.2-beta.1](https://github.com/analogjs/analog/compare/v2.2.1...v2.2.2-beta.1) (2026-01-08)
2+
3+
### Bug Fixes
4+
5+
- **storybook-angular:** use vite config root when angularBuilderContext unavailable ([#2033](https://github.com/analogjs/analog/issues/2033)) ([76cfb94](https://github.com/analogjs/analog/commit/76cfb948c2571bf21522d185d4dc43fa4e4c121e))
6+
17
## [2.2.1](https://github.com/analogjs/analog/compare/v2.2.0...v2.2.1) (2026-01-05)
28

39
### Bug Fixes

apps/docs-app/docs/integrations/storybook/index.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,3 +317,147 @@ Adding the replacement files to `files` array in the `tsconfig.app.json` may als
317317
"files": ["src/main.ts", "src/main.server.ts", "src/two.ts"]
318318
}
319319
```
320+
321+
## Setting up Vitest for Interaction Testing
322+
323+
Storybook also supports using Vitest for testing component interactions.
324+
325+
### Installing Packages
326+
327+
Install the Vitest addon and dependencies:
328+
329+
```sh
330+
npm install @analogjs/vitest-angular @storybook/addon-vitest vitest @vitest/browser-playwright --save-dev
331+
```
332+
333+
### Add Vitest Add-on
334+
335+
Add the addon to your `.storybook/main.ts`:
336+
337+
```ts
338+
import { StorybookConfig } from '@analogjs/storybook-angular';
339+
340+
const config: StorybookConfig = {
341+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
342+
addons: [
343+
'@storybook/addon-essentials',
344+
'@storybook/addon-interactions',
345+
'@storybook/addon-vitest',
346+
],
347+
framework: {
348+
name: '@analogjs/storybook-angular',
349+
options: {},
350+
},
351+
};
352+
353+
export default config;
354+
```
355+
356+
### Setup Vitest Configuration
357+
358+
Create a `.storybook/vitest.setup.ts` file:
359+
360+
```ts
361+
import '@angular/compiler';
362+
import { setProjectAnnotations } from '@analogjs/storybook-angular/testing';
363+
import { beforeAll } from 'vitest';
364+
import * as projectAnnotations from './preview';
365+
366+
const project = setProjectAnnotations([projectAnnotations]);
367+
368+
beforeAll(project.beforeAll);
369+
```
370+
371+
Update `.storybook/tsconfig.json` to include the setup file:
372+
373+
```json
374+
{
375+
"extends": "../tsconfig.app.json",
376+
"compilerOptions": {
377+
"types": ["node"],
378+
"allowSyntheticDefaultImports": true,
379+
"resolveJsonModule": true
380+
},
381+
"exclude": ["../src/test.ts", "../src/**/*.spec.ts"],
382+
"include": ["../src/**/*.stories.*", "./preview.ts", "./vitest.setup.ts"],
383+
"files": ["./typings.d.ts"]
384+
}
385+
```
386+
387+
Create a `vitest.config.ts` file in your project root, or add a `storybook` project to your existing `vite.config.ts`:
388+
389+
```ts
390+
/// <reference types="vitest/config" />
391+
import { defineConfig } from 'vite';
392+
import path from 'node:path';
393+
import { fileURLToPath } from 'node:url';
394+
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
395+
import { playwright } from '@vitest/browser-playwright';
396+
397+
const dirname =
398+
typeof __dirname !== 'undefined'
399+
? __dirname
400+
: path.dirname(fileURLToPath(import.meta.url));
401+
402+
export default defineConfig({
403+
test: {
404+
projects: [
405+
{
406+
extends: true,
407+
plugins: [
408+
storybookTest({
409+
configDir: path.join(dirname, '.storybook'),
410+
}),
411+
],
412+
test: {
413+
name: 'storybook',
414+
browser: {
415+
enabled: true,
416+
headless: true,
417+
provider: playwright(),
418+
instances: [{ browser: 'chromium' }],
419+
},
420+
setupFiles: ['.storybook/vitest.setup.ts'],
421+
},
422+
},
423+
],
424+
},
425+
});
426+
```
427+
428+
### Installing Playwright
429+
430+
Install Playwright browser binaries:
431+
432+
```sh
433+
npx playwright install chromium
434+
```
435+
436+
### Running Component Tests
437+
438+
Add the `test-storybook` target to your `angular.json`:
439+
440+
```json
441+
"test-storybook": {
442+
"builder": "@analogjs/vitest-angular:test",
443+
"options": {
444+
"configFile": "vitest.config.ts"
445+
}
446+
}
447+
```
448+
449+
Add a test script to your `package.json`:
450+
451+
```json
452+
"scripts": {
453+
"test-storybook": "ng run your-app:test-storybook"
454+
}
455+
```
456+
457+
Run your interaction tests with:
458+
459+
```sh
460+
npm run test-storybook
461+
```
462+
463+
You can also run tests directly in the Storybook UI. Start Storybook and use the "Run Tests" button in the sidebar, or navigate to a story to see interaction tests run automatically in the Interactions panel.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "analogjs-platform",
3-
"version": "2.2.1",
3+
"version": "2.2.2-beta.1",
44
"license": "MIT",
55
"type": "module",
66
"scripts": {

packages/astro-angular/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@analogjs/astro-angular",
3-
"version": "2.2.1",
3+
"version": "2.2.2-beta.1",
44
"description": "Use Angular components within Astro",
55
"type": "module",
66
"author": "Brandon Roberts <[email protected]>",
@@ -32,7 +32,7 @@
3232
"url": "https://github.com/sponsors/brandonroberts"
3333
},
3434
"dependencies": {
35-
"@analogjs/vite-plugin-angular": "^2.2.1"
35+
"@analogjs/vite-plugin-angular": "^2.2.2-beta.1"
3636
},
3737
"peerDependencies": {
3838
"@angular/build": ">=20.0.0",

packages/content/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@analogjs/content",
3-
"version": "2.2.1",
3+
"version": "2.2.2-beta.1",
44
"description": "Content Rendering for Analog",
55
"type": "module",
66
"author": "Brandon Roberts <[email protected]>",

packages/create-analog/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-analog",
3-
"version": "2.2.1",
3+
"version": "2.2.2-beta.1",
44
"type": "module",
55
"license": "MIT",
66
"author": "Brandon Roberts",

packages/create-analog/template-angular-v17/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"test": "ng test"
1616
},
1717
"dependencies": {
18-
"@analogjs/content": "^2.2.1",
19-
"@analogjs/router": "^2.2.1",
18+
"@analogjs/content": "^2.2.2-beta.1",
19+
"@analogjs/router": "^2.2.2-beta.1",
2020
"@angular/animations": "^17.2.0",
2121
"@angular/common": "^17.2.0",
2222
"@angular/compiler": "^17.2.0",
@@ -38,9 +38,9 @@
3838
"zone.js": "~0.14.0"
3939
},
4040
"devDependencies": {
41-
"@analogjs/platform": "^2.2.1",
42-
"@analogjs/vite-plugin-angular": "^2.2.1",
43-
"@analogjs/vitest-angular": "^2.2.1",
41+
"@analogjs/platform": "^2.2.2-beta.1",
42+
"@analogjs/vite-plugin-angular": "^2.2.2-beta.1",
43+
"@analogjs/vitest-angular": "^2.2.2-beta.1",
4444
"@angular-devkit/build-angular": "^17.2.0",
4545
"@angular/cli": "^17.2.0",
4646
"@angular/compiler-cli": "^17.2.0",

packages/create-analog/template-angular-v18/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
},
1616
"private": true,
1717
"dependencies": {
18-
"@analogjs/content": "^2.2.1",
19-
"@analogjs/router": "^2.2.1",
18+
"@analogjs/content": "^2.2.2-beta.1",
19+
"@analogjs/router": "^2.2.2-beta.1",
2020
"@angular/animations": "^18.0.0",
2121
"@angular/build": "^18.0.0",
2222
"@angular/common": "^18.0.0",
@@ -38,9 +38,9 @@
3838
"zone.js": "~0.14.3"
3939
},
4040
"devDependencies": {
41-
"@analogjs/platform": "^2.2.1",
42-
"@analogjs/vite-plugin-angular": "^2.2.1",
43-
"@analogjs/vitest-angular": "^2.2.1",
41+
"@analogjs/platform": "^2.2.2-beta.1",
42+
"@analogjs/vite-plugin-angular": "^2.2.2-beta.1",
43+
"@analogjs/vitest-angular": "^2.2.2-beta.1",
4444
"@angular/cli": "^18.0.0",
4545
"@angular/compiler-cli": "^18.0.0",
4646
"jsdom": "^22.0.0",

packages/create-analog/template-angular-v19/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
},
1616
"private": true,
1717
"dependencies": {
18-
"@analogjs/content": "^2.2.1",
19-
"@analogjs/router": "^2.2.1",
18+
"@analogjs/content": "^2.2.2-beta.1",
19+
"@analogjs/router": "^2.2.2-beta.1",
2020
"@angular/animations": "^19.0.0",
2121
"@angular/common": "^19.0.0",
2222
"@angular/compiler": "^19.0.0",
@@ -37,9 +37,9 @@
3737
"zone.js": "~0.15.0"
3838
},
3939
"devDependencies": {
40-
"@analogjs/platform": "^2.2.1",
41-
"@analogjs/vite-plugin-angular": "^2.2.1",
42-
"@analogjs/vitest-angular": "^2.2.1",
40+
"@analogjs/platform": "^2.2.2-beta.1",
41+
"@analogjs/vite-plugin-angular": "^2.2.2-beta.1",
42+
"@analogjs/vitest-angular": "^2.2.2-beta.1",
4343
"@angular-devkit/build-angular": "^19.0.0",
4444
"@angular/build": "^19.0.0",
4545
"@angular/cli": "^19.0.0",

packages/create-analog/template-angular-v20/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
},
1717
"private": true,
1818
"dependencies": {
19-
"@analogjs/content": "^2.2.1",
20-
"@analogjs/router": "^2.2.1",
19+
"@analogjs/content": "^2.2.2-beta.1",
20+
"@analogjs/router": "^2.2.2-beta.1",
2121
"@angular/animations": "^20.0.0",
2222
"@angular/common": "^20.0.0",
2323
"@angular/compiler": "^20.0.0",
@@ -37,9 +37,9 @@
3737
"zone.js": "~0.15.0"
3838
},
3939
"devDependencies": {
40-
"@analogjs/platform": "^2.2.1",
41-
"@analogjs/vite-plugin-angular": "^2.2.1",
42-
"@analogjs/vitest-angular": "^2.2.1",
40+
"@analogjs/platform": "^2.2.2-beta.1",
41+
"@analogjs/vite-plugin-angular": "^2.2.2-beta.1",
42+
"@analogjs/vitest-angular": "^2.2.2-beta.1",
4343
"@angular-devkit/build-angular": "^20.0.0",
4444
"@angular/build": "^20.0.0",
4545
"@angular/cli": "^20.0.0",

0 commit comments

Comments
 (0)