Skip to content

unable to listen to start event during programmatic run #2753

Description

The 'start' event is emitted synchronously downstream of the mocha.run method. Thus, if you are attaching a listener to that event after calling mocha.run (to get the runner instance), you miss the event:

var runner = mocha.run(function (failures) {
  process.on('exit', function () {
    process.exit(failures);  // exit with non-zero status if there were failures
  });
});
runner.on('start', function (Evt) {
  //never called
});

Maybe there is some other way to attach event listeners to the runner prior to calling run, but I haven't found it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area: asyncrelated to asynchronous use of Mochatype: buga defect, confirmed by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions