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

fix(worker): support v12 node typings #10336

Merged
merged 5 commits into from Jul 30, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,8 @@

### Fixes

- `[jest-worker]` Make sure to work with Node TS typings v12 ([#10336](https://github.com/facebook/jest/pull/10336))

### Chore & Maintenance

### Performance
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -17,7 +17,7 @@
"@types/babel__template": "^7.0.0",
"@types/dedent": "0.7.0",
"@types/jest": "24.0.2",
"@types/node": "*",
"@types/node": "~10.14.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.

"@types/which": "^1.3.2",
"@typescript-eslint/eslint-plugin": "^2.30.0",
"@typescript-eslint/parser": "^2.30.0",
Expand Down
11 changes: 9 additions & 2 deletions packages/jest-worker/src/types.ts
Expand Up @@ -7,7 +7,14 @@

import type {EventEmitter} from 'events';
import type {ForkOptions} from 'child_process';
import type {ResourceLimits} from 'worker_threads';

// import type {ResourceLimits} from 'worker_threads';
// This is not present in the Node 12 typings
export interface ResourceLimits {
maxYoungGenerationSizeMb?: number;
maxOldGenerationSizeMb?: number;
codeRangeSizeMb?: number;
}

// Because of the dynamic nature of a worker communication process, all messages
// coming from any of the other processes cannot be typed. Thus, many types
Expand Down Expand Up @@ -66,7 +73,7 @@ export interface PromiseWithCustomMessage<T> extends Promise<T> {

// Option objects.

export type {ForkOptions, ResourceLimits};
export type {ForkOptions};

export type FarmOptions = {
computeWorkerKey?: (method: string, ...args: Array<unknown>) => string | null;
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Expand Up @@ -3476,10 +3476,10 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:*, @types/node@npm:>= 8":
version: 13.13.4
resolution: "@types/node@npm:13.13.4"
checksum: dc52acb5f3d9c8577abdaf682bb85d3731a090b503e1b5abde62ba426f5d556fa655a1255ebb91cfdd36060205631eb7e7d7daf185e6ebab1ff9f6f4a0605170
"@types/node@npm:*, @types/node@npm:>= 8, @types/node@npm:~10.14.0":
version: 10.14.22
resolution: "@types/node@npm:10.14.22"
checksum: 392965766fc7f221169d62e4dafbfc875ba172ce610ac48fec26eaf572386913bd2c5d2e036bb747bb49923f1ade9eed2b2d09a391cbf5fbaaa864a74a4dad60
languageName: node
linkType: hard

Expand Down Expand Up @@ -16454,7 +16454,7 @@ fsevents@^1.2.7:
"@types/babel__template": ^7.0.0
"@types/dedent": 0.7.0
"@types/jest": 24.0.2
"@types/node": "*"
"@types/node": ~10.14.0
"@types/which": ^1.3.2
"@typescript-eslint/eslint-plugin": ^2.30.0
"@typescript-eslint/parser": ^2.30.0
Expand Down