Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CSR-635] Support ESM #125

Closed
MadSandwich opened this issue Apr 21, 2023 · 11 comments · Fixed by #137
Closed

[CSR-635] Support ESM #125

MadSandwich opened this issue Apr 21, 2023 · 11 comments · Fixed by #137
Labels
enhancement New feature or request

Comments

@MadSandwich
Copy link

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

@MadSandwich MadSandwich added the enhancement New feature or request label Apr 21, 2023
@samixchoumi
Copy link

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
Copy link
Contributor

agoldis commented Jun 13, 2023

@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
Copy link
Author

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

@agoldis
Copy link
Contributor

agoldis commented Jun 15, 2023

@MadSandwich
Please share your debug logs (and refer to #142)

@MadSandwich
Copy link
Author

@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
Copy link
Contributor

agoldis commented Jun 15, 2023

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

@MadSandwich
Copy link
Author

@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
Copy link
Contributor

agoldis commented Jun 15, 2023

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

@MadSandwich
Copy link
Author

@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
Copy link
Contributor

agoldis commented Jun 21, 2023

@MadSandwich Please try using [email protected], should be good for ESM on Windows

@MadSandwich
Copy link
Author

@MadSandwich Please try using [email protected], should be good for ESM on Windows

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

@agoldis agoldis changed the title Support ESM [CSR-635] Support ESM Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants