Cypress: Getting Uncaught Error: Your OS "browser" is currently not supported by node-cachedir.

Created on 29 Jun 2019  ยท  4Comments  ยท  Source: cypress-io/cypress

Current behavior:

I'm running Cypress for my Angular project and suddenly the last few days cypress started throwing the following error both locally and in my CI environment.

  1)  An uncaught error was detected outside of a test:
     Uncaught Error: Your OS "browser" is currently not supported by node-cachedir.

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.

Desired behavior:

Not to explode, or at least give me more feedback as to what is actually wrong :'(

Steps to reproduce: (app code and test code)

Here is my app repo: https://github.com/bradtaniguchi/ng-flare/tree/93aad47d0b5fe446638802c38320890c726dec13
If you wanted to run the project just run npm install and then npm run e2e to start cypress.

cypress config: https://github.com/bradtaniguchi/ng-flare/blob/93aad47d0b5fe446638802c38320890c726dec13/projects/main-client-e2e/cypress.json

Versions

(I also tried 3.3.1)

  • Cypress: 3.3.2
  • Chrome Version: 75.0.3770.100 (Official Build) (64-bit)
  • Electron Version: 59
  • System:
Distributor ID: Debian
Description:    Debian GNU/Linux 9.9 (stretch)
Release:        9.9
Codename:       stretch

Let me know if I should provide any logs, or extra information. I couldn't find any docs/info on the error so I'll be happy to provide more info, any info to help debug this issue. :)


Edit

// from this
getCacheDir () {
    return cachedir('Cypress')
  }

// to this:
getCacheDir () {
    const val = cachedir('Cypress');
    console.log('get cacheDir', val);
    return val;
  }

This is then printed:
get cacheDir /home/bradtaniguchi/.cache/Cypress linux
which prints out twice after Angular compiles, and before cypress prints (Run Starting).

Finally here is the full stack (right after the Angular build), as I realized I didn't provide it the first time.

====================================================================================================

  (Run Starting)

  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ Cypress:    3.1.0                                                                              โ”‚
  โ”‚ Browser:    Electron 59                                                                        โ”‚
  โ”‚ Specs:      1 found (login.spec.js)                                                            โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜


โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

  Running: login.spec.js...                                                                (1 of 1) 

Warning: Cypress can only record videos when running headlessly.

You have set the 'electron' browser to run headed.

