Vacuous CLI tests and untested --files, --changed-since, targetVersion edges

Aperta
#113 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
godot, typescript
Ambito
cli, testing-qa

Direzione di ricerca

Start with the listed cases in test/cli.test.ts, test/entry.test.ts, and test/removed-api.test.ts, then read the related CLI and version inference code in src/project/godot-version.ts. Run npm run build && npm test and check how the tests handle relative paths, Git errors, skipped built CLI tests, and version parsing. Done when the listed edge cases are covered and the tests run or skip with clear reasons.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

severity: low testing

Summary

Several CLI tests claim more than they check or can pass without running anything, and --files, --changed-since and targetVersion inference have untested edges.

Where

  • test/cli.test.ts:210-217: the "--files lints only the named files (relative or absolute ...)" test passes only absolute paths.
  • test/cli.test.ts:238-242: the --changed-since test returns, and so passes, if git init throws. Its commits also lack -c commit.gpgsign=false, so a developer with global commit signing enabled gets a confusing failure.
  • test/entry.test.ts:50,57,64,73: the built-CLI exit-code tests call ctx.skip() when dist/cli.js is missing. Running npm test without a build silently skips the only real-process exit-code tests. CI builds first, so CI is fine.
  • src/project/godot-version.ts:6-40 and test/removed-api.test.ts:80-118.

Test cases and fixes

  • Relative --files with the cwd at the root, and with the cwd elsewhere (vi.spyOn(process, "cwd")).
  • --changed-since with the root at repo/game: only files under game/ are returned, root-relative, including untracked files.
  • --files x.gd --changed-since HEAD: the union, without duplicates.
  • A file deleted since the ref: not reported, and no crash.
  • A renamed file reports the new path.
  • A root that is not a git work tree: exit 2 with "git diff failed".
  • --changed-since=-x: rejected with exit 2.
  • Replace the bare return with ctx.skip("git unavailable"), and pass -c commit.gpgsign=false.
  • Fail loudly when CI is set and dist/ is missing, or build in a vitest globalSetup.
  • config/features=PackedStringArray("4.10"): ordering is numeric. "4.3", "4.5" gives "4.5".
  • "5.0": pin the behaviour. Today it maps to "4.5" and applies the 4.x DB to Godot 5; it should probably be null or warn.
  • An unparseable project.godot gives godotVersion: null and does not throw.

Getting started

  • Relevant files: test/cli.test.ts, test/entry.test.ts, test/removed-api.test.ts
  • How to run tests: npm run build && npm test

Filed by repo-audit/full-audit at e836036. Severity: low. Effort: S. audit-key: testing|test/cli.test.ts|--files/--changed-since

Lingua principale
TypeScript
Stelle
0
Fork
6
Merge medio
1g 21h
PR unite (30g)
8

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TMHSDigital/godot-correctness-mcp

Tutte le issue di TMHSDigital/godot-correctness-mcp

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.