Closed seeren closed 11 months ago
Can you make a repo I can clone to test with?
We're seeing a similar error here. Also, happens when a command gets imported into a unit test with Jest. This is Node 20 and Jest 29. Seems to be caused by Fig which imports prettier, which uses a dynamic import. I'd recommend to roll the dependency upgrade back in a patch release, then upgrade in a major due to this breakage.
Please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project).
I have the same issue. Here is a reproduction on StackBlitz: https://stackblitz.com/edit/nestjs-typescript-starter-dunbvi?file=src%2Fexample.command.spec.ts&view=editor
Run npm run test
to see the error.
Note: In my actual project I am witnessing this error just from having a Command
be provided by a NestJs module that is under test, even though the Command
itself is not the subject of any tests.
Can I suggest that the Fig completion feature should be an optional dependency, only for those who want it?
Hi I came across the same issue, here's minimum repo which reproduces it:
https://github.com/reg0/nest-command-issue-reproduce/commits/main https://github.com/reg0/nest-command-issue-reproduce/actions/runs/7084465349/job/19278781699
// edit sorry, probably it's very similar to what @sgarner posted above :)
Thank you all for the reproductions, very helpful in testing out a fix locally.
I think for now, I'm going to move the @fig/commander-completion
to an optional import and throw an error if it somehow doesn't get require
d correctly. From a cursory test, this should fix up the errors from Jest.
Should be resolved by 3.12.5
Is there an existing issue that is already proposing this?
Potential Commit/PR that introduced the regression
65f5abce1e04528fa8a70b2a351c904e96db1fc2
Versions
3.12.2 -> 3.12.3
Describe the regression
Jest build fail when import
'nest-commander'
members with following error:Minimum reproduction code
Every source code that import
'nest-commander'
members, a simple example:Then the error occurs when running tests with jest:
jest --verbose --config ./jest-spec.json
Using configuration file:
Test example:
Expected behavior
I expect no error occurs when running tests with jest
Other
No response