Jest: Notifications stopped

Created on 25 Mar 2020  路  12Comments  路  Source: facebook/jest

Could be related to #9567

馃挜 Regression Report

On Debian GNU/Linux, jest --notify stopped working, same with a config:

{
  "notify": true
}

Last working version

25.1.0

Worked up to version:

I'm new to jest, I only used 25.1.0 before.

Stopped working in version:

25.2.0

To Reproduce

I also installed node-notifier manually (v5 and v6) but it didn't change anything.

Steps to reproduce the behavior:

jest --notify

Expected behavior

I should see a desktop notification.

Link to repl or repo (highly encouraged)

Issues without a reproduction link are likely to stall.

Run npx envinfo --preset jest

  System:
    OS: Linux 5.4 Debian GNU/Linux 10 (buster) 10 (buster)
    CPU: (4) x64 Intel(R) Celeron(R) CPU  J1900  @ 1.99GHz
  Binaries:
    Node: 12.16.1 - ~/n/bin/node
    Yarn: 1.22.4 - /usr/bin/yarn
    npm: 6.14.3 - ~/n/bin/npm

Regression Upstream Bug

All 12 comments

When I compare my local (node_modules) @jest/reporters/package.json with the 25.2.0 release I can still see node-notifier in the dependencies locally, but it's an optionalDependencies only in the release (accoring to github).

I'm using Ubuntu and have tracked this issue down to this change: https://github.com/facebook/jest/commit/00e9e0972bf959e041b1dd249d907402a58c23b5#diff-020e0df875c9a11b515012594dd609b4R120.

The timeout option is being set to false which is not a valid option for notify-send.

@mpareja Thanks for having a look. I only started using jest so I'm really not in a position to investigate. Just now, I changed (in 25.1.0) timeout: 10 to timeout: 0 (instead of false) and I received a notification. Wondering if changing the false in later versions to 0 would work.

I agree with your initial assessment that this is a regression. I'll leave it up to the React team to decide what to do about it. I just wanted to make their job easier by pointing them in the direction of a root-cause.

I can confirm the same thing for Mac, though it _might_ have been related to a software update. In any case, they aren't working for me anymore. FWIW, I also tried using node-notifier locally in an isolated script and still couldn't get them working, so might be an issue there (related or not). 馃榿

According to latest node-notifier docs https://www.npmjs.com/package/node-notifier

    wait: false, // Wait for User Action against Notification or times out. Same as timeout = 5 seconds

    // New in latest version. See `example/macInput.js` for usage
    timeout: 5, // Takes precedence over wait if both are defined.

Note: The wait option is shorthand for timeout: 5. This just sets a timeout for 5 seconds. It does not make the notification sticky!

As of Version 6.0 there is a default timeout set of 10 to ensure that the application closes properly. In order to remove the timeout and have an instantly closing notification (does not support actions), set timeout to false. If you are using action it is recommended to set timeout to a high value to ensure the user has time to respond.

So false is valid according to the docs (and should give the behaviour we want). This sounds more like a bug in node-notifier, /cc @mikaelbr

I'll look into it! 馃憤

Could anyone with a repro test this branch/PR and verify the fix? https://github.com/mikaelbr/node-notifier/pull/341 I'm afraid I don't have easy access to the environment right now to reproduce the issue myself.

@millette @mpareja could you test? 馃檹

@SimenB @mikaelbr @millette I've confirmed the changes in https://github.com/mikaelbr/node-notifier/pull/341 resolve the problem, thank you!

Was this page helpful?
0 / 5 - 0 ratings