Skip to content

Testing

Stellar Explorer uses Vitest with the happy-dom environment.

Terminal window
bun run test # Run all tests once
bun run test:watch # Run in watch mode

Run a single test file:

Terminal window
bunx vitest run src/lib/utils/format.test.ts

Test files live alongside their source files using the *.test.{ts,tsx} naming convention:

src/lib/utils/
format.ts
format.test.ts
import { describe, it, expect } from "vitest";
import { formatAmount } from "./format";
describe("formatAmount", () => {
it("formats XLM amounts correctly", () => {
expect(formatAmount("10000000")).toBe("1.0000000");
});
});

Tests run in happy-dom, a lightweight browser environment. This allows testing React components without a full browser.