Skip to content

Conversation

@sreya
Copy link
Contributor

@sreya sreya commented Nov 25, 2025

No description provided.

- Add init() function to handle WASM loading once at startup
- Remove ghostty parameter from Terminal constructor
- Make open() synchronous again for xterm.js compatibility
- Update all tests to use init() in beforeAll
- Update all demos and README examples
- Simplifies API: await init(); const term = new Terminal();
Created a reusable test helper that ensures complete test isolation
by creating a fresh Ghostty WASM instance for each terminal.

Benefits:
- Single pattern for all tests: await createIsolatedTerminal()
- No manual Ghostty instance management in test files
- Clean slate guarantee - each test has isolated WASM memory
- Parallel-ready - no shared state between tests
- Simpler test code - just one function call

Updated all test files:
- lib/test-helpers.ts: New helper function
- lib/buffer.test.ts: Uses createIsolatedTerminal()
- lib/terminal.test.ts: Uses createIsolatedTerminal()
- lib/scrolling.test.ts: Uses createIsolatedTerminal()
- lib/selection-manager.test.ts: Uses createIsolatedTerminal()
- lib/input-handler.test.ts: Uses fresh Ghostty per test

All 283 tests pass with complete isolation.
@sreya sreya merged commit f9fd565 into main Nov 25, 2025
5 checks passed
@sreya sreya deleted the pull-latest-main branch November 25, 2025 21:41
sreya added a commit that referenced this pull request Nov 25, 2025
The module-level init() was added in PR #60 but demo/bin/demo.js
was not updated to call it, causing:
  'ghostty-web not initialized. Call init() before creating Terminal instances.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant