vitest-dev / vitest-dev/vitest
CLI argument of object form (e.g. `--sequence.no-such-arg`) isn't validated
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 17.1k
- Forks
- 2k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 94
Description
Describe the bug
When I testing https://github.com/vitest-dev/vitest/pull/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
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior with vitest --sequence.no-such-arg and compare it with vitest --sequenceeee.no-such-arg, which already reports an unknown option. Trace the CLI argument parsing and validation for nested options; done means object-form typos are rejected instead of silently accepted, with coverage for the reported examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100