Files
tripleo-ui/docs/testing.rst
Honza Pokorny 0567f65929 Use prettier for linting
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
2017-05-12 11:47:54 -03:00

1.1 KiB

Testing

Single test run

  • npm test (alternatively run karma start --single-run)
  • npm run lint to run prettier

Tests during development

Start Karma to run tests after every change npm run test:watch.

Debugging tests

  1. option
  • use console.log in the test and see the output in karma server output
  1. 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.js and package.json as part of your patch