Skip to content

Commit

Permalink
chore: update code to pass tests on Node 15 (#10660)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Oct 20, 2020
1 parent 9488714 commit f4d6a18
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
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

0 comments on commit f4d6a18

Please sign in to comment.