Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3e7741c

Browse filesBrowse files
BridgeARMylesBorins
authored andcommitted
test: reduce runtime
This refactors some tests to reduce the runtime of those. PR-URL: #20688 Refs: #20128 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Yang Guo <yangguo@chromium.org>
1 parent c8c9211 commit 3e7741c
Copy full SHA for 3e7741c

File tree

Expand file treeCollapse file tree

2 files changed

+12
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-10
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-async-wrap-pop-id-during-load.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-async-wrap-pop-id-during-load.js
+8-6Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ if (process.argv[2] === 'async') {
77
fn();
88
throw new Error();
99
}
10-
(async function() { await fn(); })();
11-
// While the above should error, just in case it doesn't the script shouldn't
12-
// fork itself indefinitely so return early.
13-
return;
10+
return (async function() { await fn(); })();
1411
}
1512

1613
const assert = require('assert');
1714
const { spawnSync } = require('child_process');
1815

19-
const ret = spawnSync(process.execPath, [__filename, 'async']);
16+
const ret = spawnSync(
17+
process.execPath,
18+
['--stack_size=50', __filename, 'async']
19+
);
2020
assert.strictEqual(ret.status, 0);
21-
assert.ok(!/async.*hook/i.test(ret.stderr.toString('utf8', 0, 1024)));
21+
const stderr = ret.stderr.toString('utf8', 0, 2048);
22+
assert.ok(!/async.*hook/i.test(stderr));
23+
assert.ok(stderr.includes('UnhandledPromiseRejectionWarning: Error'), stderr);
Collapse file

‎test/parallel/test-child-process-exec-encoding.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-exec-encoding.js
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
'use strict';
22
const common = require('../common');
3-
const assert = require('assert');
4-
const cp = require('child_process');
53
const stdoutData = 'foo';
64
const stderrData = 'bar';
7-
const expectedStdout = `${stdoutData}\n`;
8-
const expectedStderr = `${stderrData}\n`;
95

106
if (process.argv[2] === 'child') {
117
// The following console calls are part of the test.
128
console.log(stdoutData);
139
console.error(stderrData);
1410
} else {
11+
const assert = require('assert');
12+
const cp = require('child_process');
13+
const expectedStdout = `${stdoutData}\n`;
14+
const expectedStderr = `${stderrData}\n`;
1515
function run(options, callback) {
1616
const cmd = `"${process.execPath}" "${__filename}" child`;
1717

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.