feat(cli): add Vitest as a testing framework option#282
Open
gonzoblasco wants to merge 2 commits into
Open
Conversation
- Add vitest plugin with devDep, scripts (test, test:watch, test:ci), and vitest.config.ts - Add --vitest flag to CLI - Register vitestPlugin in setup - Add vitest to technologies sort order - Add test:watch and test:ci to scripts sort order
|
@gonzoblasco is attempting to deploy a commit to the 9ty Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for Vitest (#224)
Closes #224
Summary
Adds Vitest as a testing framework option via
--vitestflag. When enabled, the generated project includes Vitest as a devDependency, test scripts, and avitest.config.tsfile.Changes
vitest.tswith:vitest@^4.0.0as devDependency (matching the version used internally by create-next-stack itself)test(vitest run),test:watch(vitest),test:ci(vitest run --reporter=verbose)vitest.config.tsgenerated withdefineConfigandenvironment: "node"--vitest(boolean)vitestPluginadded tosetup.tsvitestadded to technologies,test:watchandtest:ciadded to scriptsWhy
Vitest is the modern standard for testing in Vite-powered Next.js projects. Notably, create-next-stack itself already uses Vitest internally for its own test suite, but did not offer it as an option in the scaffold. This PR closes that gap.
Verification
pnpm run build— cleanpnpm run lint— no errorspnpm run unit— 9/9 tests pass./bin/run --helpshows--vitestflagNotes
vitest.config.tsusesenvironment: "node"as a sensible default. Users can customize it for DOM testing (jsdom/happy-dom) as needed.