Make `.lighthouseci` configurable
Describe the bug
When I change outputDir to be /tmp/lhci rather than default .lighhouseci, and make .lighthouseci read only (due to our env constraints and security concerns, all project folder are read only except for /tmp), then I will not be able to run lhci command to generate any report.
To Reproduce Steps to reproduce the behavior:
- Change
.lighthousecito read only:chmod -wx .lighthouseci. - Add
upload.outputDir = '/tmp/lhci'tolighthouserc.js. - Run
lhci healthcheckorlhci collectorlhci autorun. - All commands will fail because
.lighthouseciis not writable even though a different output directory is defined.
Expected behavior
If outputDir is defined to a different writable folder other than default .lighthouseci, I will expect health check will run against the new folder rather than .lighthouseci.
Logs/Screenshots
When I run lhci healthcheck, it will show:
❌ .lighthouseci/ directory not writable
ERROR: EACCES: permission denied, open '/Users/ch/src/example-node-express/.lighthouseci/lhr-1629210143850.json'
✅ Configuration file found
✅ Chrome installation found
Healthcheck failed!
When I run lhci collect, it will show:
Error: EACCES: permission denied, unlink '/Users/ch/src/example-node-express/.lighthouseci/lhr-1629210143850.html'
at Object.unlinkSync (fs.js:1155:3)
at clearSavedReportsAndLHRs (/Users/ch/.nvm/versions/node/v14.1.0/lib/node_modules/@lhci/cli/node_modules/@lhci/utils/src/saved-reports.js:65:8)
at Object.runCommand (/Users/ch/.nvm/versions/node/v14.1.0/lib/node_modules/@lhci/cli/src/collect/collect.js:231:26)
at run (/Users/ch/.nvm/versions/node/v14.1.0/lib/node_modules/@lhci/cli/src/cli.js:103:24)
at Object.<anonymous> (/Users/ch/.nvm/versions/node/v14.1.0/lib/node_modules/@lhci/cli/src/cli.js:137:1)
at Module._compile (internal/modules/cjs/loader.js:1176:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
at Module.load (internal/modules/cjs/loader.js:1040:32)
at Function.Module._load (internal/modules/cjs/loader.js:929:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)%
Environment (please complete the following information):
- OS: [Mac OSX]
- Version [0.8.0]
- Node Version [14.1.0]
Thanks for filing @synergychen! This is expected behavior.
.lighthouseci is not the output dir, but a temporary working directory used regardless of whether upload is ever invoked.
At the moment this is not a customizable property, but we can let this issue track that feature request.
@patrickhulce Thanks for the update! Is there any workaround or hacky way at the moment that could skip the writable .lighthouse check if I want to write the output to different folder?
@synergychen cd to a different directory within /tmp before running LHCI or edit node_modules/@lhci/utils/src/saved-reports.js to whatever directory you'd like.
https://github.com/GoogleChrome/lighthouse-ci/blob/932a5fe98412df705e98e0866600c176db790212/packages/utils/src/saved-reports.js#L10
Great, thanks!