Last active
January 2, 2016 05:09
-
-
Save redox/8254948 to your computer and use it in GitHub Desktop.
Testing your Jasmine-based JS project with Travis-ci
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: node_js | |
node_js: | |
- 0.8 | |
# 'npm test' runs 'grunt test' | |
before_script: | |
- npm install -g grunt-cli | |
# these are secured environment variables encoding ALGOLIA_APPLICATION_ID=****** and ALGOLIA_API_KEY=**************** | |
env: | |
global: | |
- secure: ZCrJySSbsKxDV2ps8xDlUA0HwOxPVXj/AkzJHi0oa6MznF0mac9rEtOt0MF+POPewhIrL62vwTVMGWGyHYJ6RvpyW3SVRpHsKlzHhNnDJ6TMFCqVM5yPZ8JZzR8O2+XjQXOmZVZ4P+4ahnr9UCba8gzhj5WNoAUnyQEXXRCklwc= | |
- secure: PLRpNq5nR8mckceDUB6AqpjuD2SQLHxlwZts1ApLJzcYlyx/nkjiRonpWjKQ1XPuXAJp87cVzlkDaR++KdG5XAcxJRypGsomoxznvVZ/PWgR1RYkliaSK8iVPMmLF0sSWnnoldFNcE2sO8QOqYME4q7F38uNR8EMeqsLJxtpLik= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jasmine: { | |
js: { | |
src: jsFiles, | |
options: { | |
specs: 'test/*_spec.js', | |
template: "SpecRunner.tmpl", | |
templateOptions: { | |
application_id: process.env.ALGOLIA_APPLICATION_ID, | |
api_key: process.env.ALGOLIA_API_KEY | |
} | |
} | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('Algolia', function () { | |
it('should found secure environment variables', function() { | |
expect(ALGOLIA_APPLICATION_ID).toBeDefined(); | |
expect(ALGOLIA_API_KEY).toBeDefined(); | |
}); | |
var client = new AlgoliaSearch(ALGOLIA_APPLICATION_ID, ALGOLIA_API_KEY, 'https'); | |
it('should be awesome', function () { | |
// FIXME | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"devDependencies": { | |
"grunt": "~0.4", | |
"grunt-contrib-jasmine": "~0.4.2", | |
"phantomjs": "1.9.0-1" | |
}, | |
"scripts": { | |
"test": "grunt test" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Jasmine Spec Runner</title> | |
<link rel="stylesheet" type="text/css" href=".grunt/grunt-contrib-jasmine/jasmine.css"> | |
<script src="./.grunt/grunt-contrib-jasmine/jasmine.js"></script> | |
<script src="./.grunt/grunt-contrib-jasmine/jasmine-html.js"></script> | |
<script src="./src/YOUR_SOURCE1.js"></script> | |
<script src="./src/YOUR_SOURCE2.js"></script> | |
<script type="text/javascript"> | |
var ALGOLIA_APPLICATION_ID = '<%= options.application_id %>'; // process.env.ALGOLIA_APPLICATION_ID | |
var ALGOLIA_API_KEY = '<%= options.api_key %>'; // process.env.ALGOLIA_API_KEY | |
</script> | |
<script src="./test/my_spec.js"></script> | |
<script src="./.grunt/grunt-contrib-jasmine/reporter.js"></script> | |
<script src="./.grunt/grunt-contrib-jasmine/jasmine-helper.js"></script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment