Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
Something went wrong. Try again.
315 B · 14 lines
TypeScript
123456789101112131415// the implementationexport function add(...args: number[]) { return args.reduce((a, b) => a + b, 0)}
// in-source test suitesif (import.meta.vitest) { const { it, expect } = import.meta.vitest it('add', () => { expect(add()).toBe(0) expect(add(1)).toBe(1) expect(add(1, 2, 3)).toBe(6) })}