mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
[bun:test] Implement test.root configuration option
This commit is contained in:
11
bunfig.toml
Normal file
11
bunfig.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
|
||||
[test]
|
||||
# Large monorepos (like Bun) may want to specify the test directory more specifically
|
||||
# By default, `bun wiptest` scans every single folder recurisvely which, if you
|
||||
# have a gigantic submodule (like WebKit), it has to do lots of directory
|
||||
# traversals
|
||||
#
|
||||
# Instead, we can just make it scan only the test directory for Bun's runtime tests
|
||||
root = "test/bun.js"
|
||||
@@ -191,6 +191,14 @@ pub const Bunfig = struct {
|
||||
}
|
||||
}
|
||||
|
||||
if (comptime cmd == .TestCommand) {
|
||||
if (json.get("test")) |test_| {
|
||||
if (test_.get("root")) |root| {
|
||||
this.ctx.debug.test_directory = root.asString(this.allocator) orelse "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (comptime cmd.isNPMRelated() or cmd == .RunCommand or cmd == .AutoCommand) {
|
||||
if (json.get("install")) |_bun| {
|
||||
var install: *Api.BunInstall = this.ctx.install orelse brk: {
|
||||
|
||||
@@ -838,6 +838,8 @@ pub const Command = struct {
|
||||
macros: ?MacroMap = null,
|
||||
editor: string = "",
|
||||
package_bundle_map: bun.StringArrayHashMapUnmanaged(options.BundlePackage) = bun.StringArrayHashMapUnmanaged(options.BundlePackage){},
|
||||
|
||||
test_directory: []const u8 = "",
|
||||
};
|
||||
|
||||
pub const Context = struct {
|
||||
|
||||
Reference in New Issue
Block a user