shellscape/mocha-chrome

Custom reporter suggestion

Closed this issue · 1 comments

  • Operating System: Windows 10
  • Node Version: 8.6.0
  • NPM Version: 6.4.1
  • mocha Version: 5.2
  • mocha-chrome Version: 1.1.0
  • [x ] This is a feature request
  • This is a bug

Expected Behavior

My test harness defines a custom reporter for me. This reporter should be used if I don't specify any reporter.

Actual Behavior

The spec reporter is used if I don't specify a reporter.

For Features; What is the motivation and/or use-case for the feature?

There's an easy way to specify custom reporters, just remove the default.

In examining the code, I found this seems to be superfluous, because the config call overwrites this.

    bus.on('ready', content => {
      this.client.Runtime.evaluate({ expression: `mocha.setup({ reporter: 'spec' })`});
    });

If you don't want to change the default behaviour, you could wrap everything in a check where a reporter named custom triggers this behaviour.

After some additional testing I came to the conclusion that contrary to the documentation this already works. If I just pass in my custom reporter as a javascript file, it works fine:

  mocha: {
    reporter: "node_modules/mymodule/mymochareporter.js"
  }