inspector/clients/tui/package.json
cliffhall a3bb679f1e fix: strip ANSI from TUI test frames so FORCE_COLOR cannot break assertions (#2207)
Ink writes styling as escape sequences inside the styled run, so an
accelerator underline splits the word it decorates: `<Text underline>I</Text>nfo`
reaches the frame buffer with escapes between `I` and `nfo`, and a plain
`toContain("Info")` fails against a component that is rendering correctly.
Chalk only emits color when it detects a TTY, so CI stays green and the six
failures land only on a developer whose shell exports FORCE_COLOR.

Add `__tests__/helpers/renderTui.tsx` — ink-testing-library's `render` with
`lastFrame()` and `frames` ANSI-stripped — and point all 16 renderer test
files at it. `frames` is a getter reading through to the live array, since
Ink appends to it as the component re-renders; the raw bytes stay reachable
as `stdout.lastFrame()`.

Pinning FORCE_COLOR=0 would turn the six green while hiding the class: any
future assertion on styled text has the same problem, and the suite would
stop covering the styled path at all.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MFp2LVH7UJST5i8bDBJghw
Signed-off-by: cliffhall <cliff@futurescale.com>
2026-09-06 20:00:15 -04:00

48 lines
1.4 KiB
JSON

{
"name": "@modelcontextprotocol/inspector-tui",
"private": true,
"description": "Terminal User Interface (TUI) for the Model Context Protocol inspector",
"license": "MIT",
"type": "module",
"main": "build/index.js",
"exports": {
".": "./build/index.js"
},
"bin": {
"mcp-inspector-tui": "./build/index.js"
},
"files": [
"build",
"README.md"
],
"scripts": {
"dev": "vite-node --config vitest.config.ts dev.ts",
"build": "tsup",
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.test.json",
"validate": "npm run format:check && npm run lint && npm run typecheck && npm run build && npm run test",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"lint": "eslint . --max-warnings 0",
"format": "prettier --write src __tests__ \"*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}\"",
"format:check": "prettier --check src __tests__ \"*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}\""
},
"dependencies": {
"ink": "^6.0.0",
"ink-form": "^2.0.1",
"ink-scroll-view": "^0.3.6"
},
"overrides": {
"ink-select-input": "^6.2.0",
"esbuild": "^0.28.2"
},
"devDependencies": {
"@types/react": "^19.2.14",
"eslint-plugin-react-hooks": "^7.1.1",
"ink-testing-library": "^4.0.0",
"strip-ansi": "^7.1.2",
"tsup": "^8.5.0",
"tsx": "^4.21.0",
"vite": "^8.1.5",
"vite-node": "^6.0.0"
}
}