Skip to content

Commit 96af0a0

Browse files
committed
test(truapi): run the suite with bun test instead of Vitest
Use Bun's built-in test runner: the repo already depends on bun, so this drops the Vitest devDependency (and its config) while keeping the same product-sdk-style describe/it/expect tests. - Imports come from "bun:test"; add @types/bun for editor support. - test script runs `bun test` (auto-discovers src/**/*.test.ts, no config). - Restore the setup-bun step on the ts-client CI job. - Refresh docs and the ts-client-checks skill.
1 parent c673015 commit 96af0a0

13 files changed

Lines changed: 135 additions & 1729 deletions

File tree

.claude/skills/ts-client-checks/SKILL.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: ts-client-checks
3-
description: Build and smoke-test the @parity/truapi TypeScript package (tsc + Vitest). Use after regenerating the client or after touching js/packages/truapi/.
3+
description: Build and smoke-test the @parity/truapi TypeScript package (tsc + bun test). Use after regenerating the client or after touching js/packages/truapi/.
44
---
55

66
# `@parity/truapi` build + smoke tests
@@ -13,13 +13,14 @@ npm run build
1313
npm test
1414
```
1515

16-
`npm test` runs the [Vitest](https://vitest.dev/) suite (`src/**/*.test.ts`),
17-
which loads the source `.ts` files directly (no build step required).
16+
`npm test` runs the [`bun test`](https://bun.sh/docs/cli/test) suite
17+
(`src/**/*.test.ts`) directly against the source `.ts` files (no build step
18+
required), so bun must be installed.
1819

1920
Expected:
2021

2122
- `tsc` (the `build` step) exits cleanly with no diagnostics.
22-
- Vitest reports `Test Files N passed` / `Tests M passed` with no failures.
23+
- `bun test` reports `N pass` / `0 fail` across the `src/**/*.test.ts` files.
2324
- `src/wire-table.test.ts` emits one `round-trips <method>.<kind>` case per
2425
generated frame id. The case count tracks `WIRE_TABLE`: adding a method
2526
grows it by 2 (request + response) or 4 (subscribe).

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ jobs:
117117
with:
118118
node-version: 22
119119

120+
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
121+
with:
122+
bun-version: latest
123+
120124
- name: Download codegen output
121125
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
122126
with:

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ cargo test --workspace
8080
```bash
8181
cd js/packages/truapi
8282
npm run build
83-
npm test # Vitest suite (src/**/*.test.ts)
83+
npm test # bun test suite (src/**/*.test.ts)
8484
```
8585

8686
### Explorer

docs/local-e2e-testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ npm test
105105
Expected:
106106

107107
- `tsc` (the `build` step) exits cleanly with no diagnostics.
108-
- Vitest reports `Test Files N passed` / `Tests M passed` with no failures.
108+
- `bun test` reports `N pass` / `0 fail` across the `src/**/*.test.ts` files.
109109
- `src/wire-table.test.ts` emits one `round-trips <method>.<kind>` case per
110110
generated frame id; the count tracks `WIRE_TABLE`. When you add a method,
111111
it grows by 2 (request + response) or 4 (subscribe).

js/packages/truapi/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ npm run build
127127
npm test
128128
```
129129

130-
On a clean checkout, the first build or test run will generate the ignored TypeScript outputs from the Rust sources, so Rust stable + nightly must be installed locally. `npm test` runs the package's [Vitest](https://vitest.dev/) suite (`src/**/*.test.ts`), which loads the source `.ts` files directly without a build step.
130+
On a clean checkout, the first build or test run will generate the ignored TypeScript outputs from the Rust sources, so Rust stable + nightly must be installed locally. `npm test` runs the package's [`bun test`](https://bun.sh/docs/cli/test) suite (`src/**/*.test.ts`) directly against the source `.ts` files (no build step), so [bun](https://bun.sh/) must also be installed.
131131

132132
## License
133133

js/packages/truapi/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@
7171
"codegen": "cargo run -p truapi-codegen -- --input ../../../target/doc/truapi.json --output src/generated --playground-output src/playground --explorer-output src/explorer",
7272
"typecheck": "npm run build",
7373
"pretest": "npm run ensure-generated",
74-
"test": "vitest run",
75-
"test:watch": "vitest"
74+
"test": "bun test",
75+
"test:watch": "bun test --watch"
7676
},
7777
"devDependencies": {
78-
"typescript": "^6.0",
79-
"vitest": "^3.2.0"
78+
"@types/bun": "^1.3.0",
79+
"typescript": "^6.0"
8080
},
8181
"dependencies": {
8282
"neverthrow": "^8.2.0",

js/packages/truapi/src/client.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Result } from "neverthrow";
2-
import { describe, expect, it } from "vitest";
2+
import { describe, expect, it } from "bun:test";
33

44
import { createTransport } from "./client.js";
55
import { indexedTaggedUnion, Result as ScaleResult, str, _void } from "./scale.js";

js/packages/truapi/src/explorer/versions.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// `DataType` in the same version. That cross-reference is the load-bearing
66
// invariant the explorer site relies on for type navigation.
77

8-
import { describe, expect, it } from "vitest";
8+
import { describe, expect, it } from "bun:test";
99

1010
import { packageVersion, versions } from "./versions.js";
1111

js/packages/truapi/src/transport.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { afterEach, beforeEach, describe, expect, it } from "vitest";
1+
import { afterEach, beforeEach, describe, expect, it } from "bun:test";
22

33
import { createIframeProvider, createMessagePortProvider } from "./transport.js";
44

js/packages/truapi/src/wire-equality.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// independently and compare.
77

88
import type { Result } from "neverthrow";
9-
import { describe, expect, it } from "vitest";
9+
import { describe, expect, it } from "bun:test";
1010

1111
import { str } from "./scale.js";
1212
import { decodeWireMessage, encodeWireMessage } from "./transport.js";

0 commit comments

Comments
 (0)