rsnext/examples/with-vitest
Lee Robinson 7a256e657b
Update Jest and Vitest example for App Router. (#54989)
Building off https://github.com/vercel/next.js/pull/54891, updates the `with-jest` and `with-vitest` examples with updated packages and App Router tests.
2023-09-05 13:31:47 +00:00
..
__tests__ Update Jest and Vitest example for App Router. (#54989) 2023-09-05 13:31:47 +00:00
app Update Jest and Vitest example for App Router. (#54989) 2023-09-05 13:31:47 +00:00
pages Open deploy link in new window for examples (#40804) 2022-09-22 09:33:36 -07:00
public Add Vitest example. (#35858) 2022-04-04 18:25:56 +00:00
styles Add Vitest example. (#35858) 2022-04-04 18:25:56 +00:00
.gitignore Remove incorrect entries for pnpm debug log (#47241) 2023-03-26 22:26:05 -07:00
next-env.d.ts Remove incorrect entries for pnpm debug log (#47241) 2023-03-26 22:26:05 -07:00
package.json Update Jest and Vitest example for App Router. (#54989) 2023-09-05 13:31:47 +00:00
README.md Update Jest and Vitest example for App Router. (#54989) 2023-09-05 13:31:47 +00:00
tsconfig.json Add Vitest example. (#35858) 2022-04-04 18:25:56 +00:00
vitest.config.ts Remove unnecessary type reference in Vitest example (#39819) 2022-08-22 09:18:40 -05: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