kuceb / cypress-plugin-retries

A Cypress plugin to retry failed tests.
MIT License
237 stars 20 forks source link

Module cannot be found when running in Docker #38

Closed sbattistin closed 4 years ago

sbattistin commented 4 years ago

When trying to run the tests in a Docker container, the module cypress-plugin-retries cannot be found and the tests fail.

The output from the tests is the following.

Fontconfig warning: "/etc/fonts/fonts.conf", line 100: unknown element "blank",

====================================================================================================,

  (Run Starting),

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐,
  │ Cypress:    3.6.1                                                                              │,
  │ Browser:    Electron 73 (headless)                                                             │,
  │ Specs:      1 found (test.js)                                                                  │,
  └────────────────────────────────────────────────────────────────────────────────────────────────┘,

────────────────────────────────────────────────────────────────────────────────────────────────────,
                                                                                                    ,
  Running:  test.js                                                                         (1 of 1),

Oops...we found an error preparing this test file:,

  /cypress-tests/cypress/support/index.js,

The error was:,

Error: Cannot find module 'cypress-plugin-retries' from '/cypress-tests/cypress/support',

This occurred while Cypress was compiling and bundling your test code. This is usually caused by:,

- A missing file or dependency,
- A syntax error in the file or one of its dependencies,

Fix the error in your code and re-run your tests.,

  (Results),

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐,
  │ Tests:        0                                                                                │,
  │ Passing:      0                                                                                │,
  │ Failing:      1                                                                                │,
  │ Pending:      0                                                                                │,
  │ Skipped:      0                                                                                │,
  │ Screenshots:  0                                                                                │,
  │ Video:        true                                                                             │,
  │ Duration:     0 seconds                                                                        │,
  │ Spec Ran:     test.js                                                                          │,
  └────────────────────────────────────────────────────────────────────────────────────────────────┘,

  (Video),

  -  Started processing:  Compressing to 32 CRF                                                     ,
  -  Finished processing: /cypress-tests/cypress/videos/test.js.mp4                      (4 seconds),

====================================================================================================,

  (Run Finished),

       Spec                                              Tests  Passing  Failing  Pending  Skipped  ,
  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐,
  │ ✖  test.js                                    0ms        -        -        1        -        - │,
  └────────────────────────────────────────────────────────────────────────────────────────────────┘,
    ✖  1 of 1 failed (100%)                       0ms        -        -        1        -        -  ,

I tried both to install the module globally and with npm install from the package.json file but the error still shows up.

I need this to be able to run the cypress tests with Jenkins using Docker.

I attached a simple version with all necessary files to reproduce the problem.

CypressTest.zip

sbattistin commented 4 years ago

Closed due to user (me) error

pedbr commented 4 years ago

@sbattistin Hey Stefano,

I'm getting the same error you had when running my CI build. How did you fix it?