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

@oclif/test v4 runCommand segFaults on linux node < 18.20.0 and < 20.8.0 #556

Open
zmully opened this issue May 31, 2024 · 3 comments
Open
Labels
waiting for interest Waiting to see if there is strong community interest

Comments

@zmully
Copy link

zmully commented May 31, 2024

Describe the bug

Updated our internal cli to use @oclif/[email protected] and the new runCommand segFaults on linux node < 18.20.0 and <20.8.0. I've replicated this on linux x86 and linux arm. This does not happen on macOS for any versions of 18.x or 20.x that I spot tested.

To Reproduce
Steps to reproduce the behavior:

  • I have a test that calls a command with the runCommand method: await expect(runCommand<{ name: string }>(['jira:watch', '-p', 'plat'])).resolves.not.toThrow(); and it segfaults when executed using any of the above node versions.
$ npm test jira

> @zephyr-ai/[email protected] test
> npx projen test jira

👾 test | jest --passWithNoTests --ci jira

 RUNS  test/commands/jira/watch.test.ts
Segmentation fault (core dumped)

If I switch the test and execute the command directly, the test passes: await expect(JiraWatchIssues.run(['-p', 'plat'])).resolves.not.toThrow();

This is not command specific, it segFaults if I execute the default oclif help command: await expect(runCommand<{ name: string }>(['help'])).resolves.not.toThrow();

Environment (please complete the following information):

  • OS & version: [e.g. MacOS Monterey, Ubuntu 20.04.4 LTS, Windows 10]
    • Ubuntu 22.04 ARM and x86
    • Ubuntu 20.04 x86
    • node version < 18.20.0
    • node version < 20.8.0
  • Shell/terminal & version [e.g. bash-3.2, bash-5.0, zsh 5.8, powershell 7.2.4, cmd.exe, Windows Terminal w/ powershell, etc... ]
    • bash 5.1.16

Additional context
Add any other context about the problem here.

@mdonnalley
Copy link
Contributor

@zmully Can you create a repository that replicates the issue?

@zmully
Copy link
Author

zmully commented Jun 4, 2024

Hmm. So there is something weird going on between @oclif/test , @oclif/plugin-warn-if-update-available, jest and the node versions above. mocha doesn't appear to have this problem.

So github.com/zmully/oclif-test-mocha works fine with the @oclif/plugin-warn-if-update-available plugin enabled, and any version of node I tested.

But github.com/zmully/oclif-test-jest segfaults when the @oclif/plugin-warn-if-update-available is enabled, and the node versions above are used. If you disable the plugin, the test runs fine with jest.

I don't really know where to look next, but please let me know if you're also getting segfaults with jest repository...

@mdonnalley
Copy link
Contributor

@zmully I believe this is related to jest's ESM support since plugin-warn-if-update is ESM and the tests seem to be failing when attempting to import a path from the plugin.

You might be able to figure out how to workaround it by following either of these guides:
https://jestjs.io/docs/ecmascript-modules
https://kulshekhar.github.io/ts-jest/docs/guides/esm-support/

I don't have bandwidth to figure it out but if you do, it'd be great if you could post it here so that others can see.

Also worth noting that you can workaround this issue by either downgrading plugin-warn-if-update to v2 (which isn't ESM) or use a newer version of node (v20.13.1 is working for me)

@mdonnalley mdonnalley added waiting for interest Waiting to see if there is strong community interest and removed needs response labels Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for interest Waiting to see if there is strong community interest
Projects
None yet
Development

No branches or pull requests

2 participants