currents-dev / cypress-cloud

Debug, troubleshoot and record Cypress CI tests in Cloud
https://currents.dev
Other
47 stars 16 forks source link

[CSR-635] Support ESM #125

Closed MadSandwich closed 1 year ago

MadSandwich commented 1 year ago

Description

Support ESM to parse path correctly. (I hope I describe it at least understandable =) )

Example usage

Set type:module in package.json file and use default config to run tests: image

samixchoumi commented 1 year ago

A must have, using @badeball/cypress-cucumber-preprocessor, if I remove type:module, it will crash my run command.

2023-06-13T13:14:38.196Z cypress:lifecycle:child:RunPlugins:50466 plugins file errored: TypeError: Cannot read properties of undefined (reading 'addCucumberPreprocessorPlugin')

agoldis commented 1 year ago

@MadSandwich @samixchoumi

please check out https://github.com/currents-dev/cypress-cloud/releases/tag/v1.8.0-beta.5

npm i cypress-cloud@beta
MadSandwich commented 1 year ago

@agoldis unfortunately for me, it's still reproducing. image in package.json -> "cypress-cloud": "^1.8.0-beta.5",

agoldis commented 1 year ago

@MadSandwich Please share your debug logs (and refer to https://github.com/currents-dev/cypress-cloud/issues/142)

MadSandwich commented 1 year ago

@agoldis unfortunately I can't share such logs, they have information that I couldn't share. But I've created a minimal reproducible example. https://github.com/MadSandwich/Cypress

And here the error that I've receive with such setup, I have same configurations on my real repo and same errors, so that probably could help to find where an actual problem. (Maybe I missing something. All settings in the config was set to likely non-existing, just to show an error) image

agoldis commented 1 year ago

@MadSandwich please remove the sensitive information, it'd greatly speed up the troubleshooting. And thanks for sharing the exampl

MadSandwich commented 1 year ago

@samixchoumi

  1. It was done in my previous example.
  2. Yes, I've double checked, that I use beta version.

Here is the simple video of trying 2 ways of configuration. https://github.com/currents-dev/cypress-cloud/assets/57759145/99d9a11e-ae90-4d01-bdbe-5876fc96674c

@agoldis, I've made an repo where u can check everything you need, because, I not sure, that I cover all needed for you details. Hope it will help u more.

agoldis commented 1 year ago

@MadSandwich can you please enable the debug mode and share the logs from the repo you created. Thank you

MadSandwich commented 1 year ago

@agoldis

> cy:ci
> cypress-cloud --parallel --record --ci-build-id 1

  currents:capture capturing stdout +0ms
  cypress:cli exporting Cypress module interface +0ms
  currents:cli parsed CLI flags { component: false, e2e: true, parallel: true, record: true, headed: false, ciBuildId: '1' } +0ms
  currents:cli parsed run params: { parallel: true, record: true, headed: false, ciBuildId: '1', config: undefined, env: undefined, reporterOptions: undefined, testingType: 'e2e', recordKey: undefined } +2ms
  currents:run run params { parallel: true, record: true, headed: false, ciBuildId: '1', config: undefined, env: undefined, reporterOptions: undefined, testingType: 'e2e', recordKey: undefined } +0ms
  currents:run params after preprocess { parallel: true, record: true, headed: false, ciBuildId: '1', config: undefined, env: undefined, reporterOptions: undefined, testingType: 'e2e', recordKey: undefined, spec: undefined } +1ms
  currents:config loading currents config file from 'C:\Users\Artem\projects\Cypress\currents.config.js' +0ms
  currents:config failed loading config file from: Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file and data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:' +2ms
  currents:config loading currents config file from 'C:\Users\Artem\projects\Cypress\currents.config.cjs' +1ms
  currents:config failed loading config file from: Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file and data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:' +1ms
  currents:config loading currents config file from 'C:\Users\Artem\projects\Cypress\currents.config.mjs' +1ms
  currents:config failed loading config file from: Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file and data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:' +0ms
 WARNING  Failed to load config file, falling back to the default config. Attempted locations: [
  'C:\\Users\\Artem\\projects\\Cypress\\currents.config.js',
  'C:\\Users\\Artem\\projects\\Cypress\\currents.config.cjs',
  'C:\\Users\\Artem\\projects\\Cypress\\currents.config.mjs'
]
  currents:validateParams resolving currents params: { parallel: true, record: true, headed: false, ciBuildId: '1', config: undefined, env: undefined, reporterOptions: undefined, testingType: 'e2e', recordKey: undefined, spec: undefined } +0ms
  currents:validateParams resolving currents config file: { e2e: { batchSize: 3 }, component: { batchSize: 5 }, cloudServiceUrl: 'https://cy.currents.dev' } +1ms
  currents:validateParams validating currents params: { parallel: true, record: true, headed: false, ciBuildId: '1', config: undefined, env: undefined, reporterOptions: undefined, testingType: 'e2e', recordKey: undefined, spec: undefined, cloudServiceUrl: 'https://cy.currents.dev', projectId: undefined, batchSize: 3 } +0ms
 ERROR  Cannot resolve projectId. Please use one of the following:
- provide it as a "projectId" property for "run" API method
- set CURRENTS_PROJECT_ID environment variable
- set "projectId" in "currents.config.{c}js" file
agoldis commented 1 year ago

@MadSandwich Please try using cypress-cloud@1.8.0-beta.6, should be good for ESM on Windows

MadSandwich commented 1 year ago

@MadSandwich Please try using cypress-cloud@1.8.0-beta.6, should be good for ESM on Windows

Everything looks good. Thanks! The issue can be closed after merging this fix.