Skip to content

chore: update code to pass tests on Node 15 #10660

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

Merged
merged 2 commits into from
Oct 20, 2020
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 @@ -7,6 +7,7 @@
### Fixes

- `[expect]` Fix `objectContaining` to work recursively into sub-objects ([#10508](https://github.com/facebook/jest/pull/10508))
- `[jest-message-util]` Update to work properly with Node 15 ([#10660](https://github.com/facebook/jest/pull/10660))
- `[jest-mock]` Allow to mock methods in getters (TypeScript 3.9 export) ([#10156](https://github.com/facebook/jest/pull/10156))

### Chore & Maintenance
Expand Down
3 changes: 2 additions & 1 deletion packages/jest-message-util/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const stackUtils = new StackUtils({cwd: 'something which does not exist'});
let nodeInternals: Array<RegExp> = [];

try {
nodeInternals = StackUtils.nodeInternals();
// https://github.com/tapjs/stack-utils/issues/54
nodeInternals = StackUtils.nodeInternals().concat(/\s*\(node:/);
} catch {
// `StackUtils.nodeInternals()` fails in browsers. We don't need to remove
// node internals in the browser though, so no issue.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ it('provides stdout and stderr from the child processes', async () => {
const stdout = worker.getStdout();
const stderr = worker.getStderr();

forkInterface.stdout.end('Hello ', {encoding: 'utf8'});
forkInterface.stderr.end('Jest ', {encoding: 'utf8'});
forkInterface.stdout.end('Hello ', 'utf8');
forkInterface.stderr.end('Jest ', 'utf8');
forkInterface.emit('exit', 1);
forkInterface.stdout.end('World!', {encoding: 'utf8'});
forkInterface.stderr.end('Workers!', {encoding: 'utf8'});
forkInterface.stdout.end('World!', 'utf8');
forkInterface.stderr.end('Workers!', 'utf8');
forkInterface.emit('exit', 0);

await expect(getStream(stdout)).resolves.toEqual('Hello World!');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ it('provides stdout and stderr from the threads', async () => {
const stdout = worker.getStdout();
const stderr = worker.getStderr();

worker._worker.stdout.end('Hello ', {encoding: 'utf8'});
worker._worker.stderr.end('Jest ', {encoding: 'utf8'});
worker._worker.stdout.end('Hello ', 'utf8');
worker._worker.stderr.end('Jest ', 'utf8');
worker._worker.emit('exit');
worker._worker.stdout.end('World!', {encoding: 'utf8'});
worker._worker.stderr.end('Workers!', {encoding: 'utf8'});
worker._worker.stdout.end('World!', 'utf8');
worker._worker.stderr.end('Workers!', 'utf8');
worker._worker.emit('exit', 0);

await expect(getStream(stdout)).resolves.toEqual('Hello World!');
Expand Down