A simple example of how to use Jest to test pure JS + HTML page. With testing using jest-fetch-mock to test fetch calls.
Just clone this repo! Then use npm install
to install all needed packages.
All tests are located in __tests__
folder and you can change Jest's global variable setting in setupJest.js
Run npm test
to go through all tests. Default is set as jest --watch
, you can change this behaviour in package.json
.
All coverage report located in coverage
folder and reports are generated by Jest. Run npm run coverage
to get the latest coverage report.
Demo of HTML: View here