Skip to content

CLI argument of object form (e.g. --sequence.no-such-arg) isn't validated #9056

@hi-ogawa

Description

@hi-ogawa

Describe the bug

When I testing #9026, I made a typo like vitest --experimental.fsCache (the actual one is --experimental.fsModuleCache) and it took sometime to realize why cache is not working.

It looks like some of other nested form CLI arguments behave similar way:

$ vitest --sequence.no-such-arg

 DEV  v4.0.10 /home/projects/vitest-dev-vitest-uzxirchq

 ✓ test/suite.test.ts (3 tests) 3ms
 ✓ test/basic.test.ts (3 tests) 2ms

 Test Files  2 passed (2)
      Tests  6 passed (6)
   Start at  12:47:30
   Duration  714ms (transform 62ms, setup 0ms, collect 105ms, tests 5ms, environment 0ms, prepare 18ms)

 PASS  Waiting for file changes...
       press h to show help, press q to quit

❯ vitest --sequenceeee.no-such-arg
CACError: Unknown option `--sequenceeee`
    at Command.checkUnknownOptions (file:///home/projects/vitest-dev-vitest-uzxirchq/node_modules/vitest/dist/chunks/cac.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-uzxirchq?file=package.json

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 20.19.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @vitest/ui: latest => 4.0.10 
    vite: latest => 7.2.2 
    vitest: latest => 4.0.10

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions