Skip to content

Add define option to test section in bunfig.toml #21607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

chrislloyd
Copy link

What does this PR do?

This adds support for test-specific define values in bunfig.toml under the [test] section. Test-specific defines will override global defines with the same key.

Example usage:

[test]
define = { "process.env.NODE_ENV" = "'test'", "TEST_MODE" = "true" }
  • Modified bunfig.zig to parse the define field within the [test] section
  • Implemented merging logic so test-specific defines override global defines
  • Updated documentation to include the new test.define option

How did you verify your code works?

  • Added tests to verify the functionality

This adds support for test-specific define values in bunfig.toml under the [test] section. Test-specific defines will override global defines with the same key.

Example usage:
[test]
define = { "process.env.NODE_ENV" = "'test'", "TEST_MODE" = "true" }

- Modified bunfig.zig to parse the define field within the [test] section
- Implemented merging logic so test-specific defines override global defines
- Added tests to verify the functionality
- Updated documentation to include the new test.define option
autofix-ci bot and others added 2 commits August 4, 2025 13:02
Changed from [test.define] table syntax to inline define = {...} syntax
to match the other test cases
]);

expect(exitCode).toBe(0);
expect(stdout).toContain("1 pass");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

35 |   expect(stdout).toContain("1 pass");
                      ^
error: expect(received).toContain(expected)
 
Expected to contain: "1 pass"
Received: "bun test v1.2.20-canary.1 (caee0990)\n"
 
      at <anonymous> (C:\buildkite-agent\builds\EC2AMAZ-FCSPDJI\bun\bun\test\config\bunfig\test-define.test.ts:35:18)
 test.define in bunfig.toml [63.00ms]

this test seems to be failing in CI: https://buildkite.com/bun/bun/builds/22202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants