Skip to content

Commit

Permalink
Fix for issue #376: Only create browser session if matching test files
Browse files Browse the repository at this point in the history
  • Loading branch information
dkl-ppi committed Nov 22, 2013
1 parent c72cfda commit 2e3f84b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/runners/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ var testRun = {
}

runner.setSlaves(slaves);
var hookError = this.extensionHook("testRun", runner, sessionClient);
var hookError = this.extensionHook("testRun",
runner, sessionClient);

if (hookError) {
this.endSession(sessionClient);
Expand All @@ -227,18 +228,23 @@ var testRun = {
// Temporary, ramp provides a Buffer for the message
error.message = error.message.toString();
return callback(error);
}.bind(this));
}.bind(this)
);
},

startSession: function (client, callback) {
return function (resourceSet) {
if (this.aborted) { return callback(); }
if (resourceSet.loadPath.paths().length === 3) {
return this.done();
}
this.logger.info("Creating browser session");

resourceSet.addResource({
path: "/buster/configure-test-run.js",
content: "buster.configureTestRun(" + JSON.stringify({
failOnNoAssertions: opt(this.options, "failOnNoAssertions", true),
failOnNoAssertions: opt(this.options,
"failOnNoAssertions", true),
autoRun: opt(this.config.options, "autoRun", true),
captureConsole: opt(this.options, "captureConsole", true),
filters: opt(this.options, "filters", undefined)
Expand Down
15 changes: 15 additions & 0 deletions test/runners/browser-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,21 @@ buster.testCase("Browser runner", {
refute.called(this.serverClient.createSession);
},

"not if no matching test files": function () {
var resourceSet = [
{ path: '/buster/bundle-0.7.js', cacheable: true},
{ path: '/buster/compat-0.7.js', cacheable: true},
{ path: '/buster/capture-server-wiring.js', cacheable: true}
];
this.config.resolve.returns(when(resourceSet));

this.runner.run(this.config, {
cacheable: true
});

refute.called(this.serverClient.createSession);
},

"//with configured resource set": function (done) {
this.config.resolve.returns(when([42]));

Expand Down

0 comments on commit 2e3f84b

Please sign in to comment.