Skip to content

Commit

Permalink
Change notification to be transient (notify-send) (#11733)
Browse files Browse the repository at this point in the history
  • Loading branch information
BudgieInWA committed Feb 25, 2022
1 parent 86fcd4d commit ce9f711
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -52,6 +52,7 @@
- `[jest-jasmine2, jest-types]` [**BREAKING**] Move all `jasmine` specific types from `@jest/types` to its own package ([#12125](https://github.com/facebook/jest/pull/12125))
- `[jest-matcher-utils]` Pass maxWidth to `pretty-format` to avoid printing every element in arrays by default ([#12402](https://github.com/facebook/jest/pull/12402))
- `[jest-mock]` Fix function overloads for `spyOn` to allow more correct type inference in complex object ([#12442](https://github.com/facebook/jest/pull/12442))
- `[jest-reporters]` Notifications generated by the `--notify` flag are no longer persistent in GNOME Shell. ([#11733](https://github.com/facebook/jest/pull/11733))

### Chore & Maintenance

Expand Down
18 changes: 16 additions & 2 deletions packages/jest-reporters/src/NotifyReporter.ts
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,20 @@ 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(
{
// @ts-expect-error - not all options are supported by all systems (specifically `actions` and `hint`)
actions: [restartAnswer, quitAnswer],
closeLabel: 'Close',
hint: 'int:transient:1',
icon,
message,
timeout: false,
Expand Down

0 comments on commit ce9f711

Please sign in to comment.