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

tests(report-ui-features): fix tools button suite to pass isolated run #10199

Merged
merged 2 commits into from
Jan 9, 2020
Merged

tests(report-ui-features): fix tools button suite to pass isolated run #10199

merged 2 commits into from
Jan 9, 2020

Conversation

johnemau
Copy link
Contributor

@johnemau johnemau commented Jan 8, 2020

Summary
Problem: the tools button test suite fails when run in isolation, for example:

$ npx jest lighthouse-core/test/report/html/renderer/report-ui-features-test.js -t="tools button"
...
Test Suites: 1 failed, 1 total
Tests:       15 failed, 15 total

Root cause: The tools button test suite setup calls ReportUiFeatures.initFeatures
which has an implicit prerequisite on ReportRenderer.renderReport.

The prerequisite was coincidentally being met when other test suites in
the file invoked the render test helper function.

Solution: Invoke the render test helper function in the tools button suite setup.

Related Issues/PRs
#9433

…n in isolation

Problem: the tools button test suite fails when run in isolation, for example:

```bash
$ npx jest lighthouse-core/test/report/html/renderer/report-ui-features-test.js -t="tools button"

...

Test Suites: 1 failed, 1 total
Tests:       15 failed, 15 total
```

Root cause: The tools button test suite setup calls ReportUiFeatures.initFeatures
which has an implicit prerequisite on ReportRenderer.renderReport.

The prerequisite was coincidentally being met when other test suites in
the file invoked the render test helper function.

Solution: Invoke the render test helper function in the tools button suite setup.
@johnemau johnemau changed the title tests(ReportUiFeatures): Fix setup so tools button tests pass when run in isolation tests(ReportUIFeatures): Fix setup so tools button tests pass when run in isolation Jan 8, 2020
@johnemau johnemau changed the title tests(ReportUIFeatures): Fix setup so tools button tests pass when run in isolation tests(ReportUIFeatures): Fix tools button tests to pass isolated run Jan 8, 2020
@johnemau johnemau changed the title tests(ReportUIFeatures): Fix tools button tests to pass isolated run tests(ReportUIFeatures): Fix tools button suite to pass isolated run Jan 8, 2020
@johnemau johnemau changed the title tests(ReportUIFeatures): Fix tools button suite to pass isolated run tests(reportuifeatures): fix tools button suite to pass isolated run Jan 8, 2020
Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

Thanks @johnemau!

This LGTM too, but one alternative to consider :)

@connorjclark connorjclark changed the title tests(reportuifeatures): fix tools button suite to pass isolated run tests(report-ui-features): fix tools button suite to pass isolated run Jan 8, 2020
@patrickhulce patrickhulce merged commit 9c5d31a into GoogleChrome:master Jan 9, 2020
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.

4 participants