-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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: mock saveLhr and assert no unit test source changes #11519
Conversation
|
.github/workflows/ci.yml
Outdated
@@ -111,6 +111,9 @@ jobs: | |||
- run: yarn diff:sample-json | |||
if: matrix.os == 'windows-latest' | |||
|
|||
# Fail if any changes were written to source files (ex, from -GA). | |||
- run: git diff --exit-code |
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.
Wanna add to the smokes step too?
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.
yeah I'll add everywhere I just noticed it happens on update:sample-json too
the tests should now fail before I fix the update:sample-json path, making sure we're catching this now :) |
LGTM |
6dd264a
to
8d5d6d5
Compare
soooooo @connorjclark after looking at all the places affected by the writing This PR changes the extension to |
I thought the mock you added would prevent this? |
It prevents it in those specific tests but apparently we exercise audit mode in several other places that weren't touched in #11509. Do you have any thoughts on the rest of my comment? |
What if we save in the "artifact folder" if: -A is set and --output includes json? That should avoid the test issues. Currently it's too cumbersome to hold on to a LHR for a run, compared to how easy it is for artifacts. especially combined with your new script to save the latest-run folder. Would also be ok with a new folder in |
For future readers, @connorjclark and I discussed offline and settled on this solution with the addition of |
amusing to look back at the original |
Summary
We wanted to mock the saveLhr function, not just spy it. Also adds the
git diff
test to our github unit test suite :)Related Issues/PRs
fixes https://github.com/GoogleChrome/lighthouse/pull/11509/files#r499844389 and our travis builds