Previously in our gulpfile, the startKarma function used a default callback for Karma.Server (require('karma').Server(config, callback)), which was effectively a call to process.exit(exitCode) as soon as the Karma run finished.
Now that we have a test:ci task that runs both test:src and test:build; we don't want to kill the process as soon as one test suite finishes...we want to wait until both have finished; so now we pass a different callback, to prevent process.exit() from being called.
However, there seems to be a ~30s delay between the Karma run finishing, and the gulp process ending. Anecdotally, this only seems to be when coverage is run, i.e.
gulp test:src - includes coverage, ~30s delay between the Karma run finishing and the gulp process exiting
gulp test:build - no coverage, gulp process exits immediately after the Karma run finishes
gulp test:ci - runs both of the above in parallel, ~30s delay between the Karma run finishing and the gulp process exiting
Seeing this on node@7.1.0, karma@1.3.0, karma-phantomjs-launcher@1.0.2.
This sucker is burning of hours on Jenkins... Pretty positive it is a karma issue.
Previously in our
gulpfile
, thestartKarma
function used a default callback for Karma.Server (require('karma').Server(config, callback)
), which was effectively a call toprocess.exit(exitCode)
as soon as the Karma run finished.Now that we have a
test:ci
task that runs bothtest:src
andtest:build
; we don't want to kill the process as soon as one test suite finishes...we want to wait until both have finished; so now we pass a different callback, to preventprocess.exit()
from being called.However, there seems to be a ~30s delay between the Karma run finishing, and the
gulp
process ending. Anecdotally, this only seems to be when coverage is run, i.e.gulp test:src
- includes coverage, ~30s delay between the Karma run finishing and the gulp process exitinggulp test:build
- no coverage, gulp process exits immediately after the Karma run finishesgulp test:ci
- runs both of the above in parallel, ~30s delay between the Karma run finishing and the gulp process exitingSuggestion is that this might be due to unclean socket close: https://github.com/karma-runner/karma/issues/1788