new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Bun · Runtime · all subjects

utilities

22 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Bun implements Web-standard fetch API

Bun implements the Web-standard fetch API for sending HTTP requests, compatible with the fetch API defined in the MDN documentation.

Fetch GET request example

To send a GET request using fetch in Bun: await fetch("https://bun.com") returns a response object. Call response.text() to get the HTML string content.

Fetch POST request example with JSON

To send a POST request with JSON body: const response = await fetch("https://bun.com/api", { method: "POST", body: JSON.stringify({ message: "Hello from Bun!" }), headers: { "Content-Type": "application/json" } }); const body = await response.json();

bunfig.toml test.root configuration

Set the root directory to run tests from using [test] root. Default is '.'. Example: [test] root = "./__tests__"

bunfig.toml test.preload configuration

Same as the top-level preload field but only applies to bun test. Example: [test] preload = ["./setup.ts"]

bunfig.toml test.pathIgnorePatterns configuration

Exclude files and directories from test discovery using glob patterns in [test] pathIgnorePatterns. The test runner prunes matched directories during scanning. Example: pathIgnorePatterns = ["vendor/**", "submodules/**", "fixtures/**"]. Equivalent CLI flag: --path-ignore-patterns, which overrides the bunfig.toml value entirely.

bunfig.toml test.smol configuration

Set [test] smol = true to enable smol mode only for bun test. Same as the top-level smol field but test-specific.

bunfig.toml test.coverage configuration

Set [test] coverage = true to enable coverage reporting. Default is false. Use --coverage flag to override.

bunfig.toml test.coverageThreshold configuration

Configure coverage threshold in [test] section. Default is null (no threshold). Set a single value like coverageThreshold = 0.9 for 90% line-level and function-level coverage. Or use separate thresholds: coverageThreshold = { lines = 0.7, functions = 0.8 }. If threshold not met, bun test exits with non-zero exit code. The statements key is accepted but not currently enforced.

bunfig.toml test.coverageSkipTestFiles configuration

Set [test] coverageSkipTestFiles = true to skip test files when computing coverage statistics. Default is false.

bunfig.toml test.coverageIgnoreSourcemaps configuration

Set [test] coverageIgnoreSourcemaps = true to report coverage against transpiled output instead of remapping line numbers through sourcemaps. Default is false. Primarily useful for debugging.

bunfig.toml test.coveragePathIgnorePatterns configuration

Exclude files from coverage reports using glob patterns in [test] coveragePathIgnorePatterns. Accepts a single pattern or array of patterns. Example: coveragePathIgnorePatterns = "**/*.spec.ts" or coveragePathIgnorePatterns = ["**/*.spec.ts", "**/*.test.ts", "src/utils/**", "*.config.js"]

bunfig.toml test.coverageReporter configuration

Configure test coverage reporters in [test] coverageReporter. By default prints to console. Set coverageReporter = ["text", "lcov"] for persistent reports that CI tools can read. Default is ["text"].

bunfig.toml test.coverageDir configuration

Set [test] coverageDir to the path where coverage reports are saved. Only applies to persistent reporters like lcov. Default is "coverage".

bunfig.toml test.randomize configuration

Set [test] randomize = true to run tests in random order. Default is false. Helps catch bugs related to test interdependencies. When combined with seed, the random order becomes reproducible. The --randomize CLI flag overrides this setting.

bunfig.toml test.seed configuration

Set [test] seed to a number to set the random seed for test randomization. This option requires randomize to be true. A seed makes the randomized test order reproducible across runs, helping when debugging flaky tests. The --seed CLI flag overrides this setting.

bunfig.toml test.rerunEach configuration

Set [test] rerunEach to re-run each test file a specified number of times. Default is 0 (run once). Use this to catch flaky tests or non-deterministic behavior. The --rerun-each CLI flag overrides this setting.

bunfig.toml test.retry configuration

Set [test] retry to the default retry count for all tests. The test runner retries failed tests up to this many times. Per-test { retry: N } overrides this value. Default is 0 (no retries). The --retry CLI flag overrides this setting.

bunfig.toml test.concurrentTestGlob configuration

Set [test] concurrentTestGlob to a glob pattern for test files that run all their tests concurrently, as if --concurrent was passed. Example: concurrentTestGlob = "**/concurrent-*.test.ts". Useful for migrating test suites to concurrent execution gradually or running integration tests concurrently while keeping unit tests sequential. The --concurrent CLI flag overrides this setting.

bunfig.toml test.onlyFailures configuration

Set [test] onlyFailures = true to show only failed tests in output, reducing noise in large test suites. Default is false. Equivalent to the --only-failures flag.

bunfig.toml test.reporter.dots configuration

Set [test.reporter] dots = true to enable the dots reporter, which prints one dot per test. Default is false.

bunfig.toml test.reporter.junit configuration

Set [test.reporter] junit to a file path to enable JUnit XML reporting. Example: [test.reporter] junit = "test-results.xml". CI systems and other tools can consume the report.

Give your agent this brain