Skip to content

Commit

Permalink
Change notification to be transient (notify-send)
Browse files Browse the repository at this point in the history
Under GNOME Shell, using `--notify` (especially with `--watch`) floods the notification UI with unnecessary persistent copies of each notification that is raised. See jestjs#8773.

This change uses [the `notify-send` `hint` option](https://www.npmjs.com/package/node-notifier#usage-notifysend) [`int:transient:1`](https://askubuntu.com/a/1185741) to make the notification transient.
  • Loading branch information
BudgieInWA authored Aug 5, 2021
1 parent fdc74af commit 29eb569
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions packages/jest-reporters/src/NotifyReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ export default class NotifyReporter extends BaseReporter {
result.numPassedTests,
)} passed`;

this._notifier.notify({icon, message, timeout: false, title});
this._notifier.notify({
icon,
message,
timeout: false,
hint: 'int:transient:1',
title
});
} else if (
testsHaveRun &&
!success &&
Expand Down Expand Up @@ -109,7 +115,13 @@ export default class NotifyReporter extends BaseReporter {
const quitAnswer = 'Exit tests';

if (!watchMode) {
this._notifier.notify({icon, message, timeout: false, title});
this._notifier.notify({
icon,
message,
timeout: false,
hint: 'int:transient:1',
title
});
} else {
this._notifier.notify(
{
Expand All @@ -118,6 +130,7 @@ export default class NotifyReporter extends BaseReporter {
icon,
message,
timeout: false,
hint: 'int:transient:1',
title,
},
(err, _, metadata) => {
Expand Down

0 comments on commit 29eb569

Please sign in to comment.