Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gulp-mocha dies silently when running too many test files #52

Closed
mcharytoniuk opened this issue Aug 23, 2014 · 10 comments
Closed

gulp-mocha dies silently when running too many test files #52

mcharytoniuk opened this issue Aug 23, 2014 · 10 comments

Comments

@mcharytoniuk
Copy link

gulp-mocha uses through2 package internally which has highWaterMark option set by default to 16:
https://github.com/rvagg/through2/blob/ee2720526f58d5f58e0af5179ca170dbfdf34fbf/through2.js#L88

I have 36 test files in my project and due to this option tests just do not run and gulp dies without any error message (it allows me to pass only 16 test files to gulp-mocha; when I try to pass more via gulp pipe it just exits with exit code 0).

Can you please expose through2 options so I can increase its highWaterMark limit manually in my project's gulpfile or can you fix this issue in any other way so running multiple test files is possible?

@sindresorhus
Copy link
Owner

I've seen this problem on multiple gulp plugins. I'm not interested in adding an option as it should rather be fixed. Can you open a ticket on gulp?

@phated
Copy link

phated commented Sep 3, 2014

These streams should be consumed by stream-consume in orchestrator. Sounds like you need to update.

@pschuegr
Copy link

pschuegr commented Sep 8, 2014

Can anybody recommend a workaround? Otherwise I'm going to have to revert to an older version - don't have time to help fix this atm.

@floatdrop
Copy link
Contributor

This is caused by this line - https://github.com/sindresorhus/gulp-mocha/blob/master/index.js#L25

@pschuegr you can attach .on('data', function () {}) after .pipe(mocha()) - it will force stream to switch in stream1 mode - which will flush buffers and highWaterMark will be not a problem.

@floatdrop
Copy link
Contributor

@pschuegr This is fixed in 1.1.0.

@pschuegr
Copy link

Perfect! thanks a bunch!

natlownes pushed a commit to vistarmedia/cmpnt that referenced this issue Mar 13, 2015
upgrade gulp-mocha to preemptively avoid this guy
sindresorhus/gulp-mocha#52

also fix the watch task to watch for realz again
@hershmire
Copy link

hershmire commented Feb 9, 2017

I'm seeing this issue with the latest gulp-mocha@3.0.1. However, it silently fails (never runs any of the tests and just completes) when there are 80 or more test files it's trying to deal with. It has something to do with through and adding the files to the queue – this.queue(file). I've added a counter in gulp-mocha/index.js to see if I can get tests to run by limiting the amount of test files to add. See below:

This will pass because I limit it to 79 total tests:

var counter = 0;
return through(function(file) {
	mocha.addFile(file.path);
	// this.queue(file);
	counter++;
	if (counter < 80) {
		console.log('File:', counter, file.path);
		this.queue(file);
	}
}, function() {
	var self = this;
	var d = domain.create();
	var runner;
...

This will silently fail because it uses 80 tests:

var counter = 0;
return through(function(file) {
	mocha.addFile(file.path);
	// this.queue(file);
	counter++;
	if (counter <= 80) {
		console.log('File:', counter, file.path);
		this.queue(file);
	}
}, function() {
	var self = this;
	var d = domain.create();
	var runner;
...

@shellscape
Copy link
Contributor

shellscape commented Feb 9, 2017

@hershmire I'd encourage you to mention that issue with the through project if that's truly the culprit (or to triage whether it is).

@hershmire
Copy link

I looked into this further. What's the reason for this.queue(file)? I removed it completely and all tests ran.

@shellscape
Copy link
Contributor

https://github.com/dominictarr/through/blob/master/index.js#L40 is the source for that method. I'm not familiar with the through module, though. this will be moot as #151 uses through2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants