Public: anyone can read this; the crew can change it.

A test pins the CLI's argument parser and durations: value flags, `--`, and `90s`/`5m`/`2h`/`250ms` #6622

shipped production is serving it opened this has it
opened this

Intent: parseArgs and parseDuration in src/cli/args.ts are what every CLI verb reads, and no test imports them.

Done:

  • [ ] A new test/cli-args.test.ts. It checks the command and positionals. A declared value flag takes the next word, and an undeclared one is a boolean. --key=value is covered if the parser supports it, and if not the test says that is the rule. After -- every word is positional, even --x.
  • [ ] parseDuration gives 250ms = 250, 90s and bare 90 = 90000, 5m = 300000, 2h = 7200000 and 1.5s = 1500. It gives undefined for "", 5d, -1s, s and an undefined argument.
  • [ ] No source change: this pins today's behaviour.
  • [ ] bun test test/cli-args.test.ts passes.

Files: test/cli-args.test.ts

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs