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

Windows path with the --format option works in v7, is broken in v8 #1920

Closed
ironduke71 opened this issue Feb 7, 2022 · 5 comments · Fixed by #1963
Closed

Windows path with the --format option works in v7, is broken in v8 #1920

ironduke71 opened this issue Feb 7, 2022 · 5 comments · Fixed by #1963
Assignees
Labels
🐛 bug Defect / Bug
Milestone

Comments

@ironduke71
Copy link

Testing version 8.0.0-rc.2 running directly from Intellij IDEA via the Cucumber.js plugin. It generates a command line such as this:

C:\Dev\Apps\nodejs\node.exe C:\Dev\ws\sandbox\NLRTestAutomation\node_modules@cucumber\cucumber\bin\cucumber-js C:\Dev\ws\sandbox\NLRTestAutomation\features\search-plan.feature --tags @env-shared --format c:\Dev\Home\ideau\plugins\CucumberJavaScript\lib\cucumberjs_formatter_v7.js --format-options "{"cucumberLibPath": "C:/Dev/ws/sandbox/NLRTestAutomation/node_modules/@cucumber/cucumber/lib"}" --format-options "{"colorsEnabled": true}" --publish-quiet --require C:/Dev/ws/sandbox/NLRTestAutomation/features

It immediately fails with this error:

Error: EISDIR: illegal operation on a directory, open 'C:\Dev\ws\sandbox\NLRTestAutomation'

Expected behavior

Running the same with version 7.3.2 worked fine.

Desktop

  • OS: Windows 10
  • Browser: n/a
  • Version: n/a

Additional context

It appears the cause is having the Windows drive letter in the path. If I change this:

--format c:\Dev\Home\ideau\plugins\CucumberJavaScript\lib\cucumberjs_formatter_v7.js

To this:

--format \Dev\Home\ideau\plugins\CucumberJavaScript\lib\cucumberjs_formatter_v7.js

It works fine.

@aurelien-reeves
Copy link
Contributor

Hi @ironduke71

Thanks for the report!

Could you make a try with cucumber v8.0.0-rc.1? That would help us identify if the issue has been introduced with rc.1 or rc.2

@ironduke71
Copy link
Author

Hi,

With 8.0.0-rc.1 it gives a different error:

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:727:11)
    at Loader.resolve (internal/modules/esm/loader.js:97:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:243:28)
    at Loader.import (internal/modules/esm/loader.js:178:28)
    at importModuleDynamically (internal/modules/cjs/loader.js:1081:27)
    at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:37:14)
    at importer (C:\Dev\ws\sandbox\NLRTestAutomation\node_modules\@cucumber\cucumber\lib\importer.js:10:3)
    at Object.loadCustomClass (C:\Dev\ws\sandbox\NLRTestAutomation\node_modules\@cucumber\cucumber\src\formatter\builder.ts:99:15)
    at Object.getConstructorByType (C:\Dev\ws\sandbox\NLRTestAutomation\node_modules\@cucumber\cucumber\src\formatter\builder.ts:66:32)
    at Object.build (C:\Dev\ws\sandbox\NLRTestAutomation\node_modules\@cucumber\cucumber\src\formatter\builder.ts:38:57)
    at C:\Dev\ws\sandbox\NLRTestAutomation\node_modules\@cucumber\cucumber\src\cli\index.ts:150:39
    at Array.map (<anonymous>)
    at Cli.initializeFormatters (C:\Dev\ws\sandbox\NLRTestAutomation\node_modules\@cucumber\cucumber\src\cli\index.ts:96:15)
    at Cli.run (C:\Dev\ws\sandbox\NLRTestAutomation\node_modules\@cucumber\cucumber\src\cli\index.ts:194:32)
    at async Object.run [as default] (C:\Dev\ws\sandbox\NLRTestAutomation\node_modules\@cucumber\cucumber\src\cli\run.ts:24:14)

@aurelien-reeves
Copy link
Contributor

Thanks 👍

@davidjgoss davidjgoss added the 🐛 bug Defect / Bug label Feb 9, 2022
@davidjgoss davidjgoss added this to the ESM milestone Feb 9, 2022
@davidjgoss
Copy link
Contributor

davidjgoss commented Feb 17, 2022

I think this will be related to the change to use import instead of require to load support code.

@davidjgoss
Copy link
Contributor

To elaborate a bit, import requires everything to be a valid URL, and Windows absolute paths including the drive letter aren't. But if you include the file protocol prefix it should work. So like:

--format file:///c:\Dev\Home\ideau\plugins\CucumberJavaScript\lib\cucumberjs_formatter_v7.js

More about this: nodejs/node#31710

Assuming I'm not wrong we should just need to document this in the changelog and migration guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Defect / Bug
Projects
None yet
3 participants