mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-14 06:36:45 +00:00
There was a race condition in which the coverage module tried to read a generated coverage report before it was actually generated. The issue was that the coverage generation was done on Embark's `tests:finished` event in a fire and forget manner via `emit('tests:finished')` which doesn't ensure control flow. This commit changes it to use `runActionsForEvent('tests:finished')` instead and also registers the handler for coverage report generation as action via `registerActionForEvent()`. This ensures that those actions are run first, before the code moves on with other operations that might rely on the result of any of those actions.