A JavaScript project that has some unit tests tested with the testing framework Jest.
Initialize and create a package.json file.
npm init
Install Jest.
npm install --save-dev jest
Modify the package.json file and place our own script that will run test suite using jest.
"scripts": {
"test": "jest"
}
Modify the package.json file and add the following so we generate a report for Codecov.
"jest": {
"coverageDirectory": "./coverage/",
"collectCoverage": true
}
npm test
Getting started with Jest
- link.
Intro to Testing Vanilla JS with Jest