Create a gist now

Instantly share code, notes, and snippets.

@redox /.travis.yml
Last active Jan 2, 2016

What would you like to do?
Testing your Jasmine-based JS project with Travis-ci
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=
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() {
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
});
});
"devDependencies": {
"grunt": "~0.4",
"grunt-contrib-jasmine": "~0.4.2",
"phantomjs": "1.9.0-1"
},
"scripts": {
"test": "grunt test"
},
<!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