@termwright/test
@termwright/test
@termwright/test
Section titled “@termwright/test”@termwright/test — the authoring surface for the Termwright Native Host:
Vitest-powered DSL, fixtures, retry-able matchers, semantic YAML snapshots
and cell snapshots. It is not a direct-Vitest compatibility preset.
Importing this module registers the matchers with expect, so a test file
only ever imports test and expect from here.
Example
Section titled “Example”import {fileURLToPath} from 'node:url';import {test, expect} from 'termwright/test';
test('asks before running a command', async ({ terminal }) => { const appFile = fileURLToPath(new URL('../app.js', import.meta.url)); const app = await terminal.launch({ command: [process.execPath, appFile] }); await app.waitForText('Permission required');
await expect(app).toMatchSemanticSnapshot(` - dialog "Permission" [modal]: - button "Approve" [focused] - button /^Rej/ `);
await app.getByRole('button', { name: 'Approve' }).activate(); await expect(app.getByTestId('status')).toHaveText('ACTIVATED approve');});Interfaces
Section titled “Interfaces”- AttachFixtureOptions
- CapturedLog
- CellSnapshotMatcherOptions
- CellSnapshotOptions
- ColorPalette
- LaunchFixtureOptions
- LaunchOverrides
- LogCollection
- LogQuery
- LogSource
- OpenShellFixtureOptions
- PollOptions
- PtyUnavailableReason
- ResolvedTermwrightConfig
- ScreenLocator
- SeedOptions
- SeedTemplate
- SemanticLocator
- SemanticSnapshotMatcherOptions
- SerializeOptions
- StepOptions
- TerminalFactory
- TerminalHarness
- TermwrightConfig
- TermwrightFixtures
- TermwrightMatchers
- TermwrightOptions
- TermwrightRetryOptions
- TermwrightScopeFixture
- TermwrightTestResources
- TermwrightVitestProject
- TestTimeoutClasses
- TextMatcherOptions
Type Aliases
Section titled “Type Aliases”- AnyLocator
- ResourceAwareTestApi
- SeedFile
- SeedFiles
- StateSelection
- StepRunner
- TermwrightExpect
- TermwrightTestAPI
- TraceMode
- UpdateSnapshotsMode