I gave a presentation at the SagLacIO on how to setup jest testing in NextJS and deploy with Vercel.
The following project was created as part of this presentation:
The files you should be interested in:
package.json
: package versions and commandssetupTests.js
: The config used by npm run test
(aka next test
)jest.config.js
: the jest
config.babelrc
: the babel
configtests/index.test.js
: The test being executed.gitlab-ci.yml
: The file telling gitlab-ci to run the build and the testsThanks to @m0xx for pointing this out; Use NextJS examples directly instead:
https://github.com/vercel/next.js/tree/master/examples/with-jest
npx create-next-app --example with-jest with-jest-app
π
If you have suggestions, feel free to poke me or open an issue.