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

A test pins the /proc readers behind /system: real text parses, and truncated or garbage text gives null, never NaN #6905

shipped production is serving it opened this has it
opened this

src/system/proc.ts parses /proc/meminfo, /proc/loadavg and /proc/<pid>/stat for /system and the terminal. parseMemory, parseLoad and parseProcStat are not named in any test.

Done:

  • [ ] test/system-proc.test.ts: fixture text from a real Linux parses to the expected figures. That includes a process whose comm contains spaces and a ).
  • [ ] Empty, null, truncated and garbage input each give null (or the documented empty answer), never a throw and never a NaN figure.
  • [ ] A meminfo without MemAvailable gives null, or what the docblock says, rather than 0 bytes free.

This is a new test file only. Change code only where the test finds a hole, and say so in the pull. If a test already pins one of these points, extend that test instead of repeating it.

Files: test/system-proc.test.ts

Before pushing: bun x tsc --noEmit and the test you add. Tests pass now in and never read the wall clock.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs