Type object
File match bunfig.toml
Schema URL https://catalog.lintel.tools/schemas/schemastore/bunfig-toml/latest.json
Source https://www.schemastore.org/bunfig.json

Validate with Lintel

npx @lintel/lintel check
Type: object

Bun configuration schema for bunfig.toml. See https://bun.sh/docs/runtime/bunfig

Properties

preload string[] | string

An array or string of scripts/plugins to run before running the file or script https://bun.sh/docs/runtime/bunfig#preload

Examples: ["./preload.ts"]
jsx string

Configure how Bun handles JSX. You can also set these fields in the compilerOptions of your tsconfig.json, but they are supported here as well for non-TypeScript projects https://bun.sh/docs/runtime/bunfig#jsx https://www.typescriptlang.org/tsconfig/#jsx

Examples: "react"
jsxFactory string

Specify the function that is used to create JSX elements https://www.typescriptlang.org/tsconfig#jsxFactory

Examples: "h"
jsxFragment string

Specify the function that is used for JSX fragments https://www.typescriptlang.org/tsconfig#jsxFragment

Examples: "Fragment"
jsxImportSource string

Specify the module specifier to be used for importing the JSX factory functions https://www.typescriptlang.org/tsconfig#jsxImportSource

Examples: "react"
smol boolean

Enable smol mode. This reduces memory usage at the cost of performance https://bun.sh/docs/runtime/bunfig#smol

Default: false
logLevel string

Set the log level. This can be one of "debug", "warn", or "error" https://bun.sh/docs/runtime/bunfig#loglevel

Values: "debug" "warn" "error"
Examples: "debug"
define object

The define field allows you to replace certain global identifiers with constant expressions. Bun will replace any usage of the identifier with the expression. The expression should be a JSON string https://bun.sh/docs/runtime/bunfig#define

loader Record<string, string>

Configure how Bun maps file extensions to loaders. This is useful for loading files that aren't natively supported by Bun https://bun.sh/docs/runtime/bunfig#loader

telemetry boolean

The telemetry field permit to enable/disable the analytics records. Bun records bundle timings (so we can answer with data, "is Bun getting faster?") and feature usage (e.g., "are people actually using macros?"). The request body size is about 60 bytes, so it's not a lot of data. By default the telemetry is enabled. https://bun.sh/docs/runtime/bunfig#telemetry

Default: true
env boolean | object

Configure automatic .env file loading. By default, Bun automatically loads .env files. https://bun.sh/docs/runtime/bunfig#env

console object

Configure console output behavior. https://bun.sh/docs/runtime/bunfig#console

1 nested properties
depth integer

Set the default depth for console.log() object inspection. Default 2 https://bun.sh/docs/runtime/bunfig#console-depth

Default: 2
Examples: 3
min=0
test object
18 nested properties
root string

The root directory to run tests from. Default . https://bun.sh/docs/runtime/bunfig#test-root

Examples: "./__tests__"
preload string[] | string

Same as the top-level preload field, but only applies to bun test https://bun.sh/docs/runtime/bunfig#test-preload

Examples: ["./setup.ts"]
pathIgnorePatterns string | string[]

Exclude files and directories from test discovery using glob patterns. Can be a single string pattern or an array of patterns. https://bun.sh/docs/runtime/bunfig#test-pathignorepatterns

smol boolean

Same as the top-level smol field, but only applies to bun test https://bun.sh/docs/runtime/bunfig#test-smol

Default: false
coverage boolean

Enables coverage reporting. Default false. Use --coverage to override https://bun.sh/docs/runtime/bunfig#test-coverage

Default: false
coveragePathIgnorePatterns string | string[]

Exclude specific files or file patterns from coverage reports using glob patterns. Can be a single string pattern or an array of patterns. https://bun.sh/docs/runtime/bunfig#test-coveragepathignorepatterns

coverageThreshold number | object

To specify a coverage threshold. By default, no threshold is set. If your test suite does not meet or exceed this threshold, bun test will exit with a non-zero exit code to indicate the failure https://bun.sh/docs/runtime/bunfig#test-coveragethreshold

Examples: 0.9, {"line":0.7,"function":0.8,"statement":0.9}
coverageSkipTestFiles boolean

Whether to skip test files when computing coverage statistics. Default false https://bun.sh/docs/runtime/bunfig#test-coverageskiptestfiles

Default: false
coverageReporter string[]

By default, coverage reports will be printed to the console. For persistent code coverage reports in CI environments and for other tools use lcov https://bun.sh/docs/runtime/bunfig#test-coveragereporter

