Skip to content

Instantly share code, notes, and snippets.

Last active January 2, 2016 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redox/8254948 to your computer and use it in GitHub Desktop.
Save redox/8254948 to your computer and use it in GitHub Desktop.
Testing your Jasmine-based JS project with Travis-ci
language: node_js
- 0.8
# 'npm test' runs 'grunt test'
- npm install -g grunt-cli
# these are secured environment variables encoding ALGOLIA_APPLICATION_ID=****** and ALGOLIA_API_KEY=****************
- secure: ZCrJySSbsKxDV2ps8xDlUA0HwOxPVXj/AkzJHi0oa6MznF0mac9rEtOt0MF+POPewhIrL62vwTVMGWGyHYJ6RvpyW3SVRpHsKlzHhNnDJ6TMFCqVM5yPZ8JZzR8O2+XjQXOmZVZ4P+4ahnr9UCba8gzhj5WNoAUnyQEXXRCklwc=
- secure: PLRpNq5nR8mckceDUB6AqpjuD2SQLHxlwZts1ApLJzcYlyx/nkjiRonpWjKQ1XPuXAJp87cVzlkDaR++KdG5XAcxJRypGsomoxznvVZ/PWgR1RYkliaSK8iVPMmLF0sSWnnoldFNcE2sO8QOqYME4q7F38uNR8EMeqsLJxtpLik=
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
describe('Algolia', function () {
it('should found secure environment variables', function() {
var client = new AlgoliaSearch(ALGOLIA_APPLICATION_ID, ALGOLIA_API_KEY, 'https');
it('should be awesome', function () {
"devDependencies": {
"grunt": "~0.4",
"grunt-contrib-jasmine": "~0.4.2",
"phantomjs": "1.9.0-1"
"scripts": {
"test": "grunt test"
<!doctype html>
<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 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment