Skip to content

Commit ce457af

Browse files
committed
docs: update testing docs and justfile for reorganized test commands
Restructure justfile test commands: test → all fast tests (Rust+TS), test-rust → Rust only, test-nix → nix flake check (absorbs test-full, check-nix), remove test-all (redundant). Update all 6 docs to match.
1 parent 68ab3ce commit ce457af

6 files changed

Lines changed: 237 additions & 89 deletions

File tree

doc/2026-03-29T00-00-00Z_reference_testing_architecture/2026-03-29T00-00-00Z_reference_testing_architecture.md

Lines changed: 175 additions & 44 deletions
Large diffs are not rendered by default.

pkgs/id/AGENTS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,14 @@ just ci # CI-safe read-only checks (no modifications)
106106
just fix # Auto-fix formatting and lint issues
107107
just serve # Serve with web UI [requires bun]
108108
just run # Run CLI with arguments
109+
just test # All fast tests (Rust + TypeScript unit + typecheck)
109110
just test-unit # Unit tests only (fast)
111+
just test-e2e # Playwright E2E (146 tests, chromium + firefox)
112+
just test-nix # nix flake check (26 checks including VM Playwright)
110113
```
111114

115+
**Testing architecture:** See [`doc/testing-architecture`](../../doc/2026-03-29T00-00-00Z_reference_testing_architecture/2026-03-29T00-00-00Z_reference_testing_architecture.md) for the complete 6-layer testing reference, browser coverage matrix, environment comparison, and "when to add tests where" decision tree.
116+
112117
Ask user before updating dependencies.
113118

114119
## CLI Commands

pkgs/id/ARCHITECTURE.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,14 @@ The build script (`scripts/build.sh`) tracks the current variant in `target/.bui
225225

226226
## Testing
227227

228-
| Layer | Framework | Command | Count |
229-
| ----------- | ------------ | -------------------- | ----- |
230-
| Unit | `cargo test` | `just test-unit` | 484 |
231-
| Integration | `cargo test` | `just test-int` | 64 |
232-
| TypeScript | `bun test` | `just test-web-unit` ||
233-
| E2E | Playwright | `just test-e2e` | 15 |
234-
235-
Integration tests that require network (serve_tests) are skipped in sandbox environments. Playwright E2E tests run against both Chromium and Firefox.
228+
| Layer | Framework | Command | Count |
229+
| -------------- | ------------ | -------------------- | ------ |
230+
| Unit | `cargo test` | `just test-unit` | ~500 |
231+
| Integration | `cargo test` | `just test-int` | ~85 |
232+
| TypeScript | `bun test` | `just test-web-unit` | ~116 |
233+
| E2E | Playwright | `just test-e2e` | 146 |
234+
| NixOS VM (API) | curl/Python | `just test-nixos-serve` | ~15 |
235+
| NixOS VM (DOM) | Chromium | `just test-nixos-e2e` | ~10 |
236+
| NixOS 4-VM (Playwright) | Playwright | `nix build .#checks.x86_64-linux.nixos-playwright-e2e` | 146 |
237+
238+
Integration tests that require network (`serve_tests`) are skipped in sandbox environments. Playwright E2E tests run against both Chromium and Firefox. The 4-VM Playwright test runs the full interactive suite inside NixOS VMs where Chromium works (unlike the nix build sandbox). See [`doc/testing-architecture`](../../doc/2026-03-29T00-00-00Z_reference_testing_architecture/2026-03-29T00-00-00Z_reference_testing_architecture.md) for the complete testing reference.

pkgs/id/README.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,22 +183,26 @@ This provides: Rust 1.89.0, clippy, rustfmt, cargo-llvm-cov, cargo-audit, cargo-
183183
### Testing
184184

185185
```bash
186-
just test-unit # Unit tests (fast)
187-
just test-int # Integration tests
188-
just test # All Rust tests
189-
just test-web-unit # TypeScript unit tests
190-
just test-web # All web tests
191-
just test-e2e # Playwright E2E (chromium + firefox)
186+
just test # All fast tests (Rust + TypeScript unit + typecheck)
187+
just test-rust # Rust tests only (~500 unit + ~85 integration)
188+
just test-unit # Unit tests only (fast, ~500 tests)
189+
just test-integration # Integration tests only (~85 tests)
190+
just test-web-unit # TypeScript unit tests (~116 assertions)
191+
just test-e2e # Playwright E2E (chromium + firefox, 146 tests)
192+
just test-nix # nix flake check (26 checks including VM Playwright)
192193
just ci # Full CI check suite
193194
just check # Fix + CI (run before committing)
194195
```
195196

197+
See [`doc/testing-architecture`](../../doc/2026-03-29T00-00-00Z_reference_testing_architecture/2026-03-29T00-00-00Z_reference_testing_architecture.md) for the complete testing reference: 6 test layers, browser coverage matrix, environment comparison, and when to add tests where.
198+
196199
### Nix
197200

198201
```bash
199202
nix build # Build web variant
200203
nix build .#id-lib # Build lib variant
201-
nix flake check -L # Run all CI checks in sandbox
204+
just test-nix # Run all 26 CI checks in sandbox (aliases: test-full, check-nix)
205+
nix build .#checks.x86_64-linux.nixos-playwright-e2e # Full Playwright in 4 NixOS VMs
202206
```
203207

204208
## Project Structure
@@ -238,12 +242,18 @@ web/ # TypeScript frontend
238242
├── styles/ # Terminal CSS, themes, editor styles
239243
└── dist/ # Built assets (embedded in binary)
240244
241-
e2e/ # Playwright E2E tests
242-
├── tests/basic.spec.ts # 15 tests across chromium + firefox
243-
└── playwright.config.ts # Browser config with nix paths
245+
e2e/ # Playwright E2E tests (38 tests × 2 browsers = 146)
246+
├── tests/basic.spec.ts # 19 UI fundamental tests
247+
├── tests/websocket.spec.ts # 19 WS + collaboration tests
248+
└── playwright.config.ts # 3-mode config: local / nix sandbox / VM test
249+
250+
nix/tests/ # NixOS VM integration tests
251+
├── serve-test.nix # HTTP API test (curl, ~15 assertions)
252+
├── e2e-test.nix # Chromium --dump-dom DOM test (~10 assertions)
253+
└── playwright-e2e-test.nix # 4-VM full Playwright (146 interactive tests)
244254
245255
tests/
246-
└── cli_integration.rs # 64 integration tests
256+
└── cli_integration.rs # ~85 integration tests
247257
```
248258

249259
## Documentation

pkgs/id/WEB.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,10 @@ src/web/
104104
└── markdown.rs # Markdown rendering with syntax highlighting
105105
106106
e2e/
107-
├── playwright.config.ts # Chromium + Firefox config
107+
├── playwright.config.ts # 3-mode config: local / nix sandbox / VM test
108108
└── tests/
109-
└── basic.spec.ts # 15 E2E tests
109+
├── basic.spec.ts # 19 UI fundamental tests
110+
└── websocket.spec.ts # 19 WS + collaboration tests
110111
```
111112

112113
### Justfile Commands
@@ -261,15 +262,15 @@ just test-unit
261262

262263
### E2E Tests
263264

264-
Playwright tests run against both Chromium and Firefox:
265+
Playwright tests run against both Chromium and Firefox (38 tests × 2 browsers = 146 total):
265266

266267
```bash
267-
just test-e2e # Both browsers
268-
just test-e2e-chromium # Chromium only
269-
just test-e2e-firefox # Firefox only
268+
just test-e2e # Both browsers (146 tests)
269+
just test-e2e-chromium # Chromium only (73 tests)
270+
just test-e2e-firefox # Firefox only (73 tests)
270271
```
271272

272-
Tests cover: home page elements, file creation, editor features, navigation, themes.
273+
Tests cover: home page elements, file creation, editor features, navigation, themes, WebSocket connection/disconnect/reconnect, collaborative editing, multi-user scenarios, tag live updates.
273274

274275
Browser paths are configured via environment variables for nix compatibility:
275276

pkgs/id/justfile

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,14 @@ just-recipes:
208208

209209
# Run all Rust tests
210210
[group('test')]
211-
test:
211+
test-rust:
212212
cargo test --all-features
213+
alias test-cargo := test-rust
214+
215+
# Run all fast tests (Rust + TypeScript unit + typecheck)
216+
[group('test')]
217+
test: test-rust test-web-unit test-web-typecheck
218+
@echo "✓ All fast tests passed (Rust + TypeScript)!"
213219

214220
# Run all Rust tests (sandbox-safe: excludes tests requiring network)
215221
[group('test')]
@@ -224,8 +230,9 @@ alias test-lib := test-unit
224230

225231
# Run integration tests only
226232
[group('test')]
227-
test-int:
233+
test-integration:
228234
cargo test --all-features --test cli_integration
235+
alias test-int := test-integration
229236

230237
# Run integration tests (sandbox-safe: excludes serve_tests requiring network)
231238
[group('test')]
@@ -244,7 +251,7 @@ test-one NAME:
244251

245252
# [bun] Run web tests (Rust + TypeScript unit tests + type checking)
246253
[group('test')]
247-
test-web: test test-web-unit test-web-typecheck
254+
test-web: test-rust test-web-unit test-web-typecheck
248255
@echo "✓ All web tests passed!"
249256
alias web-typecheck := test-web
250257

@@ -263,18 +270,14 @@ test-web-unit:
263270
test-web-typecheck:
264271
cd web && bun run typecheck
265272

266-
# Run ALL tests including serve_tests and E2E (requires network + built binary) [bun]
267-
[group('test')]
268-
test-all: test test-web-unit test-web-typecheck test-e2e
269-
@echo "✓ All tests passed (including serve_tests + E2E)!"
270-
271-
# Run every test: nix flake check (25 sandboxed checks) + E2E with both browsers outside sandbox
273+
# Run nix flake check (26 sandboxed checks: lint, test, E2E, NixOS VM tests, VM Playwright)
272274
[group('test')]
273-
test-full:
275+
test-nix:
274276
nix flake check
275-
@echo "✓ nix flake check passed (25 checks including Firefox E2E + NixOS VM tests)"
276-
just test-e2e
277-
@echo "✓ All tests passed (nix flake check + Chromium & Firefox E2E)!"
277+
@echo "✓ nix flake check passed (26 checks including VM Playwright + NixOS VM tests)"
278+
alias test-full := test-nix
279+
alias check-nix := test-nix
280+
alias nix-check := test-nix
278281

279282
# =============================================================================
280283
# E2E Tests (Playwright - requires built web variant + network)
@@ -648,14 +651,9 @@ update-nixpkgs-unstable-only:
648651
just update-input $inputs
649652

650653
# =============================================================================
651-
# Nix
654+
# Nix (individual VM tests — prefer test-nix for full suite)
652655
# =============================================================================
653656

654-
# Run nix flake check (full sandboxed CI, only x86_64-linux)
655-
[group('nix')]
656-
check-nix:
657-
nix flake check
658-
659657
# Run NixOS VM serve integration test (requires KVM, Linux only)
660658
[group('nix')]
661659
test-nixos-serve:

0 commit comments

Comments
 (0)