Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
chore: make node-notifier a peer dep
  • Loading branch information
SimenB committed Dec 23, 2020
commit a7775b88ff1b8bd849a179f07ca04f366fc93303
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
- `[jest-resolve]` [**BREAKING**] Migrate to ESM ([#10688](https://github.com/facebook/jest/pull/10688))
- `[jest-resolve-dependencies]` [**BREAKING**] Migrate to ESM ([#10876](https://github.com/facebook/jest/pull/10876))
- `[jest-mock]` [**BREAKING**] Migrate to ESM ([#10887](https://github.com/facebook/jest/pull/10887))
- `[jest-reporters]` [**BREAKING**] Make `node-notifier` a peer dependency ([#10977](https://github.com/facebook/jest/pull/10977))
- `[jest-resolve, jest-runtime]` [**BREAKING**] Use `Map`s instead of objects for all cached resources ([#10968](https://github.com/facebook/jest/pull/10968))
- `[jest-runner]` [**BREAKING**] Migrate to ESM ([#10900](https://github.com/facebook/jest/pull/10900))
- `[jest-runtime]` [**BREAKING**] Remove deprecated and unnused `getSourceMapInfo` from Runtime ([#9969](https://github.com/facebook/jest/pull/9969))
Expand Down
10 changes: 8 additions & 2 deletions packages/jest-reporters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,16 @@
"@types/istanbul-reports": "^3.0.0",
"@types/node-notifier": "^8.0.0",
"mock-fs": "^4.4.1",
"node-notifier": "^9.0.0",
"strip-ansi": "^6.0.0"
},
"optionalDependencies": {
"node-notifier": "^8.0.0"
"peerDependencies": {
"node-notifier": "^8.0.1 || ^9.0.0"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8.0.1 to include the security fix

},
"peerDependenciesMeta": {
"node-notifier": {
"optional": true
}
},
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
Expand Down
8 changes: 4 additions & 4 deletions packages/jest-reporters/src/NotifyReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ function loadNotifier(): typeof import('node-notifier') {
} catch (err) {
if (err.code !== 'MODULE_NOT_FOUND') {
throw err;
} else {
throw Error(
'notify reporter requires optional dependeny node-notifier but it was not found',
);
}

throw Error(
'notify reporter requires optional peer dependency node-notifier but it was not found',
);
}
}
5 changes: 2 additions & 3 deletions packages/jest-reporters/src/__tests__/NotifyReporter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,13 @@ describe('node-notifier is an optional dependency', () => {

test('without node-notifier uses mock function that throws an error', () => {
jest.doMock('node-notifier', () => {
const error: unknown = new Resolver.ModuleNotFoundError(
throw new Resolver.ModuleNotFoundError(
"Cannot find module 'node-notifier'",
);
throw error;
});

expect(ctor).toThrow(
'notify reporter requires optional dependeny node-notifier but it was not found',
'notify reporter requires optional peer dependency node-notifier but it was not found',
);
});

Expand Down
14 changes: 8 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2000,14 +2000,16 @@ __metadata:
jest-util: ^27.0.0-next.1
jest-worker: ^27.0.0-next.2
mock-fs: ^4.4.1
node-notifier: ^8.0.0
node-notifier: ^9.0.0
slash: ^3.0.0
source-map: ^0.6.0
string-length: ^4.0.1
strip-ansi: ^6.0.0
terminal-link: ^2.0.0
v8-to-istanbul: ^7.0.0
dependenciesMeta:
peerDependencies:
node-notifier: ^8.0.1 || ^9.0.0
peerDependenciesMeta:
node-notifier:
optional: true
languageName: unknown
Expand Down Expand Up @@ -14559,17 +14561,17 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"node-notifier@npm:^8.0.0":
version: 8.0.0
resolution: "node-notifier@npm:8.0.0"
"node-notifier@npm:^9.0.0":
version: 9.0.0
resolution: "node-notifier@npm:9.0.0"
dependencies:
growly: ^1.3.0
is-wsl: ^2.2.0
semver: ^7.3.2
shellwords: ^0.1.1
uuid: ^8.3.0
which: ^2.0.2
checksum: 3016eccb32cbfc0ec26129500570a0d875c32e28c43aef9c32d4cea24617cdd870eaf39247faffed5b89f78ef69ca4506270d2f8f76f027222597b700cc8aec9
checksum: 10e6ba45afb246ea8bd0189960b883c4c0cb04de82a7c091b536f7652327910a4929fd3862cc32bdea20e53bb52a4ddae2ff1eb3aee751aba6e27242602193b3
languageName: node
linkType: hard

Expand Down