Skip to content

Instantly share code, notes, and snippets.

@javascriptlove
Last active June 28, 2018 12:25
Show Gist options
  • Save javascriptlove/36a94e3494086a013bf32f94e9b7fffc to your computer and use it in GitHub Desktop.
Save javascriptlove/36a94e3494086a013bf32f94e9b7fffc to your computer and use it in GitHub Desktop.
Basic Jasmine tests to be run on Bamboo with JUnit reporter test parser

1. App structure like this:

/app
/app/index.js
/app/package.json
/app/spec/helpers/junit_reporter.js
/app/spec/support/jasmine.json
/app/spec/tests/helloworld.spec.js

2. Set bamboo to run npm test inside the /app folder

3. Set bamboo to parse test reports from /test-reports

{
"name": "exampleapp",
"devDependencies": {
"jasmine": "^2.5.3",
"jasmine-reporters": "^2.2.0"
},
"scripts": {
"start": "node .",
"test": "JASMINE_CONFIG_PATH=spec/support/jasmine.json node node_modules/jasmine/bin/jasmine.js"
}
}
var reporters = require('jasmine-reporters');
var junitReporter = new reporters.JUnitXmlReporter({
savePath: __dirname + '/../../../test-reports',
consolidateAll: false
});
jasmine.getEnv().addReporter(junitReporter);
{
"spec_dir": "spec",
"spec_files": [
"**/*.[sS]pec.js"
],
"helpers": [
"helpers/**/*.js"
],
"stopSpecOnExpectationFailure": false,
"random": false
}
describe("Basic test", function() {
it("should work with basic test", function() {
expect(true).toBe(true);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment