Command
test
Is this a regression?
The previous version in which this bug was not present was
No response
Description
Storybook has support for running component tests using Vitest. When trying to build a POC with the unit-test builder, I ran into two issues.
- Storybook can't transform the stories because the compiled code leads to file with just an
import as its contents.
- Making changes to files that aren't in the
include array doesn't trigger tests to be re-run.
I was able to work around the code import issue with a plugin that re-exports the chunks from compiled files
https://github.com/brandonroberts/angular-storybook-vitest/blob/main/vitest-storybook-base.config.ts#L16
Minimal Reproduction
https://github.com/brandonroberts/angular-storybook-vitest
- Clone and install dependencies
- Run
npm run test-storybook
- Note the tests pass
- Make a change in one of the
src/stories/*.stories.ts files
- Note the build re-compiles but the tests aren't re-run.
The test-storybook target excludes the stories files because of the import issue so they are transpiled as-is.
https://github.com/brandonroberts/angular-storybook-vitest/blob/main/angular.json#L94
Exception or Error
Your Environment
Anything else relevant?
No response
Command
test
Is this a regression?
The previous version in which this bug was not present was
No response
Description
Storybook has support for running component tests using Vitest. When trying to build a POC with the
unit-testbuilder, I ran into two issues.importas its contents.includearray doesn't trigger tests to be re-run.I was able to work around the code import issue with a plugin that re-exports the chunks from compiled files
https://github.com/brandonroberts/angular-storybook-vitest/blob/main/vitest-storybook-base.config.ts#L16
Minimal Reproduction
https://github.com/brandonroberts/angular-storybook-vitest
npm run test-storybooksrc/stories/*.stories.tsfilesThe
test-storybooktarget excludes thestoriesfiles because of the import issue so they are transpiled as-is.https://github.com/brandonroberts/angular-storybook-vitest/blob/main/angular.json#L94
Exception or Error
Your Environment
Anything else relevant?
No response