speed up ufuzz asynchronous testing (#4750)

This commit is contained in:
Alex Lam S.L
2021-03-07 20:25:56 +00:00
committed by GitHub
parent f52b0e7c31
commit e4848a7f5a
2 changed files with 47 additions and 29 deletions

View File

@@ -27,7 +27,7 @@ exports.run_code = semver.satisfies(process.version, "0.8") ? function(code, top
} : semver.satisfies(process.version, "<0.12") ? run_code_vm : function(code, toplevel, timeout) {
if ([
/\basync[ \t]*\([\s\S]*?\)[ \t]*=>/,
/\b(async[ \t]+function|setInterval|setTimeout)\b/,
/\b(async[ \t]+function|setImmediate|setInterval|setTimeout)\b/,
/\basync([ \t]+|[ \t]*\*[ \t]*)[^\s()[\]{},.&|!~=*%/+-]+(\s*\(|[ \t]*=>)/,
].some(function(pattern) {
return pattern.test(code);
@@ -175,12 +175,14 @@ function setup(global, builtins, setup_log, setup_tty) {
[
// for Node.js v0.12
"Buffer",
"clearImmediate",
"clearInterval",
"clearTimeout",
// for Node.js v0.12
"DTRACE_NET_STREAM_END",
// for Node.js v8
"process",
"setImmediate",
"setInterval",
"setTimeout",
].forEach(function(name) {