currents-dev / cypress-debugger

Debug failed CI cypress tests with cloud-based replayable traces
https://cypress-debugger.dev
Other
54 stars 10 forks source link

[CSR-810] Dynamic require of "@neuralegion/cypress-har-generator/commands" is not supported #59

Closed estefafdez closed 1 year ago

estefafdez commented 1 year ago

Before opening, please confirm:

Environment information

``` Related with this issue: https://github.com/currents-dev/cypress-cloud/issues/179 "cypress": "13.1.0", "cypress-cloud": "1.9.4", "cypress-debugger": "^1.0.9",

Describe the bug

When running the tests in Jenkins with the new Cypress version, we got the following error:

11:47:24  Copyright (C) 2023 Currents Software Inc https://currents.dev/
11:47:24  This is free software, and you are welcome to redistribute it under certain
11:47:24  conditions. This program comes with no warranty. Parts of this program are MIT
11:47:24  licensed. Refer to the license for details
11:47:24  https://github.com/currents-dev/cypress-cloud/blob/main/LICENSE.md
11:47:24  
11:47:26  
11:47:26  
11:47:26    (Attempt 1 of 2) An uncaught error was detected outside of a test
11:47:26    1) An uncaught error was detected outside of a test
11:47:26  
11:47:26    0 passing (910ms)
11:47:26    1 failing
11:47:26  
11:47:26    1) An uncaught error was detected outside of a test:
11:47:26       Error: The following error originated from your test code, not from Cypress.
11:47:26  
11:47:26    > Dynamic require of "@neuralegion/cypress-har-generator/commands" is not supported
11:47:26  
11:47:26  When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
11:47:26  
11:47:26  Cypress could not associate this error to any specific test.
11:47:26

Expected behavior

You can execute the tests properly.

Command and Setup

### Command (share the exact `cypress` or `cypress-cloud` command you're running) I downloaded this repo code, and I saw this problem: ![image](https://github.com/currents-dev/cypress-debugger/assets/6990209/570603c1-cb1e-4061-9a83-21dd9a016097) Same problem as our error: `> Dynamic require of "@neuralegion/cypress-har-generator/commands" is not supported` File: cypress-debugger/packages/support/src/cy/cy.ts ```

Full log and debug output

11:47:24  Copyright (C) 2023 Currents Software Inc https://currents.dev/
11:47:24  This is free software, and you are welcome to redistribute it under certain
11:47:24  conditions. This program comes with no warranty. Parts of this program are MIT
11:47:24  licensed. Refer to the license for details
11:47:24  https://github.com/currents-dev/cypress-cloud/blob/main/LICENSE.md
11:47:24  
11:47:26  
11:47:26  
11:47:26    (Attempt 1 of 2) An uncaught error was detected outside of a test
11:47:26    1) An uncaught error was detected outside of a test
11:47:26  
11:47:26    0 passing (910ms)
11:47:26    1 failing
11:47:26  
11:47:26    1) An uncaught error was detected outside of a test:
11:47:26       Error: The following error originated from your test code, not from Cypress.
11:47:26  
11:47:26    > Dynamic require of "@neuralegion/cypress-har-generator/commands" is not supported
11:47:26  
11:47:26  When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
11:47:26  
11:47:26  Cypress could not associate this error to any specific test.
11:47:26
agoldis commented 1 year ago

@vCaisim would appreciate your help here

estefafdez commented 1 year ago

any update on this issue? thanks!

agoldis commented 1 year ago

@estefafdez I am not able to reproduce, do you happen to have a small repro? currents-2023-09-11-10 52 39@2x

p.s. @vCaisim did you have any luck?

agoldis commented 1 year ago

@estefafdez would appreciate a reproducible mini example - seems like it has something to do with the ESM configuration of your project. We are having trouble reproducing it.

estefafdez commented 1 year ago

@estefafdez would appreciate a reproducible mini example - seems like it has something to do with the ESM configuration of your project. We are having trouble reproducing it.

Hello @agoldis , I don't understand the ESM, can you tell me how can I change that? I still get the same issue :(

estefafdez commented 1 year ago

@agoldis the problem was resolved by adding this line on the tsconfig.json

"module": "ESNext"

Thanks! :)