mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-20 15:33:54 +00:00
fix(js): fix long-time broken tests
(
This commit is contained in:
parent
7b3f3047ab
commit
5d41ad710c
4 changed files with 14 additions and 13 deletions
|
|
@ -4,15 +4,16 @@
|
|||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "npm run build --prefix packages/hermes-ink && tsx --watch src/entry.tsx",
|
||||
"dev": "npm run build:ink && tsx --watch src/entry.tsx",
|
||||
"start": "tsx src/entry.tsx",
|
||||
"build": "node scripts/build.mjs",
|
||||
"build:ink": "npm run build --prefix packages/hermes-ink",
|
||||
"typecheck": "tsc --noEmit -p tsconfig.json",
|
||||
"lint": "eslint src/ packages/",
|
||||
"lint:fix": "eslint src/ packages/ --fix",
|
||||
"fmt": "prettier --write 'src/**/*.{ts,tsx}' 'packages/**/*.{ts,tsx}'",
|
||||
"fix": "npm run lint:fix && npm run fmt",
|
||||
"check": "npm run typecheck && npm run test",
|
||||
"check": "npm run build:ink && npm run typecheck && npm run test",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ describe('cursor-drift regression — composer cursorLayout matches Ink renderin
|
|||
).toEqual(expected)
|
||||
}
|
||||
}
|
||||
})
|
||||
}, 10_000)
|
||||
|
||||
it('keeps cursor on the same row when text exactly fills the terminal width', () => {
|
||||
// wrap-ansi does NOT push exact-fill text onto a phantom next line.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { busyIndicatorWidth, statusBarSegments, statusRuleWidths } from '../components/appChrome.js'
|
||||
import { busyIndicatorWidth, StatusBarSegments, statusBarSegments, statusRuleWidths } from '../components/appChrome.js'
|
||||
|
||||
describe('statusRuleWidths', () => {
|
||||
it('keeps the status rule within the terminal width', () => {
|
||||
|
|
@ -69,8 +69,7 @@ describe('statusBarSegments', () => {
|
|||
voice: true,
|
||||
bg: true,
|
||||
subagents: true,
|
||||
cost: true
|
||||
})
|
||||
} satisfies StatusBarSegments)
|
||||
})
|
||||
|
||||
it('collapses the context bar to a token count on narrow terminals', () => {
|
||||
|
|
@ -79,19 +78,17 @@ describe('statusBarSegments', () => {
|
|||
expect(s.compactCtx).toBe(true)
|
||||
expect(s.bar).toBe(false)
|
||||
expect(s.duration).toBe(false)
|
||||
expect(s.cost).toBe(false)
|
||||
})
|
||||
|
||||
it('sheds tail segments in priority order as the terminal narrows', () => {
|
||||
// cost is the first to go, the context bar the last of the tail.
|
||||
// the context bar is the last of the tail to go.
|
||||
const order: (keyof ReturnType<typeof statusBarSegments>)[] = [
|
||||
'bar',
|
||||
'duration',
|
||||
'compressions',
|
||||
'voice',
|
||||
'bg',
|
||||
'subagents',
|
||||
'cost'
|
||||
'subagents'
|
||||
]
|
||||
|
||||
let prevCount = Infinity
|
||||
|
|
|
|||
|
|
@ -18,10 +18,13 @@ describe('virtual height estimates', () => {
|
|||
})
|
||||
|
||||
it('uses compound user prompt width when estimating user message wrapping', () => {
|
||||
const msg: Msg = { role: 'user', text: 'x'.repeat(21) }
|
||||
// cols must clear the 20-col body-width floor for both prompts (gutter +
|
||||
// horizontalReserve=4) so the wider 'Ψ >' prompt actually narrows the
|
||||
// body enough to wrap an extra line vs the single-cell '❯' prompt.
|
||||
const msg: Msg = { role: 'user', text: 'x'.repeat(23) }
|
||||
|
||||
expect(estimatedMsgHeight(msg, 26, { compact: false, details: false, userPrompt: '❯' })).toBe(3)
|
||||
expect(estimatedMsgHeight(msg, 26, { compact: false, details: false, userPrompt: 'Ψ >' })).toBe(4)
|
||||
expect(estimatedMsgHeight(msg, 30, { compact: false, details: false, userPrompt: '❯' })).toBe(3)
|
||||
expect(estimatedMsgHeight(msg, 30, { compact: false, details: false, userPrompt: 'Ψ >' })).toBe(4)
|
||||
})
|
||||
|
||||
it('adds one row for a group-boundary lead gap', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue