A simple example using NextJS 12, typescript and ava without unnecessary transpilation.
This is a Next.js project bootstrapped with
create-next-app
.
- Write ava tests in typescript
- Test against NextJS API endpoints or pages
- No compile directory (
dist
/build
) to worry about in development - Full NextJS middleware support in tests
- Tests can run in isolation in parallel
- Automatic/simple server teardown
dev
- Run the NextJS development serverbuild
- Build the NextJS static applicationstart
- Run the NextJS production buildtest
- Run ava tests
- Run individual test file -
yarn run ava ./tests/ava.test.ts
First, run the development server:
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.
See nextjs-fixture
See hello.test.ts