Default:
[
  "text"
]
coverageDir string

Set path where coverage reports will be saved. Please notice, that it works only for persistent coverageReporter like lcov https://bun.sh/docs/runtime/bunfig#test-coveragedir

Default: "coverage"
randomize boolean

Run tests in random order. Default false https://bun.sh/docs/runtime/bunfig#test-randomize

Default: false
seed integer

Set the random seed for test randomization. This requires randomize to be true. https://bun.sh/docs/runtime/bunfig#test-seed

Examples: 2444615283
min=0
rerunEach integer

Re-run each test file a specified number of times. Default 0 (run once). https://bun.sh/docs/runtime/bunfig#test-reruneach

Default: 0
Examples: 3
min=0
retry integer

Default retry count for all tests. Failed tests will be retried up to this many times. Default 0 (no retries). https://bun.sh/docs/runtime/bunfig#test-retry

Default: 0
Examples: 3
min=0
concurrentTestGlob string

Glob pattern for test files that should run with concurrent test execution enabled. https://bun.sh/docs/runtime/bunfig#test-concurrenttestglob

Examples: "**/concurrent-*.test.ts"
onlyFailures boolean

When enabled, only failed tests are displayed in the output. Default false https://bun.sh/docs/runtime/bunfig#test-onlyfailures

Default: false
reporter object

Configure the test reporter settings. https://bun.sh/docs/runtime/bunfig#test-reporter

2 nested properties
dots boolean

Enable the dots reporter. Default false https://bun.sh/docs/runtime/bunfig#test-reporter-dots

Default: false
junit string

Enable JUnit XML reporting and set the output file path. https://bun.sh/docs/runtime/bunfig#test-reporter-junit

Examples: "test-results.xml"
timeout integer

Set the default timeout in milliseconds for all tests. This can be overridden by individual tests. Default 5000 https://bun.com/docs/test/configuration#default-timeout

Default: 5000
Examples: 5000
min=0
install object

Package management is a complex issue; to support a range of use cases, the behavior of bun install can be configured under the [install] section https://bun.sh/docs/runtime/bunfig#package-manager

22 nested properties
optional boolean

Whether to install optional dependencies. Default true https://bun.sh/docs/runtime/bunfig#install-optional

Default: true
dev boolean

Whether to install development dependencies. Default true https://bun.sh/docs/runtime/bunfig#install-dev

Default: true
peer boolean

Whether to install peer dependencies. Default true https://bun.sh/docs/runtime/bunfig#install-peer

Default: true
production boolean

Whether bun install will run in "production mode". Default false

In production mode, "devDependencies" are not installed. You can use --production in the CLI to override this setting https://bun.sh/docs/runtime/bunfig#install-production

Default: false
exact boolean

Whether to set an exact version in package.json. Default false

By default Bun uses caret ranges; if the latest version of a package is 2.4.1, the version range in your package.json will be ^2.4.1. This indicates that any version from 2.4.1 up to (but not including) 3.0.0 is acceptable https://bun.sh/docs/runtime/bunfig#install-exact

Default: false
saveTextLockfile boolean

If false, generate a binary bun.lockb instead of a text-based bun.lock file when running bun install and no lockfile is present Default true (since Bun v1.2) https://bun.sh/docs/runtime/bunfig#install-savetextlockfile

Default: true
auto string

To configure Bun's package auto-install behavior. Default "auto" — when no node_modules folder is found, Bun will automatically install dependencies on the fly during execution https://bun.sh/docs/runtime/bunfig#install-auto

Default: "auto"
Values: "auto" "force" "disable" "fallback"
frozenLockfile boolean

When true, bun install will not update bun.lock. Default false. If package.json and the existing bun.lock are not in agreement, this will error https://bun.sh/docs/runtime/bunfig#install-frozenlockfile

Default: false
dryRun boolean

Whether bun install will actually install dependencies. Default false. When true, it's equivalent to setting --dry-run on all bun install commands https://bun.sh/docs/runtime/bunfig#install-dryrun

Default: false
globalDir string

To configure the directory where Bun puts globally installed packages https://bun.sh/docs/runtime/bunfig#install-globaldir

Default: "~/.bun/install/global"
Examples: "~/.bun/install/global"
globalBinDir string

To configure the directory where Bun installs globally installed binaries and CLIs https://bun.sh/docs/runtime/bunfig#install-globalbindir