A video will not be recorded when using this mode.


  1) An uncaught error was detected outside of a test

  0 passing (686ms)
  1 failing

  1)  An uncaught error was detected outside of a test:
     Uncaught Error: Your OS "browser" is currently not supported by node-cachedir.

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.
      at http://localhost:4200/__cypress/tests?p=../../dist/out-tsc/apps/main-client-e2e/src/integration/login.spec.js-733:37092:13
      at Object.<anonymous> (http://localhost:4200/__cypress/tests?p=../../dist/out-tsc/apps/main-client-e2e/src/integration/login.spec.js-733:37094:2)
      at Object.230._process (http://localhost:4200/__cypress/tests?p=../../dist/out-tsc/apps/main-client-e2e/src/integration/login.spec.js-733:37110:4)
      at o (http://localhost:4200/__cypress/tests?p=../../dist/out-tsc/apps/main-client-e2e/src/integration/login.spec.js-733:1:265)
      at http://localhost:4200/__cypress/tests?p=../../dist/out-tsc/apps/main-client-e2e/src/integration/login.spec.js-733:1:316
      at Object.<anonymous> (http://localhost:4200/__cypress/tests?p=../../dist/out-tsc/apps/main-client-e2e/src/integration/login.spec.js-733:44371:16)
      at Object.367../logger (http://localhost:4200/__cypress/tests?p=../../dist/out-tsc/apps/main-client-e2e/src/integration/login.spec.js-733:44583:4)
      at o (http://localhost:4200/__cypress/tests?p=../../dist/out-tsc/apps/main-client-e2e/src/integration/login.spec.js-733:1:265)
      at http://localhost:4200/__cypress/tests?p=../../dist/out-tsc/apps/main-client-e2e/src/integration/login.spec.js-733:1:316
      at Object.<anonymous> (http://localhost:4200/__cypress/tests?p=../../dist/out-tsc/apps/main-client-e2e/src/integration/login.spec.js-733:42599:12)
      at Object.353../lib/cypress (http://localhost:4200/__cypress/tests?p=../../dist/out-tsc/apps/main-client-e2e/src/integration/login.spec.js-733:42622:4)
      at o (http://localhost:4200/__cypress/tests?p=../../dist/out-tsc/apps/main-client-e2e/src/integration/login.spec.js-733:1:265)
      at http://localhost:4200/__cypress/tests?p=../../dist/out-tsc/apps/main-client-e2e/src/integration/login.spec.js-733:1:316
      at Object.193.../e2e-config.env (http://localhost:4200/__cypress/tests?p=../../dist/out-tsc/apps/main-client-e2e/src/integration/login.spec.js-733:33164:1)
      at o (http://localhost:4200/__cypress/tests?p=../../dist/out-tsc/apps/main-client-e2e/src/integration/login.spec.js-733:1:265)
      at r (http://localhost:4200/__cypress/tests?p=../../dist/out-tsc/apps/main-client-e2e/src/integration/login.spec.js-733:1:431)




  (Results)

  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ Tests:        1             โ”‚
  โ”‚ Passing:      0             โ”‚
  โ”‚ Failing:      1             โ”‚
  โ”‚ Pending:      0             โ”‚
  โ”‚ Skipped:      0             โ”‚
  โ”‚ Screenshots:  1             โ”‚
  โ”‚ Video:        false         โ”‚
  โ”‚ Duration:     0 seconds     โ”‚
  โ”‚ Spec Ran:     login.spec.js โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜


  (Screenshots)

  - /home/bradtaniguchi/Projects/ng-flare/dist/out-tsc/apps/main-client-e2e/screenshots/login.spec.js/An uncaught error was detected outside of a test (failed).png (2176x1182)


====================================================================================================

  (Run Finished)


      Spec                                                Tests  Passing  Failing  Pending  Skipped 
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ โœ– login.spec.js                             622ms        1        -        1        -        - โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
    1 of 1 failed (100%)                        622ms        1        -        1        -        -  

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] e2e: `ng e2e "--project=main-client-e2e-cypress"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/bradtaniguchi/.npm/_logs/2019-06-30T08_26_21_184Z-debug.log

Most helpful comment

This error is happening due to the import 'cypress'; at the top of the login.spec file. If I remove this, the test continues normally. Any reason you are importing this there?

To recreate:

Run the following with cypress open or cypress run

import 'cypress'

Screen Shot 2019-07-01 at 11 13 32 AM

All 4 comments

This error is happening due to the import 'cypress'; at the top of the login.spec file. If I remove this, the test continues normally. Any reason you are importing this there?

To recreate:

Run the following with cypress open or cypress run

import 'cypress'

Screen Shot 2019-07-01 at 11 13 32 AM

I added import 'cypress' to help fix errors I was getting from VSCode saying cy is not known or cypress types affecting my normal karma/jasmine .spec files. I assume in my haste of trying different things to fix the linting issues I left the import there and totally forgot about it and never thought about the repercussions of it!

**So yes just removing import 'cypress' did the trick!!!
๐Ÿ˜„

Check out our TypeScript doc for some linting help https://on.cypress.io/typescript-support

You can also add /// <reference types="cypress" /> to the top of your file.

We had the same issue on our team. It was an imported lib that caused the issue. Lib was useless so our fix was just removing this new import. Hope this will help future QAs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rbung picture rbung  ยท  3Comments

brian-mann picture brian-mann  ยท  3Comments

Francismb picture Francismb  ยท  3Comments

jennifer-shehane picture jennifer-shehane  ยท  3Comments

dkreft picture dkreft  ยท  3Comments