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! :rocket:
I imagine that the most common use case for
package:puppeteer
is to run from test. Probably insidetest/mytestcase_test.dart
, which is then triggered bydart test
(orflutter 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 throwStateError
and demand that the caller supplies a location).You can find
.dart_tool/
using:Isolate.packageConfigSync?.resolve('.').toFilePath()
(assuming it's notnull
)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! :rocket: