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

Consider defaulting .local-chrome/ to .dart_tool/puppeteer/local-chrome/ #329

Open
jonasfj opened this issue Jul 18, 2024 · 0 comments
Open

Comments

@jonasfj
Copy link

jonasfj commented Jul 18, 2024

I imagine that the most common use case for package:puppeteer is to run from test. Probably inside test/mytestcase_test.dart, which is then triggered by dart test (or flutter test).

In such scenarios must application developers have a .dart_tool/ folder which is almost always listed in .gitignore.

Note that the "Project-specific caching for tools" section of the "Package layout conventions" specifies that packages are allowed to cache things in .dart_tool/<package>/.

When .dart_tool/ exists, consider using .dart_tool/puppeteer/local-chrome/ as the default place to cache chrome.
If .dart_tool/ doesn't exist, then using a different folder might make more sense (or one could simply choose to throw StateError and demand that the caller supplies a location).

You can find .dart_tool/ using: Isolate.packageConfigSync?.resolve('.').toFilePath() (assuming it's not null)

This would make puppeteer a bit nicer to use in tests. But also note that if you do this, it might be important keep track of when .dart_tool/puppeteer/local-chrome/ needs to be deleted. If you want to update the chrome version you've downloaded it's your responsibility to clear this cache folder (.dart_tool/puppeteer/).


also, HUGE thanks building this really awesome package! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant