Tests are an important part of coding. Please refer to the following instructions when contributing to the repository.
Ensure you're on Node v10 If you need help updating, please see NVM. ❤️ NVM.
Please refer to screenshot tests.
We use:
To run a single instance of the tests, run:
npm run test:unit
To run the tests with a debugger in Chrome:
npm run test:watch
Click on the big DEBUG button in the top righthand corner. In the new tab that Chrome opens, you can open the developer tools and debug per usual.
We use Istanbul to report and check code coverage. To build the coverage report, please run the unit tests npm run test:unit
. This will create a coverage/
directory in the root of the project. Open ./coverage/Chrome <version_number>/index.html
. This will show a screen like:
We aim for:
- Statements: 95%
- Branches: 95%
- Functions: 95%
- Lines: 95%
If they do not meet these requirements, we will ask to increase test coverage.
Below is a list of the Eslint standards:
To run lint:
npm run lint
This will print any lines that do not follow the eslint standards, which you will need to fix before opeing a PR.
Due to multiple issues in production type files an easy way to validate production type files has been added:
npm run test:types
This command will perform a full production build, install the locally built versions, generate a file that imports them all, and then build it to expose any issues in the locally built .d.ts
files.