Test Commands
Frompackage.json and AGENTS.md:
Unit Testing
Test Setup
Macro uses Vitest with SolidJS testing library:Example Test
Frompackages/core/tests/date.test.ts:
Testing Patterns
Pure FunctionsEnd-to-End Testing
Playwright Setup
Macro uses Playwright for E2E tests:Playwright Authentication
The app uses cookie-based authentication withcredentials: 'include'. For Playwright testing, you must intercept requests and add the Authorization header.
Authentication Steps
FromAGENTS.md:
1. Generate Access Token
Requires .env file with:
/signup before auth kicks in. Force navigate again:
The app checks authentication via API calls toWebSocket Limitation:.macro.comendpoints usingcredentials: 'include'. Without valid cookies or an auth header,useIsAuthenticated()returns false and theSoupcomponent redirects to/→/signup. The initial redirect happens before route interception can authenticate the first requests, but forcing a second navigation resolves this.
WebSocket connections (for real-time features) won’t be authenticated with this approach since Playwright’s route interception only works for HTTP/HTTPS. This is fine for most UI testing scenarios.
Playwright Testing Patterns
NavigationTesting Principles
FromAGENTS.md:
Write Tests for Changes
Testing - Write tests for your changes. When fixing bugs or regressions, identify the issue with a test before fixing it.Workflow:
- Write failing test that reproduces bug
- Fix the bug
- Verify test passes
- Commit both test and fix
Incremental Testing
Write and run tests incrementally for business logic using bun run test.
Pattern:
- Write pure function
- Write test immediately
- Run test:
bun run test -- path/to/file.test.ts - Iterate until passing
- Move to next function
Test Pure Logic
Decoupling - Decouple pure business logic from UI and network layer.Test business logic separately from UI:
Debugging Tests
Console Debugging
FromAGENTS.md:
You can use console.trace to debug state and changes in the ui and logic.
Playwright Debugging
Vitest UI
http://localhost:51204/__vitest__/.
Test Organization
File Naming
- Use
.test.tsor.test.tsxsuffix - Co-locate tests with code when possible
- Use
tests/directory for integration tests