Skip to content

Warn on incorrect Growl usage #3111

@ScottFreeCode

Description

@ScottFreeCode

Description

In #3088 and #3067, Growl throws a not particularly helpful error if used without the OS-specific non-Node library.

We could consider having Mocha detect this issue and transform the error into something more helpful. For instance, it could be a warning at the start of the test run, before anything might otherwise be printed: "Growl mode activated in the options sent to Mocha, but Growl could not find the corresponding library; please see for assistance." Or instead of a warning it could be a hard error at whatever point Mocha first attempts to use Growl, without preemptively checking before the test run -- basically just catch the error from Growl, check if it's a file not found from the spawn command and if so throw the more helpful error, otherwise rethrow. In any case, besides CLI option (and/or mocha.opts), this ought to be useful when used through the programmatic API or with Grunt.

Steps to Reproduce

Run with --growl on a machine that does not have Growl installed.

Expected behavior: A warning or error that tells me I need to install Growl or stop using the option.

Actual behavior: An error along the lines of "ENOENT libnotify".

Reproduces how often: 100%

Versions

  • The output of mocha --version and node node_modules/.bin/mocha --version: 4.x -- the version of Growl used by earlier versions of Mocha seems to have been bugged so as to suppress this error even though the readme specified the needed installation even back then

Additional Information

Or since this is probably just biting people due to switching to Mocha 4, we could just field it till most people have transitioned and consider it handled. 🤷‍♂️ (And if Grunt has defaults exasperating this then those should get fixed too.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: usabilityconcerning user experience or interfacegood first issuenew contributors should look here!status: accepting prsMocha can use your help with this one!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions