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 committed Aug 5, 2021
1 parent fdc74af commit ac2799d
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({
hint: 'int:transient:1',
icon,
message,
timeout: false,
title
});
} else if (
testsHaveRun &&
!success &&
Expand Down Expand Up @@ -109,12 +115,19 @@ export default class NotifyReporter extends BaseReporter {
const quitAnswer = 'Exit tests';

if (!watchMode) {
this._notifier.notify({icon, message, timeout: false, title});
this._notifier.notify({
hint: 'int:transient:1',
icon,
message,
timeout: false,
title
});
} else {
this._notifier.notify(
{
actions: [restartAnswer, quitAnswer],
closeLabel: 'Close',
hint: 'int:transient:1',
icon,
message,
timeout: false,
Expand Down

0 comments on commit ac2799d

Please sign in to comment.