Skip to content

Commit 460add9

Browse 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 efc7f91 commit 460add9

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

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

Lines 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
thrownewError();
99
}
10-
(asyncfunction(){awaitfn();})();
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(asyncfunction(){awaitfn();})();
1411
}
1512

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

19-
constret=spawnSync(process.execPath,[__filename,'async']);
16+
constret=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+
conststderr=ret.stderr.toString('utf8',0,2048);
22+
assert.ok(!/async.*hook/i.test(stderr));
23+
assert.ok(stderr.includes('UnhandledPromiseRejectionWarning: Error'),stderr);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
'use strict';
22
constcommon=require('../common');
3-
constassert=require('assert');
4-
constcp=require('child_process');
53
conststdoutData='foo';
64
conststderrData='bar';
7-
constexpectedStdout=`${stdoutData}\n`;
8-
constexpectedStderr=`${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+
constassert=require('assert');
12+
constcp=require('child_process');
13+
constexpectedStdout=`${stdoutData}\n`;
14+
constexpectedStderr=`${stderrData}\n`;
1515
functionrun(options,callback){
1616
constcmd=`"${process.execPath}" "${__filename}" child`;
1717

0 commit comments

Comments
 (0)