aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ciro Spaciari <ciro.spaciari@gmail.com> 2023-09-13 17:41:47 -0700
committerGravatar GitHub <noreply@github.com> 2023-09-13 17:41:47 -0700
commit972a6f29cc0d232982ad9d2cae493c8a5cc7a74a (patch)
tree1035c838187b64ce3e862abb2522339fc7b89eb1
parent932fa35f9965a9f3565cfed0fbf71f01ad5fd818 (diff)
downloadbun-972a6f29cc0d232982ad9d2cae493c8a5cc7a74a.tar.gz
bun-972a6f29cc0d232982ad9d2cae493c8a5cc7a74a.tar.zst
bun-972a6f29cc0d232982ad9d2cae493c8a5cc7a74a.zip
fix(console.log) fix printing long custom format (#5164)
* avoid overflow * Update src/bun.js/bindings/exports.zig * add mongodb inspect test * bun db test --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
-rw-r--r--src/bun.js/bindings/exports.zig2
-rw-r--r--test/js/third_party/mongodb/mongodb.test.ts29
-rw-r--r--test/js/third_party/mongodb/package.json6
-rw-r--r--test/package.json3
4 files changed, 38 insertions, 2 deletions
diff --git a/src/bun.js/bindings/exports.zig b/src/bun.js/bindings/exports.zig
index 18b7c8bce..66bbe798f 100644
--- a/src/bun.js/bindings/exports.zig
+++ b/src/bun.js/bindings/exports.zig
@@ -2119,7 +2119,7 @@ pub const ZigConsoleClient = struct {
this.globalThis,
this.custom_formatted_object.function,
this.custom_formatted_object.this,
- this.max_depth - this.depth,
+ this.max_depth -| this.depth,
this.max_depth,
enable_ansi_colors,
);
diff --git a/test/js/third_party/mongodb/mongodb.test.ts b/test/js/third_party/mongodb/mongodb.test.ts
new file mode 100644
index 000000000..da0a089cf
--- /dev/null
+++ b/test/js/third_party/mongodb/mongodb.test.ts
@@ -0,0 +1,29 @@
+import { test, expect, describe } from "bun:test";
+import { MongoClient } from "mongodb";
+
+const CONNECTION_STRING = process.env.TLS_MONGODB_DATABASE_URL;
+
+const it = CONNECTION_STRING ? test : test.skip;
+
+describe("mongodb", () => {
+ it("should connect and inpect", async () => {
+ const client = new MongoClient(CONNECTION_STRING as string);
+
+ const clientConnection = await client.connect();
+
+ try {
+ const db = client.db("bun");
+
+ const schema = db.collection("bun");
+
+ await schema.insertOne({ name: "bunny", version: 1.0 });
+ const result = await schema.find();
+ await schema.deleteOne({ name: "bunny" });
+ const text = Bun.inspect(result);
+
+ expect(text).toBeDefined();
+ } finally {
+ await clientConnection.close();
+ }
+ });
+});
diff --git a/test/js/third_party/mongodb/package.json b/test/js/third_party/mongodb/package.json
new file mode 100644
index 000000000..b7cdb0b5c
--- /dev/null
+++ b/test/js/third_party/mongodb/package.json
@@ -0,0 +1,6 @@
+{
+ "name": "mongodb",
+ "dependencies": {
+ "mongodb": "6.0.0"
+ }
+}
diff --git a/test/package.json b/test/package.json
index 58e66833f..bab0e7200 100644
--- a/test/package.json
+++ b/test/package.json
@@ -35,7 +35,8 @@
"undici": "5.20.0",
"vitest": "0.32.2",
"webpack": "5.88.0",
- "webpack-cli": "4.7.2"
+ "webpack-cli": "4.7.2",
+ "mongodb": "6.0.0"
},
"private": true,
"scripts": {