Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change notification to be transient (notify-send) #11733

Merged
merged 6 commits into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
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
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,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