-
Notifications
You must be signed in to change notification settings - Fork 0
Development: Testing
To test our application we used the framework Jest for both front- and backend. To test the React components, we used the GUI testing framework in addition to Jest.
For the express server application, we achieved a test coverage of 91%. For the frontend React application 85% of the code was covered, resulting in an overall project test coverage of about 87%.
The test files are in the same folder as the file they are testing and end in .test.js.
For continous integration we are using Travis CI. For test coverage we are using Codecov. We test ZHAWo before each push and enforced a consistent coding style with prettier using git hooks.
Husky is a Git hooks libary.
Set up:
In root folder install husky using npm.
npm install --save-dev husky
Make sure jest, prettier and pretty-quick are already installed.
Add to package.json:
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged ",
"pre-push": "npm run test-both"
}
}
Now prettier rules will be enforced on each commit and will only be pushed if all the tests pass.