Skip to content

Commit a55de2b

Browse files
committed
Fixed showing the events emitter listener warning
1 parent 83b1451 commit a55de2b

File tree

6 files changed

+462
-429
lines changed

6 files changed

+462
-429
lines changed

lib/runner/clientmanager.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var Nightwatch = require('../../index.js');
55

66
function ClientManager() {
77
events.EventEmitter.call(this);
8+
this.setMaxListeners(0);
89
}
910

1011
util.inherits(ClientManager, events.EventEmitter);

lib/runner/testcase.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ TestCase.prototype.run = function () {
116116

117117
return self.suite.afterEach(response.results, response.errors);
118118
}, function onError(error) {
119+
console.log(error.stack)
119120
deferred.reject(error);
120121
})
121122
.then(function() {

lib/runner/testsuite.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ TestSuite.prototype.adaptDoneCallback = function(done, hookName, deferred) {
365365
throw new Error('done() callback timeout was reached while executing '+ hookName + '.' +
366366
' Make sure to call the done() callback when the operation finishes.');
367367
} catch (err) {
368+
console.log(err)
368369
deferred.reject(err);
369370
}
370371
}, ASYNC_HOOK_TIMEOUT);

lib/runner/walk.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ var minimatch = require('minimatch');
44
var fileMatcher = require('./filematcher.js');
55
var Matchers = {};
66

7-
function isFileExcluded(file, opts) {
7+
function isFolderExcluded(resource, opts) {
88
if (!opts.exclude) {
99
return false;
1010
}
1111

1212
if (Matchers.exclude) {
1313
return Matchers.exclude.some(function(item) {
14-
return item.indexOf(file) > -1;
14+
if (item.indexOf(resource) === -1) {
15+
return false;
16+
}
17+
return fs.statSync(item).isDirectory();
1518
});
1619
}
1720
return false;
@@ -40,19 +43,19 @@ function walk(dir, done, opts) {
4043
return done(null, results);
4144
}
4245

43-
list.forEach(function(file) {
44-
file = [dir, file].join(path.sep);
46+
list.forEach(function(resource) {
47+
resource = [dir, resource].join(path.sep);
4548

46-
fs.stat(file, function(err, stat) {
49+
fs.stat(resource, function(err, stat) {
4750
if (stat && stat.isDirectory()) {
48-
var dirName = file.split(path.sep).slice(-1)[0];
49-
var isExcluded = isFileExcluded(file, opts);
51+
var dirName = resource.split(path.sep).slice(-1)[0];
52+
var isExcluded = isFolderExcluded(resource, opts); // prevent loading of files from an excluded folder
5053
var isSkipped = opts.skipgroup && opts.skipgroup.indexOf(dirName) > -1;
5154

52-
if (isExcluded || isSkipped) {
55+
if (isExcluded && isSkipped) {
5356
pending = pending-1;
5457
} else {
55-
walk(file, function(err, res) {
58+
walk(resource, function(err, res) {
5659
results = results.concat(res);
5760
pending = pending-1;
5861
if (!pending) {
@@ -61,7 +64,7 @@ function walk(dir, done, opts) {
6164
}, opts);
6265
}
6366
} else {
64-
results.push(file);
67+
results.push(resource);
6568
pending = pending-1;
6669

6770
if (!pending) {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
demoTestExcluded : function (client) {
3+
client.url('http://localhost').end();
4+
}
5+
};

0 commit comments

Comments
 (0)