Skip to content
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

Modernize the code in the test/downloadutils.mjs file #17431

Merged
merged 3 commits into from
Dec 17, 2023

Conversation

timvandermeij
Copy link
Contributor

@timvandermeij timvandermeij commented Dec 17, 2023

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.

test/downloadutils.mjs Dismissed Show dismissed Hide dismissed
test/downloadutils.mjs Dismissed Show dismissed Hide dismissed
@timvandermeij
Copy link
Contributor Author

/botio test

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://54.241.84.105:8877/45a74cab8616d23/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://54.193.163.58:8877/e9fb7825701e97b/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/45a74cab8616d23/output.txt

Total script time: 23.97 mins

  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 14
  different first/second rendering: 3

Image differences available at: http://54.241.84.105:8877/45a74cab8616d23/reftest-analyzer.html#web=eq.log

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a 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!

test/downloadutils.mjs Outdated Show resolved Hide resolved
test/downloadutils.mjs Outdated Show resolved Hide resolved
test/downloadutils.mjs Outdated Show resolved Hide resolved
@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/e9fb7825701e97b/output.txt

Total script time: 37.86 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 28

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.
@timvandermeij
Copy link
Contributor Author

/botio unittest

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_unittest from @timvandermeij received. Current queue size: 0

Live output at: http://54.241.84.105:8877/91317d121675df4/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_unittest from @timvandermeij received. Current queue size: 0

Live output at: http://54.193.163.58:8877/f8edef3a8f7a7b7/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/91317d121675df4/output.txt

Total script time: 2.40 mins

  • Unit Tests: Passed

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/f8edef3a8f7a7b7/output.txt

Total script time: 10.61 mins

  • Unit Tests: Passed

@timvandermeij timvandermeij merged commit 34eb6fe into mozilla:master Dec 17, 2023
9 checks passed
@timvandermeij timvandermeij deleted the modernize-test branch December 17, 2023 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants