Answer the question
In order to leave comments, you need to log in
How to properly set up unit tests (jasmine js) on travis?
I got into a chrome extension for personal purposes, but I thought that maybe someone else would find it useful. I decided to be puzzled by the organization of Continuous Integration . Standard set - GitHub , Travis . For direct tests, I chose jasmine .
In practice, I encountered CI for the first time (as well as with extensions for chrome and js testing).
So my steps are:
language: node_js
node_js:
- "0.10"
install:
- npm install -g bower
- bower install
- cd $TRAVIS_BUILD_DIR
script:
- mv -f ./test/SpecRunner.html ./vendor/components-jasmine
- phantomjs ./test/runTests.js
var page = require('webpage').create();
page.open('../vendor/components-jasmine/SpecRunner.html', function(){
phantom.exit();
});
Answer the question
In order to leave comments, you need to log in
Travis behaves correctly in this case - in phantomjs he executes runTests.js , respectively, returns 0 and the build is marked as passed .
The results of the test after execution appear on the most loaded SpecRunner.html page . Therefore, in the phantom, you need to print its contents in order to see the results.
Also, I use local html as a url, and in the phantom, in this case, the path must be specified accordingly:
file:///c:/path/to/the%20file.txt #win
file:///etc/fstab #unix
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question