-
Notifications
You must be signed in to change notification settings - Fork 652
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
Add flag to set the limit of files to be tested. #434
Add flag to set the limit of files to be tested. #434
Conversation
Example: lhci autorun --collect.numberOfFiles=10 Default is still at 5. A value less or equal than 0 will disable the limit alltogether.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
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.
thanks very much @chronark! great job hunting down the correct places to add all this :)
as for a test case, you can use
lighthouse-ci/packages/cli/test/collect-static-dir-with-urls.test.js
Lines 18 to 35 in 12619d2
it('should collect a static dir with explicit URLs', async () => { | |
const {stdout, stderr, status} = await runCLI( | |
['collect', '-n=1', '--staticDistDir=./', '--url=/child/grandchild.html'], | |
{ | |
cwd: staticDistDir, | |
} | |
); | |
expect(stdout).toMatchInlineSnapshot(` | |
"Started a web server on port XXXX... | |
Running Lighthouse 1 time(s) on http://localhost:XXXX/child/grandchild.html | |
Run #1...done. | |
Done running Lighthouse! | |
" | |
`); | |
expect(stderr).toMatchInlineSnapshot(`""`); | |
expect(status).toEqual(0); | |
}, 180000); |
as a model, you'll just want to adjust the arguments to not provide a URL, use the collect-static-dir-without-urls
fixture dir instead, and then use your flag to limit the URLs to 1
Co-authored-by: Patrick Hulce <[email protected]>
…hthouse-ci into cli-collect-fileNumber-flag
Co-authored-by: Patrick Hulce <[email protected]>
…hthouse-ci into cli-collect-fileNumber-flag
To really test more edge cases I added a new folder with 6 pages, this way we can test the default limit of 5 as well disabling the limit. First I tried to do it in the same fixture folder but that obviously broke other tests because they were pickng up the wrong pages.
Alright here we go. Thank you for guiding me @patrickhulce and for your suggestions, I learned something new :) I added some more tests, so we are testing if it correctly
I had to create a new fixture folder but I hope that is fine. I also added the flag to the configuration.md |
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.
this is great thanks @chronark! 🎉 💯
This would fix #95
Right now lhci will only test 5 files.
With this PR you can specify the limit to any number or even remove it.
Example:
Default is still at 5.
A value less or equal than 0 will disable the limit alltogether.
I didn't write any tests yet, because I never wrote CLI tests before, but I'll get around to it soon.
I just wanted to create a PR first to see if you would even consider adding it.