import lighthouse from 'lighthouse';
describe('My First Test', function() {
it('Does not do much!', function() {
expect(true).to.equal(true);
});
});
repo with example:
https://github.com/bote795/cypress-test-tiny
npm run cypress:run
Doesn't really get past the first line
Error: Cannot find module 'intl' from '/Users/nicolasbotello/Documents/workspace/code/rmc/node_modules/lighthouse/lighthouse-core/lib/i18n'
file to run successfully don't get any errors.
Related issues
Not sure if this is a lighthouse or cypress issue?
intl is a dev dep for LH, which is why you don't get it installed when adding lighthouse to your package.json deps.
You can add intl and it will fix it (but then the next missing module comes up, bufferutil ...)
As to what LH should change, maybe intl should be part of our dependencies? @brendankenny / @exterkamp might know more, I'm not very familiar with how i18n.js works.
Also, thanks for providing a repro! Very useful.
@connorjclark so if i add intl then bufferutil, it will just continue to ask to install everything right?
Maybe? We don't even use bufferutil - it is included via ws devDeps much like how we include intl (in a try/catch):

I'm guessing cypress doesn't like that paradigm very much. If there's one issue to report to cypress, that may be it.
This sounds like a cypress issue. All of these require statements are guarded by try/catch and in normal node execution should pass right on through the optional requires just fine.
That being said, we should probably be moving our intl dependency to dependencies though as @connorjclark points out. Right now most node consumers probably don't know they would need to install this package manually for complete i18n support.
so I added bufferutil, intl, utf-8-validate
Then I got the following error
Uncaught TypeError: require.resolve is not a function
This error originated from your test code, not from Cypress.
When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
Cypress could not associate this error to any specific test.
We dynamically generated a new test to display this failure.
will follow up with the cypress team.
Thanks for y'alls help!
@bote795 I am working in the same approach (cypress + lighthouse) and facing the same issue. Could you find a workaround?