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

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

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
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
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
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
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