Using Karma/ with CircleCI
At Distill we began using AngularJS, and went with Testacular/Karma for our testing needs. To get this working on CircleCI, I played around with circle.yml file a little bit and came up with this:
test:
pre:
- npm install -g karma
- nohup bash -c "karma start spec/javascripts/testacular.conf.js &"
override:
- bundle exec rspec spec
- karma run
The downside here is that the npm install -g karma step added almost 30 seconds to the total test suite. It's possible there might be ways to speed this up using caching between runs, but I haven't gotten around to looking into this yet.
Written by Hwan-Joon Choi
Related protips
2 Responses
Two comment:
Installing dependencies as Karma should be installed in dependencies section.
To avoid installing karma each time, juste add cache section in dependencies section.
Ex of circle.yml :
dependencies:
pre:
- npm install -g karma
cache_directories:
- ~/nvm./node_modules/karma/bin/karma start --single-run --browsers PhantomJS
Have a fresh tip? Share with Coderwall community!
AngularJS pages are long-lived browser apps with the same script risk as a newer single-page app. Third-party code in the template can read forms and values rendered on the page.
Security insights from Cside