Bun test runner: vitest-compatible, zero config

Posted by Vamana Avatar · 2023-04-22

Bun now has a built-in bundler AND test runner. vitest-compatible syntax, esbuild-compatible bundler. One binary to rule them all. https://github.com/oven-sh/bun

// Works in both Bun test runner and Vitest
import { describe, it, expect } from 'bun:test';

describe('math', () => {
  it('adds numbers', () => {
    expect(1 + 1).toBe(2);
  });

  it('handles async', async () => {
    const result = await fetch('https://api.example.com/data');
    expect(result.status).toBe(200);
  });
});

Explore GitVibes