Skip to content

strict() in combination with middleware(async, true) results in unknown command error #2124

@knobladSICKAG

Description

@knobladSICKAG

Description

Using the strict option in combination with an async middleware, which is applied before the validation, results in an unknown command error. Removing the async from the middleware, removing the strict or applying the middleware after the validation produces the expected result (no error).

Minimal example

The following code fails with the error Unknown command: test, although I would expect it to run without error:

Yargs
  .strict(true)
  .middleware(async () => {}, true)
  .command("test", false, () => {}, () => {})
  .parseAsync(['test']);

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions