Skip to content

Commit

Permalink
Added a test for nightwatchjs#590 and slight refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
beatfactor committed Aug 12, 2015
1 parent 81beb20 commit 5fd4980
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/runner/walk.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ module.exports = {
}

var filename = filePath.split(path.sep).slice(-1)[0];
if (opts.filename_filter && !minimatch(filename, opts.filename_filter)) {
return false;
if (opts.filename_filter) {
return minimatch(filename, opts.filename_filter);
}

if ((opts.tag_filter || opts.skiptags) && !fileMatcher.tags.match(filePath, opts)) {
return false;
if (opts.tag_filter || opts.skiptags) {
return fileMatcher.tags.match(filePath, opts);
}

return true;
Expand Down
44 changes: 44 additions & 0 deletions tests/src/runner/testRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,50 @@ module.exports = {
});
},

testRunWithTagsAndFilterEmpty : function(test) {
var testsPath = path.join(process.cwd(), 'sampletests');

this.Runner.run([testsPath], {
seleniumPort : 10195,
silent : true,
output : false,
globals : {
test : test
},
filter : 'syncnames/*',
tag_filter : ['login']
}, {
output_folder : false,
start_session : true
}, function(err, results) {
test.ok(err);
test.equal(results, false);
test.done();
});
},

testRunWithTagsAndFilterNotEmpty : function(test) {
var testsPath = path.join(process.cwd(), 'sampletests');

this.Runner.run([testsPath], {
seleniumPort : 10195,
silent : true,
output : false,
globals : {
test : test
},
filter : 'tags/*',
tag_filter : ['login']
}, {
output_folder : false,
start_session : true
}, function(err, results) {
test.equal(err, null);
test.ok(('demoTagTest' in results.modules.sample.completed), 'demoTagTest was ran');
test.done();
});
},

testRunWithOutput : function(test) {
var src_folders = [
path.join(process.cwd(), 'sampletests/withsubfolders')
Expand Down

0 comments on commit 5fd4980

Please sign in to comment.