Add `vitest init` like `storybook init`
Clear and concise description of the problem
There are so many different ways to set it up that it can be confusing.
Suggested solution
Storybook has show one solution.
This has auto generation feature of .storybook/* and src/stories/*.
And then, auto detect TS or JS, and auto edit package.json.
Auto generate feature of vitest.config.ts like pnpm dlx vitest@latest init.
It would be convenient if it were there.
Alternative
If this is not within the scope of what vitest should do, or if vitest already has this functionality, please close this issue.
Additional context
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
What would this package actually do?
As far as I know, @storybook/builder-vite was a separate package that was used to integrate Vite into Storybook. Nowadays it's no longer needed as it's built-in into Storybook. Using this logic I have no idea what @vitest/builder-vite would do. Integrate Vite into Vitest? 😕
@AriPerkkio Maybe I was tired when I post this issue. I was seeing this command pnpm dlx storybook@latest init , auto generate .storybook folder and src/stories. I will rewrite Issue.
It looks like Jest has jest --init https://jestjs.io/docs/cli#--init and it's recently moved to create-jest package https://github.com/jestjs/jest/pull/14453
This essentially just ask 5 questions https://github.com/jestjs/jest/blob/7e33cd77ccab163ea525f5c7b45c3c48a3458630/packages/create-jest/src/questions.ts#L10-L50 and I'm not so sure if it's practically useful.
I think having the examples https://vitest.dev/guide/#examples https://github.com/vitest-dev/vitest/blob/main/examples/README.md is easier to maintain and practically more useful, so maybe we just need to tweak documentations so that new users can discover it easily.
Btw, I just found that create-vitest package is already taken by https://github.com/dolanmiu/create-vitest/ But it doesn't look like this one generates config file vitest.config.ts.
As a team, we decided that it would require too much maintenance on our side to support this. We believe that frameworks themselves should integrate testing scaffolding since it is very dependent on the codebase.
If you just need a simple example of a javascript application, you can already use existing examples: https://vitest.dev/guide/#examples