Lighthouse: Chrome launcher's use of rimraf causes jest tests to fail

Created on 29 Jun 2017  ยท  8Comments  ยท  Source: GoogleChrome/lighthouse

Quoted from https://github.com/isaacs/rimraf/issues/155 -- I think the true issue comes from lighthouse however:

When I run chrome-headless I get the error

assert.js:81
  throw new assert.AssertionError({
  ^
AssertionError: false == true
    at rmdir (/Users/fabio/repo/prerender-chrome-headless/node_modules/chrome-launcher/node_modules/rimraf/rimraf.js:159:5)
    at /Users/fabio/repo/prerender-chrome-headless/node_modules/chrome-launcher/node_modules/rimraf/rimraf.js:95:13
    at FSReqWrap.oncomplete (fs.js:114:15)

The offending line is this one and the assertion fails because originalEr appears not to be an instance of Error.

...

You can reproduce it by cloning this repo and running npm test.

I'm on Mac OSX 10.12.4
Node 7.10.0

It happens on node 6.11.0 and 8.1.2 as well.

For some reason, when lighthouse calls rimraf, it causes standard fs errors to not be instanceof Error. This is causing rimraf's assertions to fail.

cc @piuccio

bug

All 8 comments

@piuccio @tmeasday this seems unrelated to chrome-launcher, this error only occurs when I run the tests and not when using the module. Perhaps jest is wrapping the error in a non-rimraf compliant way?

@patrickhulce I think you are right that Jest is related, and perhaps the culprit. However I've been unable to reproduce with Jest and rimraf alone. Not sure how best to proceed.

thanks @tmeasday for opening the issue here, I've also opened one on jest, hopefully we can get tot the bottom of it

I got the same issue and this is causing jest to crash unexpectedly. When I remove

assert(originalEr instanceof Error)

I works fine!

This somehow tells me that the error been generated by chrome-launcher has not been implemented

interface Error {
    stack?: string;
}

Original error is:

{ Error: EPERM: operation not permitted, unlink '/var/folders/dq/xcd47yps6_74vzsx0szhl878f00nfm/T/lighthouse.XXXXXXX.KvhU8PKp/Local Storage'
        at Error (native)
      errno: -1,
      code: 'EPERM',
      syscall: 'unlink',
      path: '/var/folders/dq/xcd47yps6_74vzsx0szhl878f00nfm/T/lighthouse.XXXXXXX.KvhU8PKp/Local Storage' }

Any idea where that error beeing generated?

Looking into this.. and it appears that upgrading to the latest version of rimraf (2.2.8 โฏ 2.6.1) does fix the problem. So I believe we'll just do that.

[email protected] published with this fix.

Awesome! will try that

I can confirm that it worked. This issue could be closed

Was this page helpful?
0 / 5 - 0 ratings