Prompt Buddy logoPrompt Buddy

bun · Bun Docs

Bun Writing tests

Teaches how to write and structure test files using Bun's built-in test runner, including syntax for test blocks and assertions.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Bun Writing tests

Teaches how to write and structure test files using Bun's built-in test runner, including syntax for test blocks and assertions.

When To Use

Use when you need to implement unit or integration tests using the Bun test runner and its assertion library.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/bun-writing-tests-workflow-guide.mdA guide covering test execution, features, and specialized testing patterns using the Bun test runner.Questions about a guide covering test execution, features, and specialized testing patterns using the Bun test runner.
examples/bun-writing-tests-bun-test-writing-examples.textCode examples demonstrating how to use the expect and test functions from the bun:test module.Exact payloads, commands, or snippets shown in Code examples demonstrating how to use the expect and test functions from the bun:test module.
examples/bun-writing-tests-bun-test-writing-describe-expect.textA code example demonstrating the use of describe, test, and expect functions within the Bun test runner.Exact payloads, commands, or snippets shown in A code example demonstrating the use of describe, test, and expect functions within the Bun test runner.
examples/bun-writing-tests-bun-test-writing.textA code example demonstrating how to use the expect and test functions from the bun:test module to perform asynchronous assertions.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the expect and test functions from the bun:test module to perform asynchronou...
examples/bun-writing-tests-bun-test-writing-async-done-callback.textAn example demonstrating how to use the done callback for testing asynchronous code in Bun.Exact payloads, commands, or snippets shown in An example demonstrating how to use the done callback for testing asynchronous code in Bun.
examples/bun-writing-tests-bun-test-timeout-assertion.textA code example demonstrating how to use the timeout option in a Bun test assertion to ensure an asynchronous operation completes within a specified duration.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the timeout option in a Bun test assertion to ensure an asynchronous operatio...
examples/bun-writing-tests-bun-test-writing-retry-logic.textA text example demonstrating how to use the retry option within a Bun test assertion to handle flaky network requests.Exact payloads, commands, or snippets shown in A text example demonstrating how to use the retry option within a Bun test assertion to handle flaky network requests.
examples/bun-writing-tests-bun-test-repeats-option.textA code example demonstrating how to use the repeats option within a Bun test to execute a test case multiple times.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the repeats option within a Bun test to execute a test case multiple times.
examples/bun-writing-tests-bun-test-writing-expect-skip.textA code example demonstrating how to use the expect and test functions along with test.skip in the Bun test runner.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the expect and test functions along with test.skip in the Bun test runner.
examples/bun-writing-tests-bun-test-writing-todo.textA text example demonstrating the use of the test.todo function within the Bun testing framework.Exact payloads, commands, or snippets shown in A text example demonstrating the use of the test.todo function within the Bun testing framework.
examples/bun-writing-tests-bun-test-writing-todo-flag.textAn example demonstrating the use of the --todo flag when running tests with the Bun test runner.Exact payloads, commands, or snippets shown in An example demonstrating the use of the --todo flag when running tests with the Bun test runner.
examples/bun-writing-tests-bun-test-writing-todo-2.textA text file demonstrating how to use the .todo method in Bun tests to mark unimplemented features.Exact payloads, commands, or snippets shown in A text file demonstrating how to use the .todo method in Bun tests to mark unimplemented features.
examples/bun-writing-tests-bun-test-writing-test-only-describe-only.textA text example demonstrating the usage of test.only and describe.only within the Bun test runner.Exact payloads, commands, or snippets shown in A text example demonstrating the usage of test.only and describe.only within the Bun test runner.
examples/bun-writing-tests-bun-test-only-command-usage.textA text snippet demonstrating how to use the bun test --only flag to run specific tests.Exact payloads, commands, or snippets shown in A text snippet demonstrating how to use the bun test --only flag to run specific tests.
examples/bun-writing-tests-bun-test-writing-examples-2.textA collection of text-based examples demonstrating how to write and structure tests using the bun test runner.Exact payloads, commands, or snippets shown in A collection of text-based examples demonstrating how to write and structure tests using the bun test runner.
examples/bun-writing-tests-bun-test-if-conditional-execution.textA text example demonstrating the use of the test.if conditional function to execute tests based on runtime conditions.Exact payloads, commands, or snippets shown in A text example demonstrating the use of the test.if conditional function to execute tests based on runtime conditions.
examples/bun-writing-tests-bun-test-skipif-platform.textA code example demonstrating how to use the test.skipIf method to conditionally skip tests based on the operating system platform.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the test.skipIf method to conditionally skip tests based on the operating sys...
examples/bun-writing-tests-bun-test-todo-if-conditional.textA code example demonstrating the use of the test.todoIf conditional method in Bun's testing framework.Exact payloads, commands, or snippets shown in A code example demonstrating the use of the test.todoIf conditional method in Bun's testing framework.
examples/bun-writing-tests-bun-test-failing-assertion.textA code example demonstrating how to use the test.failing function in Bun to assert that specific tests are expected to fail.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the test.failing function in Bun to assert that specific tests are expected t...
examples/bun-writing-tests-bun-test-describe-if-skip-if-examples.textCode examples demonstrating the use of describe.if and describe.skipIf for conditional test suite execution in Bun.Exact payloads, commands, or snippets shown in Code examples demonstrating the use of describe.if and describe.skipIf for conditional test suite execution in Bun.
examples/bun-writing-tests-bun-test-each-parameterized-cases.textA code example demonstrating how to use the test.each method to run parameterized test cases in Bun.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the test.each method to run parameterized test cases in Bun.
examples/bun-writing-tests-bun-test-describe-each.textA code example demonstrating how to use the describe.each method to run parameterized tests in Bun.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the describe.each method to run parameterized tests in Bun.
examples/bun-writing-tests-bun-test-each-array-and-object-examples.textExamples demonstrating how to use test.each with arrays and objects in Bun's testing framework.Exact payloads, commands, or snippets shown in Examples demonstrating how to use test.each with arrays and objects in Bun's testing framework.
examples/bun-writing-tests-bun-test-each-parameterized-specifiers.textAn example demonstrating how to use test.each with various format specifiers like %s, %i, and %p in Bun tests.Exact payloads, commands, or snippets shown in An example demonstrating how to use test.each with various format specifiers like %s, %i, and %p in Bun tests.
examples/bun-writing-tests-bun-test-async-assertions.textAn example demonstrating how to use async functions and expect.hasAssertions() within a Bun test block.Exact payloads, commands, or snippets shown in An example demonstrating how to use async functions and expect.hasAssertions() within a Bun test block.
examples/bun-writing-tests-bun-test-expect-assertions.textA Bun test example demonstrating the use of expect.assertions to verify the exact number of assertions called within a test block.Exact payloads, commands, or snippets shown in A Bun test example demonstrating the use of expect.assertions to verify the exact number of assertions called within...
examples/bun-writing-tests-bun-test-expecttypeof-assertions.textExamples demonstrating the use of expectTypeOf for type assertions and object matching in Bun tests.Exact payloads, commands, or snippets shown in Examples demonstrating the use of expectTypeOf for type assertions and object matching in Bun tests.
examples/bun-writing-tests-bun-test-writing-best-practices.textA text file demonstrating recommended and discouraged patterns for writing test descriptions in Bun.Exact payloads, commands, or snippets shown in A text file demonstrating recommended and discouraged patterns for writing test descriptions in Bun.
examples/bun-writing-tests-bun-test-describe-test-syntax.textA text example demonstrating the use of describe and test blocks for organizing test suites in Bun.Exact payloads, commands, or snippets shown in A text example demonstrating the use of describe and test blocks for organizing test suites in Bun.
examples/bun-writing-tests-bun-test-matcher-best-practices.textA comparison of using specific matchers versus generic equality checks in Bun test suites.Exact payloads, commands, or snippets shown in A comparison of using specific matchers versus generic equality checks in Bun test suites.
examples/bun-writing-tests-bun-test-writing-error-handling-examples.textExamples demonstrating how to test for synchronous and asynchronous error throwing using the Bun test runner.Exact payloads, commands, or snippets shown in Examples demonstrating how to test for synchronous and asynchronous error throwing using the Bun test runner.
examples/bun-writing-tests-bun-test-beforeeach-aftereach.textA text example demonstrating the use of beforeEach and afterEach hooks within the bun:test framework.Exact payloads, commands, or snippets shown in A text example demonstrating the use of beforeEach and afterEach hooks within the bun:test framework.

What This Skill Covers

    • Writing tests - Bun Skip to main content Bun home page Search... ⌘ K Install Bun Search... Navigation Getting Started Writing tests RuntimePackage ManagerB...
  • Main sections: Getting Started, Test Execution, Test Features, Specialized Testing, Reporting.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://bun.sh/docs/test/writing