Default: "~/.bun/bin"
Examples: "~/.bun/bin"
registry string | object

The default registry is <https://registry.npmjs.org/>. This can be globally configured in bunfig.toml https://bun.sh/docs/runtime/bunfig#install-registry

Default: "https://registry.npmjs.org/"
Examples: "https://registry.npmjs.org", "https://username:[email protected]", {"url":"https://registry.npmjs.org","token":"123456"}
linkWorkspacePackages boolean

Whether to link workspace packages from the monorepo root to their respective node_modules directories. Default true https://bun.sh/docs/runtime/bunfig#install-linkworkspacepackages

Default: true
scopes object

To configure a registry for a particular scope (e.g. @myorg/<package>) use install.scopes. You can reference environment variables with $variable notation https://bun.sh/docs/runtime/bunfig#install-scopes

ca string
Examples: "-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----"
cafile string

A path to a CA certificate file. The file can contain multiple certificates. https://bun.sh/docs/runtime/bunfig#install-ca-and-install-cafile

Examples: "path/to/cafile"
cache object

To configure the cache behavior https://bun.sh/docs/runtime/bunfig#install-cache

3 nested properties
dir string

The directory to use for the cache https://bun.sh/docs/runtime/bunfig#install-cache

Default: "~/.bun/install/cache"
Examples: "~/.bun/install/cache"
disable boolean

When true, don't load from the global cache.

Bun may still write to node_modules/.cache https://bun.sh/docs/runtime/bunfig#install-cache

Default: false
disableManifest boolean

When true, always resolve the latest versions from the registry https://bun.sh/docs/runtime/bunfig#install-cache

Default: false
lockfile object

To configure lockfile behavior, use the install.lockfile section https://bun.sh/docs/runtime/bunfig#install-lockfile

2 nested properties
save boolean

Whether to generate a lockfile on bun install. Default true https://bun.sh/docs/runtime/bunfig#install-lockfile

Default: true
print string

Whether to generate a non-Bun lockfile alongside bun.lock. (A bun.lock will always be created.) Currently "yarn" is the only supported value https://bun.sh/docs/runtime/bunfig#install-lockfile

Constant: "yarn"
linker string

Configure the default linker strategy. Default "hoisted" https://bun.sh/docs/runtime/bunfig#install-linker

Default: "hoisted"
Values: "hoisted" "isolated"
security object

Security configuration for package installation https://bun.sh/docs/runtime/bunfig#install-security-scanner

1 nested properties
scanner string

The security scanner to use during certain package manager commands. https://bun.sh/docs/runtime/bunfig#install-security-scanner

Examples: "@acme/bun-security-scanner"
minimumReleaseAge integer

Configure a minimum age (in seconds) for npm package versions. Package versions published more recently than this threshold will be filtered out during installation. Default is null (disabled) https://bun.com/docs/runtime/bunfig#install-minimumreleaseage

Examples: 259200
min=0
minimumReleaseAgeExcludes string[]

Packages that bypass the minimumReleaseAge requirement and can install immediately. https://bun.com/docs/runtime/bunfig#install-minimumreleaseage

Examples: ["@types/bun","typescript"]
run object

The bun run command can be configured under the [run] section. These apply to the bun run command and the bun command when running a file or executable or script.

Currently, bunfig.toml isn't always automatically loaded for bun run in a local project (it does check for a global bunfig.toml), so you might still need to pass -c or -c=bunfig.toml to use these settings https://bun.sh/docs/runtime/bunfig#bun-run

3 nested properties
shell string

The shell to use when running package.json scripts via bun run or bun. On Windows, this defaults to "bun" and on other platforms it defaults to "system" https://bun.sh/docs/runtime/bunfig#run-shell-use-the-system-shell-or-bun-s-shell

Values: "system" "bun"
bun boolean

Auto alias node to bun

When true, this prepends $PATH with a node symlink that points to the bun binary for all scripts or executables invoked by bun run or bun This means that if you have a script that runs node, it will actually run bun instead, without needing to change your script. This works recursively, so if your script runs another script that runs node, it will also run bun instead. This applies to shebangs as well, so if you have a script with a shebang that points to node, it will actually run bun instead. By default, this is enabled if node is not already in your $PATH https://bun.sh/docs/runtime/bunfig#run-bun-auto-alias-node-to-bun

Default: false
Examples: true
silent boolean

When true, suppresses the output of the command being run by bun run or bun https://bun.sh/docs/runtime/bunfig#run-silent-suppress-reporting-the-command-being-run

Default: false