Skip to content

Commit c3f1705

Browse files
authored
Merge pull request #3 from SimplyLiz/feature/e2e-smoke-test
Add e2e smoke test suite
2 parents 766d38f + 807a621 commit c3f1705

3 files changed

Lines changed: 477 additions & 527 deletions

File tree

e2e/README.md

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ npm run test:e2e
1212

1313
Runs: **build → pack → publint + attw → smoke test → cleanup**
1414

15-
| Step | What it does |
16-
|------|-------------|
17-
| `npm run build` | Compile TypeScript |
18-
| `npm pack` | Create tarball from `files` field |
19-
| `publint --strict` | Validate package.json exports, files, types |
20-
| `attw` | Check TypeScript type resolution across all `moduleResolution` settings |
21-
| `smoke.mjs` | 68 assertions exercising the public API |
22-
| cleanup | Remove `.tgz`, `e2e/node_modules`, `e2e/package-lock.json` |
15+
| Step | What it does |
16+
| ------------------ | --------------------------------------------------------------------------------------- |
17+
| `npm run build` | Compile TypeScript |
18+
| `npm pack` | Create tarball from `files` field |
19+
| `publint --strict` | Validate package.json exports, files, types |
20+
| `attw` | Check TypeScript type resolution across all `moduleResolution` settings |
21+
| `smoke.mjs` | 41 tests / 74 assertions exercising the public API (`node:test` + `node:assert/strict`) |
22+
| cleanup | Remove `.tgz`, `e2e/node_modules`, `e2e/package-lock.json` |
2323

2424
Cleanup always runs, even on failure. The exit code from the smoke test is preserved.
2525

@@ -32,31 +32,17 @@ npm run test:e2e:published
3232

3333
## What the smoke test covers
3434

35-
| # | Area | What's tested |
36-
|---|------|---------------|
37-
| 1 | Basic compress | ratio, token_ratio, message count, verbatim store |
38-
| 2 | Uncompress round-trip | lossless content restoration |
39-
| 3 | Dedup | exact duplicate detection (>=200 char messages) |
40-
| 4 | Token budget (fit) | binary search finds a recencyWindow that fits |
41-
| 5 | Token budget (tight) | correctly reports `fits: false` when impossible |
42-
| 6 | defaultTokenCounter | returns positive number |
43-
| 7 | Preserve keywords | keywords retained in compressed output |
44-
| 8 | sourceVersion | flows into compression metadata |
45-
| 9 | embedSummaryId | summary_id embedded in compressed content |
46-
| 10 | Factory functions | createSummarizer, createEscalatingSummarizer exported |
47-
| 11 | forceConverge | best-effort truncation, no regression |
48-
| 12 | Fuzzy dedup | runs without errors, message count preserved |
49-
| 13 | Provenance metadata | _cce_original structure (ids, summary_id, version) |
50-
| 14 | Missing verbatim store | missing_ids reported correctly |
51-
| 15 | Custom tokenCounter | invoked and used for ratio calculation |
52-
| 16 | Edge cases | empty input, single message |
53-
| 17 | Async path (mock summarizer) | compress returns Promise, summarizer called, round-trip works |
54-
| 18 | Async + token budget | async binary search produces fits/tokenCount/recencyWindow |
55-
| 19 | System role | system messages auto-preserved, never compressed |
56-
| 20 | tool_calls | messages with tool_calls pass through intact |
57-
| 21 | Re-compression | compress already-compressed output, recover via chained stores |
58-
| 22 | Recursive uncompress | nested provenance fully expanded |
59-
| 23 | minRecencyWindow | floor enforced during budget binary search |
60-
| 24 | Large conversation (31 msgs) | compression + lossless round-trip at scale |
61-
| 25 | Large conversation + budget | binary search converges on 50% budget target |
62-
| 26 | Verbatim store as object | uncompress accepts plain Record, not just function |
35+
| Area | What's tested |
36+
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
37+
| **Basic compression** | ratio, token_ratio, message count, verbatim store, preserve keywords, sourceVersion, embedSummaryId, forceConverge, provenance metadata |
38+
| **Uncompress round-trip** | lossless content restoration, missing verbatim store, plain object store |
39+
| **Dedup** | exact duplicate detection (>=200 char), fuzzy dedup detects near-duplicates |
40+
| **Token budget** | binary search fit, impossible budget (fits=false), minRecencyWindow floor |
41+
| **Token counter** | defaultTokenCounter, custom tokenCounter |
42+
| **Factory functions** | createSummarizer, createEscalatingSummarizer exported |
43+
| **Edge cases** | empty input, single message |
44+
| **Async path** | mock summarizer + round-trip, async + token budget |
45+
| **Role handling** | system messages auto-preserved, tool_calls pass through + other messages compressed |
46+
| **Re-compression** | compress already-compressed output + chained stores, recursive uncompress |
47+
| **Large conversation** | 31-message fixture, compression + round-trip, 50% budget target |
48+
| **Error handling** | TypeError on non-array compress, null entry, missing id, non-array uncompress, invalid store; graceful handling of null/empty content |

e2e/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"type": "module",
55
"description": "End-to-end smoke test — installs context-compression-engine from npm and exercises the public API as a real consumer would.",
66
"scripts": {
7-
"test": "node smoke.mjs"
7+
"test": "node --test smoke.mjs"
88
}
99
}

0 commit comments

Comments
 (0)