@travvy/bun-test
TypeScript icon, indicating that this package has built-in type declarations

0.0.16 • Public • Published

@travvy/bun-test

npm version

Type definitions for Bun's test runner without requiring the full @types/bun package.

Description

This package re-exports the TypeScript type definitions for bun:test so that you can use Bun as a test runner without needing to install the complete @types/bun package as a dependency.

This is particularly useful for:

  • Libraries that use Bun only for testing but don't depend on Bun at runtime
  • Projects that want to minimize their dependency footprint
  • Codebases that need type definitions only for Bun's test runner

Installation

Install the package with an alias so TypeScript can find it automatically:

# bun
bun i -d @types/bun-test@npm:@travvy/bun-test

# npm
npm i -D @types/bun-test@npm:@travvy/bun-test

This installs the package @travvy/bun-test but aliases it as @types/bun-test so TypeScript automatically picks up the type definitions (packages from @types/* are special).

Usage

Once installed with the proper alias, TypeScript will automatically pick up the type definitions for bun:test. You can import and use the test runner as normal:

import { test, expect, describe } from "bun:test";

test("my test", () => {
  expect(1 + 1).toBe(2);
});

describe("group", () => {
  test("nested test", () => {
    expect(true).toBeTrue();
  });
});

Why use this instead of @types/bun?

  • Smaller dependency footprint: Only includes the types needed for testing
  • Focused purpose: When you only need Bun as a test runner
  • Cleaner dependency graph: Avoid depending on the full Bun typings when unnecessary

License

See Bun's LICENSE

Links

Readme

Keywords

none

Package Sidebar

Install

npm i @travvy/bun-test

Weekly Downloads

29

Version

0.0.16

License

none

Unpacked Size

73.8 kB

Total Files

4

Last publish

Collaborators

  • trvswgnr