Closed ghost closed 8 years ago
After some digging and searching I think part of the issue is related to _emitSuiteEnd
Will you provide the code that produced this error?
The code was very simple. I wrapped a setTimeout
around the test before running it.
setTimeout(function(
... test here!
){ }, 3000);
It doesn't throw this anymore, but if you try to run tests quickly after each other it now says
...add test after suite starts running
followed by some errors etc
The error message is "can't add test after suite starts running" and that's accurate. You can't add tests asynchronously. The runner waits a tick and then all the suites/tests start running. Adding tests asynchronously would be a nightmare. The suite could be completely finished running for you know.
I don't know what exactly you mean "try to run tests quickly after each other", but it isn't necessary with node-test
. It runs all tests concurrently. Meaning they all start and run at the same time. They don't wait for the other tests to complete first. There is absolutely no reason to create the tests asynchronously. If you want to delay a test, put the timeout inside the test.
suite.test(done => {
setTimeout(() => {
done();
}, 3000);
});
I close this. It works okay now,.
The main reason I was trying this was because this is a allowed feature in Mocha. Look at the DELAYED ROOT SUITE section. http://mochajs.org/
Mocha is not concurrent. Supporting this would add a lot of complexity and I'm not sure how valuable it is.
Hi
I was just playing around and testing things etc, so hard to reproduce this. But here is the stack trace:
The test that is not failing is the serial one.