treosh / lighthouse-ci-action

Audit URLs using Lighthouse and test performance with Lighthouse CI.
MIT License
1.15k stars 82 forks source link

setting configPath leads to "Cannot find module" #47

Closed paulirish closed 4 years ago

paulirish commented 4 years ago

the configPath is loaded relative to the action's own sourcecode.

In this commit https://github.com/ChromeDevTools/debugger-protocol-viewer/commit/27154fb38db8dfcc620f3bf60b841a3aad4dad47 ...

you can see configPath: ./.lighthouserc.js

I was attempting to reference the .lighthouserc.js you see in the same commit. But it failed to find it: image (run link)

probably because these lines expect a path that resolves from cwd/pwd: https://github.com/treosh/lighthouse-ci-action/blob/65160cbe7b83b16f57e39eef26e26a28bc720e16/src/config.js#L28-L29

The readme has the example of configPath: ./lighthouserc.json so i figured it would be read local to my checkout instead of local to the action's source.

some path.resolve() should sort this out?

alekseykulikov commented 4 years ago

fixed in treosh/lighthouse-ci-action@v3

alekseykulikov commented 4 years ago

For some reason, the bug only affects .js config files. Starting to use .js files in test workflows in addition to .json.