aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-09 08:28:37 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-09 08:28:37 -0800
commit30b10d5fb1aeb94c7c19bb8d8d732f61202609cd (patch)
tree4ffbf066213e6afd2f560e1fab98b1f14b7a2168
parentca58556c541e3dd7f8f5c51350c85bbd3e11eed8 (diff)
downloadbun-30b10d5fb1aeb94c7c19bb8d8d732f61202609cd.tar.gz
bun-30b10d5fb1aeb94c7c19bb8d8d732f61202609cd.tar.zst
bun-30b10d5fb1aeb94c7c19bb8d8d732f61202609cd.zip
[bun:test] Implement `test.root` configuration option
-rw-r--r--bunfig.toml11
-rw-r--r--src/bunfig.zig8
-rw-r--r--src/cli.zig2
3 files changed, 21 insertions, 0 deletions
diff --git a/bunfig.toml b/bunfig.toml
new file mode 100644
index 000000000..6d9b1c272
--- /dev/null
+++ b/bunfig.toml
@@ -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"
diff --git a/src/bunfig.zig b/src/bunfig.zig
index f840c7c58..10a35edd4 100644
--- a/src/bunfig.zig
+++ b/src/bunfig.zig
@@ -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: {
diff --git a/src/cli.zig b/src/cli.zig
index f18ce68ee..34677308d 100644
--- a/src/cli.zig
+++ b/src/cli.zig
@@ -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 {