Run the code through eslint and prettier. Eslint checks structural things (e.g. console.log), and prettier checks stylistic things. The "npm run lint" script will fail if your code isn't properly formatted with prettier. You can use "npm run prettier" to format your code. Change-Id: Ie44e17d29e59cb4e3089ade2fb2b20f8213b5853
1.1 KiB
1.1 KiB
Testing
Single test run
npm test(alternatively runkarma start --single-run)npm run lintto run prettier
Tests during development
Start Karma to run tests after every change
npm run test:watch.
Debugging tests
- option
- use
console.login the test and see the output in karma server output
- option
- install karma-chrome-launcher npm module
npm install karma-chrome-launcher --save-dev- replace/add 'Chrome' to browsers in
karma.conf.js- now Karma will launch Chrome to run the tests
- use
debugger;statement in test code to add breakpoints- in Karma Chrome window click 'debug' button and debug in chrome developer tools as usual
- optionally you can use karma-jasmine-html-reporter for better test output
- make sure you don't push those changes to
karma.conf.jsandpackage.jsonas part of your patch