rsnext/examples/with-vitest
2024-05-08 21:47:14 +02:00
..
__tests__ chore(examples): use default prettier for examples/templates (#60530) 2024-01-11 16:01:44 -07:00
app chore(examples): use default prettier for examples/templates (#60530) 2024-01-11 16:01:44 -07:00
pages chore(examples): use default prettier for examples/templates (#60530) 2024-01-11 16:01:44 -07:00
public Add Vitest example. (#35858) 2022-04-04 18:25:56 +00:00
styles chore: update prettier to 3.2.5 (#65092) 2024-05-08 21:47:14 +02:00
.gitignore Add .yarn/install-state.gz to .gitignore (#56637) 2023-10-18 16:34:48 +00:00
next-env.d.ts Remove incorrect entries for pnpm debug log (#47241) 2023-03-26 22:26:05 -07:00
package.json Docs: Fix formatting in testing docs and update examples dependencies (#59572) 2023-12-13 07:02:53 -08:00
README.md Update Jest and Vitest example for App Router. (#54989) 2023-09-05 13:31:47 +00:00
tsconfig.json Docs: Add App Router Testing Guides and update /examples (#59268) 2023-12-12 22:30:23 -06:00
vitest.config.ts chore(examples): use default prettier for examples/templates (#60530) 2024-01-11 16:01:44 -07:00

Vitest

This example shows how to use Vitest with Next.js.

This includes Next.js' built-in support for Global CSS, CSS Modules and TypeScript. This example also shows how to use Vitest with the App Router and React Server Components.

Note: Since tests can be co-located alongside other files inside the App Router, we have placed those tests in app/ to demonstrate this behavior (which is different than pages/). You can still place all tests in __tests__ if you prefer.

Deploy your own

Deploy with Vercel

How to use

Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:

npx create-next-app --example with-vitest with-vitest-app
yarn create next-app --example with-vitest with-vitest-app
pnpm create next-app --example with-vitest with-vitest-app

Deploy it to the cloud with Vercel (Documentation).

Running Tests

npm test