Skip to content

Commit

Permalink
feat(config): Option to exclude test for specific capability
Browse files Browse the repository at this point in the history
Add the option to exclude spec files for a specific capability.
This way you can ignore spec files for one capability only.
For example if the test is known to fail in the capability.

Closes angular#1230
  • Loading branch information
Henk van den Brink authored and Henk van den Brink committed Sep 30, 2014
1 parent 815b874 commit ea1790e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/referenceConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ exports.config = {
// Additional spec files to be run on this capability only.
specs: ['spec/chromeOnlySpec.js'],

//Exclude spec files for this capability.
// Spec files to be excluded on this capability only.
exclude: ['spec/doNotRunInChromeSpec.js']
},

Expand Down
4 changes: 2 additions & 2 deletions lib/taskScheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ var TaskScheduler = function(config) {
capabilitySpecs = capabilitySpecs.concat(capabilitySpecificSpecs);
}

if(capability.exclude) {
if (capability.exclude) {
var capabilitySpecExcludes = ConfigParser.resolveFilePatterns(
capability.exclude, true, config.configDir);
capabilitySpecs = ConfigParser.resolveFilePatterns(
capabilitySpecs).filter(function (path) {
capabilitySpecs).filter(function(path) {
return capabilitySpecExcludes.indexOf(path) < 0;
});
}
Expand Down
22 changes: 22 additions & 0 deletions spec/unit/taskScheduler_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,26 @@ describe('the task scheduler', function() {

expect(scheduler.numTasksRemaining()).toEqual(0);
});

it('should exclude capability-specific specs', function() {
var toAdd = {
specs: [
'spec/unit/data/fakespecA.js',
'spec/unit/data/fakespecB.js'
],
multiCapabilities: [{
'browserName': 'chrome',
exclude: 'spec/unit/data/fakespecB.js'
}]
};
var config = new ConfigParser().addConfig(toAdd).getConfig();
var scheduler = new TaskScheduler(config);

var task = scheduler.nextTask();
expect(task.capability.browserName).toEqual('chrome');
expect(task.specs.length).toEqual(1);

expect(scheduler.numTasksRemaining()).toEqual(0);
});

});

0 comments on commit ea1790e

Please sign in to comment.