You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am setting up some unit tests around a commander.js cli tool. I verify that the args and opts the program is holding onto internally matches expectations for each test. It seems that subcommands, and possibly the Command object in general, is holding onto options between executions.
This means, if I test a command with options and then test the same command without any options, the second test will still have the options from the first execution.
// test with options passprogram.parse(['program','command','-o','stuff']);// test without options still have previous optionsprogram.parse(['program','command']);// '-o' and 'stuff' will still be parsed
I am currently working around this issue by manually clearing options between each test -- see the following:
This is just a short description to notify the commander.js maintainer. I think the issue is probably a simple reset of _optionValues or class properties more generally...If more detail is required, I can fill out a more detailed ticket upon request.
The text was updated successfully, but these errors were encountered:
I am setting up some unit tests around a commander.js cli tool. I verify that the args and opts the program is holding onto internally matches expectations for each test. It seems that subcommands, and possibly the
Command
object in general, is holding onto options between executions.This means, if I test a command with options and then test the same command without any options, the second test will still have the options from the first execution.
I am currently working around this issue by manually clearing options between each test -- see the following:
This is just a short description to notify the commander.js maintainer. I think the issue is probably a simple reset of
_optionValues
or class properties more generally...If more detail is required, I can fill out a more detailed ticket upon request.The text was updated successfully, but these errors were encountered: