next.js + tests + vercel deployment
- 1 minutes readI gave a presentation at the SagLacIO on how to setup jest testing in NextJS and deploy with Vercel.
Example project
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 bynpm run test(akanext test)jest.config.js: thejestconfig.babelrc: thebabelconfigtests/index.test.js: The test being executed.gitlab-ci.yml: The file telling gitlab-ci to run the build and the tests
The real solution
Thanks 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
🎉
Links from the presentation
- https://tlm.ninja/
- https://totemastudio.com/
- https://nextjs.org/docs
- https://medium.com/frontend-digest/setting-up-testing-library-with-nextjs-a9702cbde32d
- https://jestjs.io/
- https://github.com/keyz/identity-obj-proxy
- https://medium.com/@nate.d.gage/configuring-jest-with-next-js-6670f0026dd9
- https://stackoverflow.com/questions/62690747/next-js-api-is-back-end
- https://vercel.com/
- https://gitlab.com/gableroux/my-awesome-next-app
- https://my-awesome-next-app.vercel.app/
If you have suggestions, feel free to poke me or open an issue.