8000 feat(test): Miscellaneous improvements to `test_tasks.js` by cpcallen · Pull Request #6615 · google/blockly · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(test): Miscellaneous improvements to test_tasks.js #6615

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

Merged
merged 3 commits into from
Nov 16, 2022

Conversation

cpcallen
Copy link
Contributor

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide
  • I ran npm run format and npm run lint

The details

Proposed Changes

  • feat: Modify runTestBlock so that it can run any async task, not just ones that return a Promise, by using the async-done package (part of Gulp, and already an indirect dependency) to detect task completion. Celebrate by renaming it to runTestTask.
  • Create a Tester class to encapsulate the runTestTask, reportTestResult and runAll functions.
  • Remove the --silent flag from npm scripts so as not to suppress syntax error in gulpfiles.
  • Have the test task invoke the buildAdvancedCompilationTest task (via onlyBuildAdvancedCompilationTest, to skip already-run prerequisites) directly, rather than by running npm.

Reason for Changes

  • Generally cleaner code.
  • Remove npm scripts that aren't intended to be used by humans.

< 10000 div id="event-7794123842" data-view-component="true" class="TimelineItem js-targetable-element">
@cpcallen cpcallen requested a review from a team as a code owner November 11, 2022 18:09
@github-actions github-actions bot added PR: feature Adds a feature and removed PR: feature Adds a feature labels Nov 11, 2022
@BeksOmega BeksOmega requested review from BeksOmega and removed request for rachel-fenichel November 14, 2022 18:15
Copy link
Collaborator
@BeksOmega BeksOmega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly confused about the decision to make a Tester class. Otherwise generally LGTM, but want to understand that before approving.

@@ -32,48 +32,84 @@ const BOLD_GREEN = '\x1b[1;32m';
const BOLD_RED = '\x1b[1;31m';
const ANSI_RESET = '\x1b[0m';

let failerCount = 0;
class Tester {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the advantage of encapsulating these in a class?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly just to remove the failerCount global variable, and allow us to also count successes without adding a second global.

Modify runTestBlock so that it can run any async task, not just
ones that return a Promise, by using the async-done package
(part of Gulp, and already an indirect dependency) to detect
task completion.

Celebrate by renaming it to runTestTask.
- Create Tester class to encapsulate the runTestTask,
  and reportTestResult and runAll functions.

- Remove the unnecessary id parameter from runTestTask (code was
  already using the .name of the task function object).

- Remove --silent flag from npm scripts so as not to suppress
  syntax error in gulpfiles.
Have the test task invoke the buildAdvancedCompilationTest
(via onlyBuildAdvancedCompilationTest, to skip already-run
prerequisites) directly, rather than by running npm.
@cpcallen
Copy link
Contributor Author

There were merge conflicts, and it seems like I forgot a needed require from test_tasks.js (did I not test this locally? I'm sure I did, and yet…) so I did a rebase and force-push.

Just awaiting approval, assuming you think my justification for the Tester class is sufficient.

@cpcallen cpcallen merged commit 54670d5 into google:develop Nov 16, 2022
@cpcallen cpcallen deleted the improve-test-tasks branch November 16, 2022 18:19
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
0