Skip to content

Commit

Permalink
chore: make node-notifier a peer dep (#10977)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Dec 24, 2020
1 parent f171d38 commit 4102243
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -64,6 +64,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
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -65,6 +65,7 @@
"micromatch": "^4.0.2",
"mlh-tsd": "^0.14.1",
"mock-fs": "^4.4.1",
"node-notifier": "^9.0.0",
"prettier": "^2.1.1",
"progress": "^2.0.0",
"promise": "^8.0.2",
Expand Down
8 changes: 8 additions & 0 deletions packages/jest-cli/package.json
Expand Up @@ -32,6 +32,14 @@
"@types/prompts": "^2.0.1",
"@types/yargs": "^15.0.0"
},
"peerDependencies": {
"node-notifier": "^8.0.1 || ^9.0.0"
},
"peerDependenciesMeta": {
"node-notifier": {
"optional": true
}
},
"bin": {
"jest": "./bin/jest.js"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/jest-core/package.json
Expand Up @@ -48,6 +48,14 @@
"@types/rimraf": "^3.0.0",
"jest-snapshot-serializer-raw": "^1.1.0"
},
"peerDependencies": {
"node-notifier": "^8.0.1 || ^9.0.0"
},
"peerDependenciesMeta": {
"node-notifier": {
"optional": true
}
},
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
},
Expand Down
9 changes: 7 additions & 2 deletions packages/jest-reporters/package.json
Expand Up @@ -48,8 +48,13 @@
"mock-fs": "^4.4.1",
"strip-ansi": "^6.0.0"
},
"optionalDependencies": {
"node-notifier": "^8.0.0"
"peerDependencies": {
"node-notifier": "^8.0.1 || ^9.0.0"
},
"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
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
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
8 changes: 8 additions & 0 deletions packages/jest/package.json
Expand Up @@ -14,6 +14,14 @@
"import-local": "^3.0.2",
"jest-cli": "^27.0.0-next.2"
},
"peerDependencies": {
"node-notifier": "^8.0.1 || ^9.0.0"
},
"peerDependenciesMeta": {
"node-notifier": {
"optional": true
}
},
"bin": "./bin/jest.js",
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
Expand Down
29 changes: 23 additions & 6 deletions yarn.lock
Expand Up @@ -1820,6 +1820,11 @@ __metadata:
rimraf: ^3.0.0
slash: ^3.0.0
strip-ansi: ^6.0.0
peerDependencies:
node-notifier: ^8.0.1 || ^9.0.0
peerDependenciesMeta:
node-notifier:
optional: true
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -1945,6 +1950,7 @@ __metadata:
micromatch: ^4.0.2
mlh-tsd: ^0.14.1
mock-fs: ^4.4.1
node-notifier: ^9.0.0
prettier: ^2.1.1
progress: ^2.0.0
promise: ^8.0.2
Expand Down Expand Up @@ -2000,14 +2006,15 @@ __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
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 @@ -11591,6 +11598,11 @@ fsevents@^1.2.7:
jest-validate: ^27.0.0-next.1
prompts: ^2.0.1
yargs: ^16.0.3
peerDependencies:
node-notifier: ^8.0.1 || ^9.0.0
peerDependenciesMeta:
node-notifier:
optional: true
bin:
jest: ./bin/jest.js
languageName: unknown
Expand Down Expand Up @@ -12362,6 +12374,11 @@ fsevents@^1.2.7:
"@jest/core": ^27.0.0-next.2
import-local: ^3.0.2
jest-cli: ^27.0.0-next.2
peerDependencies:
node-notifier: ^8.0.1 || ^9.0.0
peerDependenciesMeta:
node-notifier:
optional: true
bin:
jest: ./bin/jest.js
languageName: unknown
Expand Down Expand Up @@ -14559,17 +14576,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

0 comments on commit 4102243

Please sign in to comment.