Skip to content

fix(docs-infra): speed up ng test #39866

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

Closed
wants to merge 1 commit into from

Conversation

cexbrayat
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

There is currently a known issue with the framework when testing that leaks style.
See #31834

A possible temporary workaround is to manually call the service that adds/aremoves the style.
See #31834 (comment)

This workaround will be unnecessary when #38336 lands.

What is the new behavior?

This speeds up the ng test task locally by ~30%:

  • before: Executed 649 of 652 (skipped 3) SUCCESS (24.161 secs / 20.072 secs)
  • after: Executed 649 of 652 (skipped 3) SUCCESS (17.854 secs / 15.584 secs)

Does this PR introduce a breaking change?

  • Yes
  • No

Copy link
Member

@gkalpak gkalpak left a comment

Choose a reason for hiding this comment

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

FWIW, this doesn't make any difference for me 😁
I get around 19-20 secs both with and without this change 🤷‍♂️

(Not sure if that is related, but I am on Windows.)

@@ -14,6 +15,12 @@ getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);

// https://github.com/angular/angular/issues/31834
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// https://github.com/angular/angular/issues/31834
// TODO: Remove this workaround once we update to an Angular version that includes a fix for
// https://github.com/angular/angular/issues/31834.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done 👍

There is currently a known issue with the framework when testing that leaks style.
See angular#31834

A possible temporary workaround is to manually call the service that adds/aremoves the style.
See angular#31834 (comment)

This workaround will be unnecessary when angular#38336 lands.

This speeds up the `ng test` task locally by ~30%:
- before: Executed 649 of 652 (skipped 3) SUCCESS (24.161 secs / 20.072 secs)
- after: Executed 649 of 652 (skipped 3) SUCCESS (17.854 secs / 15.584 secs)
@cexbrayat cexbrayat force-pushed the fix/speedup-aio-tests branch from 24e3b01 to da0a7f5 Compare November 29, 2020 08:14
@gkalpak gkalpak added action: review The PR is still awaiting reviews from at least one requested reviewer comp: docs-infra refactoring Issue that involves refactoring or code-cleanup target: patch This PR is targeted for the next patch release labels Nov 29, 2020
@ngbot ngbot bot added this to the needsTriage milestone Nov 29, 2020
Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

I concur with @gkalpak - I see no real difference with and without this change.

Before:
Executed 649 of 652 (skipped 3) SUCCESS (19.422 secs / 16.503 secs)
Executed 649 of 652 (skipped 3) SUCCESS (19.22 secs / 16.283 secs)
Executed 649 of 652 (skipped 3) SUCCESS (19.539 secs / 16.699 secs)

After:
Executed 649 of 652 (skipped 3) SUCCESS (19.021 secs / 16.243 secs)
Executed 649 of 652 (skipped 3) SUCCESS (19.738 secs / 16.692 secs)
Executed 649 of 652 (skipped 3) SUCCESS (20.074 secs / 17.067 secs)

Note this is running Chrome Headless 84.0.4147.0 (Mac OS 10.16.0

Perhaps the styles issue is not present on a headless browser?

@cexbrayat - can you look into why/how you get the improvement?
If we cannot show a clear improvement then I would not be inclined to land this since it is already a workaround/hack in lieu of the full fix.

@cexbrayat
Copy link
Member Author

cexbrayat commented Nov 30, 2020

Strange, I'm also on MacOS with headless Chome 84 🤔 The "real life" projects we work on saw a 2x-3x improvement as there are thousands of tests. It's also more visible on CI as I guess the memory pressure is more important on smaller machines (and maybe that's the difference between us: I have a fairly old laptop).
No need to waste too much on this, I'll close the PR ;)

@cexbrayat cexbrayat closed this Nov 30, 2020
@cexbrayat cexbrayat deleted the fix/speedup-aio-tests branch November 30, 2020 15:30
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: review The PR is still awaiting reviews from at least one requested reviewer cla: yes refactoring Issue that involves refactoring or code-cleanup target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants