-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Modernize the code in the test/downloadutils.mjs
file
#17431
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
Conversation
callback("Too many redirects"); | ||
return new Promise((resolve, reject) => { | ||
protocol | ||
.get(url, async function (response) { |
Check warning
Code scanning / CodeQL
File data in outbound network request
try { | ||
await downloadFile(file, url); | ||
} catch (ex) { | ||
console.error(`Error during downloading of ${url}: ${ex}`); |
Check warning
Code scanning / CodeQL
Log injection
a3d7711
to
2d1eb93
Compare
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.241.84.105:8877/45a74cab8616d23/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.193.163.58:8877/e9fb7825701e97b/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/45a74cab8616d23/output.txt Total script time: 23.97 mins
Image differences available at: http://54.241.84.105:8877/45a74cab8616d23/reftest-analyzer.html#web=eq.log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so much nicer, thanks for continuing this clean-up!
r=me, with a few suggestions; thank you!
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/e9fb7825701e97b/output.txt Total script time: 37.86 mins
Image differences available at: http://54.193.163.58:8877/e9fb7825701e97b/reftest-analyzer.html#web=eq.log |
The test helper code largely predates the introduction of modern JavaScript features and should be refactored to improve readability. In particular callbacks make the code harder to understand and maintain. This commit: - replaces the callback argument with returning a promise; - uses `const` instead of `var`; - uses arrow functions for shorter code; - uses template strings for shorter string formatting code; - uses `Array.includes` for shorter response code checking code.
…per functions The test helper code largely predates the introduction of modern JavaScript features and should be refactored to improve readability. In particular callbacks make the code harder to understand and maintain. This commit: - replaces the callback argument with returning a promise; - replaces the recursive function calls with a simple loop; - uses `const`/`let` instead of `var`; - uses arrow functions for shorter code; - uses template strings for shorter string formatting code.
This commit changes the code to use a template string and to use `const` instead of `var`. Combined with the previous commits this allows for enabling the ESLint `no-var` rule for this file now.
2d1eb93
to
f9a0d4e
Compare
/botio unittest |
From: Bot.io (Linux m4)ReceivedCommand cmd_unittest from @timvandermeij received. Current queue size: 0 Live output at: http://54.241.84.105:8877/91317d121675df4/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_unittest from @timvandermeij received. Current queue size: 0 Live output at: http://54.193.163.58:8877/f8edef3a8f7a7b7/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/91317d121675df4/output.txt Total script time: 2.40 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.193.163.58:8877/f8edef3a8f7a7b7/output.txt Total script time: 10.61 mins
|
The commit messages contain more details about the individual changes. Using the
?w=1
parameter can help for reviewing some of the commits.Follow-up on #17367.