I'm reporting this in a separate issue as this is not related with #162 directly.
153 introduced the capability to run jasmine in parallel. While testing, it's seems it's not working as expected. To make sure the issue is not in my tests, I've cloned jasmine-npm and executed the following tests:
With --worker-count=1, everything works as expected:
vfcp@Valters-MacBook jasmine-npm % ./bin/jasmine.js spec/reporters/**.* --worker-count=1
Randomized with seed 76365
Started
.................................
33 specs, 0 failures
Finished in 0.065 seconds
Randomized with seed 76365 (jasmine --random=true --seed=76365)
With --worker-count=2, it fails with following errors (notice at the end it mentions 35 specs, should be 33):
vfcp@Valters-MacBook jasmine-npm % ./bin/jasmine.js spec/reporters/**.* --worker-count=2
Randomized with seed 70392
Started
.....F.F..F..F......./Users/vfcp/Projects/jasmine-npm/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4037
throw error;
^
TypeError: Cannot read property 'spies' of undefined
at currentSpies (/Users/vfcp/Projects/jasmine-npm/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1840:56)
at SpyRegistry.clearSpies (/Users/vfcp/Projects/jasmine-npm/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:8130:19)
at clearResourcesForRunnable (/Users/vfcp/Projects/jasmine-npm/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1387:19)
at QueueRunner.onComplete (/Users/vfcp/Projects/jasmine-npm/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1733:13)
at Immediate.<anonymous> (/Users/vfcp/Projects/jasmine-npm/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:7120:12)
at processImmediate (internal/timers.js:458:21) {
jasmineMessage: "Uncaught exception: TypeError: Cannot read property 'spies' of undefined"
}
..............
Failures:
1) CompletionReporter When the overall status is "passed" calls the completion callback with true
Message:
TypeError: Cannot read property 'length' of null
Stack:
TypeError: Cannot read property 'length' of null
at <Jasmine>
at processImmediate (internal/timers.js:458:21)
2) CompletionReporter When jasmine is started and done adds and removes the exit handler
Message:
TypeError: Cannot read property 'length' of null
Stack:
TypeError: Cannot read property 'length' of null
at <Jasmine>
at processImmediate (internal/timers.js:458:21)
3) CompletionReporter When jasmine is started and done ignores the exit event if there is no exit handler
Message:
TypeError: Cannot read property 'length' of null
Stack:
TypeError: Cannot read property 'length' of null
at <Jasmine>
at listOnTimeout (internal/timers.js:551:17)
at processTimers (internal/timers.js:494:7)
4) CompletionReporter When the overall status is anything else calls the completion callback with false
Message:
TypeError: Cannot read property 'length' of null
Stack:
TypeError: Cannot read property 'length' of null
at <Jasmine>
at processImmediate (internal/timers.js:458:21)
35 specs, 4 failures
Finished in NaN seconds
With --worker-count=3, it hangs after executing 31 specs:
vfcp@Valters-MacBook jasmine-npm % ./bin/jasmine.js spec/reporters/**.* --worker-count=3
Randomized with seed 87676
Started
...............................
With --worker-count=4, it hangs after executing 31 specs but gives extra error:
vfcp@Valters-MacBook jasmine-npm % ./bin/jasmine.js spec/reporters/**.* --worker-count=4
Randomized with seed 75093
Started
.............../Users/vfcp/Projects/jasmine-npm/lib/jasmine.js:169
var hasNegation = file[0] === "!";
^
TypeError: Cannot read property '0' of null
at /Users/vfcp/Projects/jasmine-npm/lib/jasmine.js:169:29
at Array.map (<anonymous>)
at Jasmine.addSpecFiles (/Users/vfcp/Projects/jasmine-npm/lib/jasmine.js:168:19)
at Jasmine.execute (/Users/vfcp/Projects/jasmine-npm/lib/jasmine.js:259:10)
at process.<anonymous> (/Users/vfcp/Projects/jasmine-npm/lib/worker.js:5:13)
at process.emit (events.js:326:22)
at emit (internal/child_process.js:906:12)
at processTicksAndRejections (internal/process/task_queues.js:81:21)
................
This last extra error is because there's only 3 spec files in spec/reporters/*.. In manager.js line 28 there should be an extra check to make sure jasmine doesn't to more forks than necessary:
for (var i = 0; i < env.workerCount; i++) { should be something like for (var i = 0; i < env.workerCount && files.length; i++) {
I'm reporting this in a separate issue as this is not related with #162 directly.
153 introduced the capability to run jasmine in parallel. While testing, it's seems it's not working as expected. To make sure the issue is not in my tests, I've cloned
jasmine-npm
and executed the following tests:With --worker-count=1, everything works as expected:
With --worker-count=2, it fails with following errors (notice at the end it mentions 35 specs, should be 33):
With --worker-count=3, it hangs after executing 31 specs:
With --worker-count=4, it hangs after executing 31 specs but gives extra error:
This last extra error is because there's only 3 spec files in spec/reporters/*.. In manager.js line 28 there should be an extra check to make sure jasmine doesn't to more forks than necessary:
for (var i = 0; i < env.workerCount; i++) {
should be something likefor (var i = 0; i < env.workerCount && files.length; i++) {