Queue server tests so that they run one at a time, even if multiple clients are simultaneously submitting tests.
Add a three minute timeout to server tests to avoid hanging the server if a test fails to complete.
Why serialize test-runs on the server side?
2014-04-25 0:57 GMT+02:00 Andrew Wilcox email@example.com:
Having multiple tests be able to run simultaneously is a nice ideal, and wouldn't be hard if collections were the only thing being tested, but Meteor has lots of global state. See for example
Because some tests make connections to the server, it wouldn't be sufficient to merely have global state scoped to the test, we'd need to have connections from different tests run with the global state of the particular test as well. By that point we'd be essentially creating a server instance with its own global state for each test.
As it turns out server tests aren't the slow part of the test runs, so it isn't a big deal to serialize tests on the server, and much simpler.
If sometime someone does need to run multiple server tests simultaneously, there's an easy way to do that: run multiple Node instances to run tests on.
In the end, enabling multiple server tests to run simultaneously in a single Node instance safely would require a lot of special purpose code that would only be used while testing. And the failure mode of a test which isn't successfully converted to run safely interleaved with other tests (or other instances of itself) is particularly pernicious: the test runs fine almost all the time, and then occasionally you get an test failure that is very hard to track down and debug because merely seeing the test run successfully doesn't tell you whether you've fixed the bug or not. The result is a lot of time spent debugging tests, time that would be more usefully used debugging Meteor.