/** * Ensures /bin/clear stays aligned with bare-os-booter terminal-escapes.js * (kernel scripts cannot import the booter module). */ import test from 'node:test' import assert from 'node:assert/strict' import { readFile } from 'node:fs/promises' import { dirname, join } from 'node:path' import { fileURLToPath } from 'node:url' const __dirname = dirname(fileURLToPath(import.meta.url)) /** Source must use hex escapes (not raw ESC bytes) so the file stays printable UTF-8 */ const expectedSourceLiteral = "const seq = '\\x1b[H\\x1b[3J\\x1b[2J\\x1b[0m'" test('clear.js uses xterm scrollback + viewport clear sequence', async () => { const src = await readFile(join(__dirname, '../src/clear.js'), 'utf8') assert.ok( src.includes(expectedSourceLiteral), 'clear.js must use the canonical xterm clear sequence (sync with bare-os-booter terminal-escapes.js)' ) })