From d1b04facce6fce1305f497fbfece59e326c259da Mon Sep 17 00:00:00 2001 From: jhmaster2000 <32803471+jhmaster2000@users.noreply.github.com> Date: Mon, 11 Dec 2023 05:06:42 -0300 Subject: [PATCH] run bun fmt --- src/deps/base64 | 2 +- test/js/bun/ffi/ffi.test.js | 8 +- test/js/bun/globals.test.js | 9 +- test/js/bun/io/bun-write.test.js | 20 +-- test/js/bun/jsc/bun-jsc.test.ts | 4 +- test/js/bun/net/tcp-server.test.ts | 30 ++--- test/js/bun/resolve/import-meta.test.js | 51 ++++---- .../bun/spawn/spawn-streaming-stdin.test.ts | 2 +- test/js/bun/spawn/spawn.test.ts | 114 ++++++++++-------- test/js/bun/sqlite/sqlite.test.js | 58 ++++----- test/js/bun/util/bun-isMainThread.test.js | 3 +- test/js/bun/util/filesink.test.ts | 4 +- test/js/bun/util/peek.test.ts | 8 +- test/js/bun/util/which.test.ts | 4 +- 14 files changed, 165 insertions(+), 152 deletions(-) diff --git a/src/deps/base64 b/src/deps/base64 index 3a5add8652..e77bd70bdd 160000 --- a/src/deps/base64 +++ b/src/deps/base64 @@ -1 +1 @@ -Subproject commit 3a5add8652076612a8407627a42c768736a4263f +Subproject commit e77bd70bdd860c52c561568cffb251d88bba064c diff --git a/test/js/bun/ffi/ffi.test.js b/test/js/bun/ffi/ffi.test.js index d89f033479..615452cecd 100644 --- a/test/js/bun/ffi/ffi.test.js +++ b/test/js/bun/ffi/ffi.test.js @@ -593,7 +593,7 @@ function ffiRunner(fast) { const bigint = typeof min === "bigint"; const inc = bigint ? // - (max - min) / 32768n + (max - min) / 32768n : Math.ceil((max - min) / 32768); it(type, () => { expect(bigint ? BigInt(fn(min)) : fn(min)).toBe(min); @@ -652,7 +652,7 @@ if (ok) { ffiRunner(true); }); } else { - it.skip("run ffi", () => { }); + it.skip("run ffi", () => {}); } it("dlopen throws an error instead of returning it", () => { @@ -680,8 +680,8 @@ const lib_path = platform() === "darwin" ? "/usr/lib/libSystem.B.dylib" : existsSync("/lib/x86_64-linux-gnu/libc.so.6") - ? "/lib/x86_64-linux-gnu/libc.so.6" - : null; + ? "/lib/x86_64-linux-gnu/libc.so.6" + : null; const test = lib_path ? it : it.skip; test("can open more than 63 symbols", () => { const lib = dlopen(lib_path, { diff --git a/test/js/bun/globals.test.js b/test/js/bun/globals.test.js index 28b6cf671a..31be72d7a6 100644 --- a/test/js/bun/globals.test.js +++ b/test/js/bun/globals.test.js @@ -6,7 +6,7 @@ it("extendable", () => { const classes = [Blob, TextDecoder, TextEncoder, Request, Response, Headers, HTMLRewriter, Bun.Transpiler, Buffer]; for (let Class of classes) { if (process.env.BUN_POLYFILLS_TEST_RUNNER && Class === Buffer) continue; - var Foo = class extends Class { }; + var Foo = class extends Class {}; var bar = Class === Request ? new Request("https://example.com") : new Foo(); expect(bar instanceof Class).toBe(true); expect(!!Class.prototype).toBe(true); @@ -32,7 +32,7 @@ it("writable", () => { ]; for (let [name, Class] of classes) { if (!Class) continue; - if (process.env.BUN_POLYFILLS_TEST_RUNNER && name === 'Response') continue; + if (process.env.BUN_POLYFILLS_TEST_RUNNER && name === "Response") continue; globalThis[name] = 123; expect(globalThis[name]).toBe(123); globalThis[name] = Class; @@ -55,8 +55,9 @@ it("name", () => { ]; for (let [name, Class] of classes) { if (process.env.BUN_POLYFILLS_TEST_RUNNER) { - if (Class.name.startsWith('_')) expect(Class.name.slice(1)).toBe(name); // _Request, _Response, _Headers... why Node? Just why. - else if (Class.name.endsWith('2')) expect(Class.name.slice(0, -1)).toBe(name); // Response2 monkeypatch by Hono + if (Class.name.startsWith("_")) + expect(Class.name.slice(1)).toBe(name); // _Request, _Response, _Headers... why Node? Just why. + else if (Class.name.endsWith("2")) expect(Class.name.slice(0, -1)).toBe(name); // Response2 monkeypatch by Hono else expect(Class.name).toBe(name); } else expect(Class.name).toBe(name); } diff --git a/test/js/bun/io/bun-write.test.js b/test/js/bun/io/bun-write.test.js index 592a4079fa..45ae85ddd9 100644 --- a/test/js/bun/io/bun-write.test.js +++ b/test/js/bun/io/bun-write.test.js @@ -31,19 +31,19 @@ describe("large file", () => { it(`write ${filename} ${content.length} (text)`, async () => { try { unlinkSync(filename); - } catch (e) { } + } catch (e) {} await Bun.write(filename, content); expect(await Bun.file(filename).text()).toBe(content); try { unlinkSync(filename); - } catch (e) { } + } catch (e) {} }); it(`write ${filename}.bytes ${content.length} (bytes)`, async () => { try { unlinkSync(filename + ".bytes"); - } catch (e) { } + } catch (e) {} var bytes = new TextEncoder().encode(content); const written = await Bun.write(filename + ".bytes", bytes); expect(written).toBe(bytes.byteLength); @@ -51,20 +51,20 @@ describe("large file", () => { try { unlinkSync(filename + ".bytes"); - } catch (e) { } + } catch (e) {} }); it(`write ${filename}.blob ${content.length} (Blob)`, async () => { try { unlinkSync(filename + ".blob"); - } catch (e) { } + } catch (e) {} var bytes = new Blob([content]); await Bun.write(filename + ".blob", bytes); expect(await Bun.file(filename + ".blob").text()).toBe(content); try { unlinkSync(filename + ".blob"); - } catch (e) { } + } catch (e) {} }); } }); @@ -110,7 +110,7 @@ it("Bun.write('out.txt', 'string')", async () => { if (erase) { try { fs.unlinkSync(path.join("/tmp", "out.txt")); - } catch (e) { } + } catch (e) {} } await gcTick(); expect(await Bun.write("/tmp/out.txt", "string")).toBe("string".length); @@ -127,11 +127,11 @@ it("Bun.write('out.txt', 'string')", async () => { it("Bun.file -> Bun.file", async () => { try { fs.unlinkSync(path.join("/tmp", "fetch.js.in")); - } catch (e) { } + } catch (e) {} await gcTick(); try { fs.unlinkSync(path.join("/tmp", "fetch.js.out")); - } catch (e) { } + } catch (e) {} await gcTick(); const file = path.join(import.meta.dir, "fetch.js.txt"); await gcTick(); @@ -245,7 +245,7 @@ it("Bun.file -> Response", async () => { // ensure the file doesn't already exist try { fs.unlinkSync("/tmp/fetch.js.out"); - } catch { } + } catch {} await gcTick(); const file = path.join(import.meta.dir, "fetch.js.txt"); await gcTick(); diff --git a/test/js/bun/jsc/bun-jsc.test.ts b/test/js/bun/jsc/bun-jsc.test.ts index 3ac40fd149..9ae9b93bd7 100644 --- a/test/js/bun/jsc/bun-jsc.test.ts +++ b/test/js/bun/jsc/bun-jsc.test.ts @@ -79,8 +79,8 @@ describe("bun:jsc", () => { it.skipIf(!!process.env.BUN_POLYFILLS_TEST_RUNNER)("callerSourceOrigin", () => { expect(callerSourceOrigin()).toBe(import.meta.url); }); - it("noFTL", () => { }); - it("noOSRExitFuzzing", () => { }); + it("noFTL", () => {}); + it("noOSRExitFuzzing", () => {}); it("optimizeNextInvocation", () => { count(); expect(optimizeNextInvocation(count)).toBeUndefined(); diff --git a/test/js/bun/net/tcp-server.test.ts b/test/js/bun/net/tcp-server.test.ts index aabf81ad35..02a4bb5ee1 100644 --- a/test/js/bun/net/tcp-server.test.ts +++ b/test/js/bun/net/tcp-server.test.ts @@ -29,8 +29,8 @@ it("remoteAddress works", async () => { setTimeout(() => server.stop(true), 0); } }, - close() { }, - data() { }, + close() {}, + data() {}, }, port: 0, hostname: "127.0.0.1", @@ -49,8 +49,8 @@ it("remoteAddress works", async () => { ws.end(); } }, - data() { }, - close() { }, + data() {}, + close() {}, }, hostname: server.hostname, port: server.port, @@ -64,9 +64,9 @@ it("should not allow invalid tls option", () => { // @ts-ignore const server = Bun.listen({ socket: { - open(ws) { }, - close() { }, - data() { }, + open(ws) {}, + close() {}, + data() {}, }, port: 0, hostname: "localhost", @@ -83,9 +83,9 @@ it("should allow using false, null or undefined tls option", () => { // @ts-ignore const server = Bun.listen({ socket: { - open(ws) { }, - close() { }, - data() { }, + open(ws) {}, + close() {}, + data() {}, }, port: 0, hostname: "localhost", @@ -230,13 +230,13 @@ describe("tcp socket binaryType", () => { data(socket, buffer) { expect( buffer instanceof - (type === "arraybuffer" - ? ArrayBuffer - : type === "uint8array" + (type === "arraybuffer" + ? ArrayBuffer + : type === "uint8array" ? Uint8Array : type === "buffer" - ? Buffer - : Error), + ? Buffer + : Error), ).toBe(true); const msg = `${socket.data.isServer ? "server:" : "client:"} Hello World! ${socket.data.counter++}`; socket.data.sendQueue.push(msg); diff --git a/test/js/bun/resolve/import-meta.test.js b/test/js/bun/resolve/import-meta.test.js index 20087dae38..0b26136998 100644 --- a/test/js/bun/resolve/import-meta.test.js +++ b/test/js/bun/resolve/import-meta.test.js @@ -60,38 +60,41 @@ it("Module.createRequire does not use file url as the referrer (err message chec } catch (e) { expect(e.name).not.toBe("UnreachableError"); expect(e.message).not.toInclude("file:///"); - expect(e.message).toInclude('whaaat'); + expect(e.message).toInclude("whaaat"); expect(e.message).toInclude(import.meta.path); } }); -it.skipIf(process.env.BUN_POLYFILLS_TEST_RUNNER)("require with a query string works on dynamically created content", () => { - rmSync("/tmp/bun-test-import-meta-dynamic-dir", { - recursive: true, - force: true, - }); - try { - const require = Module.createRequire("/tmp/bun-test-import-meta-dynamic-dir/foo.js"); - try { - require("./bar.js?query=123.js"); - } catch (e) { - expect(e.name).toBe(process.env.BUN_POLYFILLS_TEST_RUNNER ? "Error" : "ResolveMessage"); - } - - mkdirSync("/tmp/bun-test-import-meta-dynamic-dir", { recursive: true }); - - writeFileSync("/tmp/bun-test-import-meta-dynamic-dir/bar.js", "export default 'hello';", "utf8"); - - expect(require("./bar.js?query=123.js").default).toBe("hello"); - } catch (e) { - throw e; - } finally { +it.skipIf(process.env.BUN_POLYFILLS_TEST_RUNNER)( + "require with a query string works on dynamically created content", + () => { rmSync("/tmp/bun-test-import-meta-dynamic-dir", { recursive: true, force: true, }); - } -}); + try { + const require = Module.createRequire("/tmp/bun-test-import-meta-dynamic-dir/foo.js"); + try { + require("./bar.js?query=123.js"); + } catch (e) { + expect(e.name).toBe(process.env.BUN_POLYFILLS_TEST_RUNNER ? "Error" : "ResolveMessage"); + } + + mkdirSync("/tmp/bun-test-import-meta-dynamic-dir", { recursive: true }); + + writeFileSync("/tmp/bun-test-import-meta-dynamic-dir/bar.js", "export default 'hello';", "utf8"); + + expect(require("./bar.js?query=123.js").default).toBe("hello"); + } catch (e) { + throw e; + } finally { + rmSync("/tmp/bun-test-import-meta-dynamic-dir", { + recursive: true, + force: true, + }); + } + }, +); it("import.meta.require (json)", () => { expect(import.meta.require("./require-json.json").hello).toBe(sync.hello); diff --git a/test/js/bun/spawn/spawn-streaming-stdin.test.ts b/test/js/bun/spawn/spawn-streaming-stdin.test.ts index 10eff5f9f9..e451a69026 100644 --- a/test/js/bun/spawn/spawn-streaming-stdin.test.ts +++ b/test/js/bun/spawn/spawn-streaming-stdin.test.ts @@ -53,7 +53,7 @@ test("spawn can write to stdin multiple chunks", async () => { try { unlinkSync(tmperr); - } catch (e) { } + } catch (e) {} })(); } diff --git a/test/js/bun/spawn/spawn.test.ts b/test/js/bun/spawn/spawn.test.ts index ab4356a3f3..7b7df7daf6 100644 --- a/test/js/bun/spawn/spawn.test.ts +++ b/test/js/bun/spawn/spawn.test.ts @@ -132,45 +132,49 @@ for (let [gcTick, label] of [ gcTick(); }); - it.skipIf(!!process.env.BUN_POLYFILLS_TEST_RUNNER)("check exit code from onExit", async () => { - for (let i = 0; i < 1000; i++) { - var exitCode1, exitCode2; - await new Promise(resolve => { - var counter = 0; - spawn({ - cmd: ["ls"], - stdin: "ignore", - stdout: "ignore", - stderr: "ignore", - onExit(subprocess, code) { - exitCode1 = code; - counter++; - if (counter === 2) { - resolve(); - } - }, + it.skipIf(!!process.env.BUN_POLYFILLS_TEST_RUNNER)( + "check exit code from onExit", + async () => { + for (let i = 0; i < 1000; i++) { + var exitCode1, exitCode2; + await new Promise(resolve => { + var counter = 0; + spawn({ + cmd: ["ls"], + stdin: "ignore", + stdout: "ignore", + stderr: "ignore", + onExit(subprocess, code) { + exitCode1 = code; + counter++; + if (counter === 2) { + resolve(); + } + }, + }); + + spawn({ + cmd: ["false"], + stdin: "ignore", + stdout: "ignore", + stderr: "ignore", + onExit(subprocess, code) { + exitCode2 = code; + counter++; + + if (counter === 2) { + resolve(); + } + }, + }); }); - spawn({ - cmd: ["false"], - stdin: "ignore", - stdout: "ignore", - stderr: "ignore", - onExit(subprocess, code) { - exitCode2 = code; - counter++; - - if (counter === 2) { - resolve(); - } - }, - }); - }); - - expect(exitCode1).toBe(0); - expect(exitCode2).toBe(1); - } - }, 60_000_0); + expect(exitCode1).toBe(0); + expect(exitCode2).toBe(1); + } + }, + 60_000_0, + ); // FIXME: fix the assertion failure it.skip("Uint8Array works as stdout", () => { @@ -497,22 +501,26 @@ for (let [gcTick, label] of [ } if (!process.env.BUN_FEATURE_FLAG_FORCE_WAITER_THREAD) { - it.skipIf(!!process.env.BUN_POLYFILLS_TEST_RUNNER)("with BUN_FEATURE_FLAG_FORCE_WAITER_THREAD", async () => { - const result = spawnSync({ - cmd: [bunExe(), "test", import.meta.path], - env: { - ...bunEnv, - // Both flags are necessary to force this condition - "BUN_FEATURE_FLAG_FORCE_WAITER_THREAD": "1", - "BUN_GARBAGE_COLLECTOR_LEVEL": "1", - }, - }); - if (result.exitCode !== 0) { - console.error(result.stderr.toString()); - console.log(result.stdout.toString()); - } - expect(result.exitCode).toBe(0); - }, 60_000); + it.skipIf(!!process.env.BUN_POLYFILLS_TEST_RUNNER)( + "with BUN_FEATURE_FLAG_FORCE_WAITER_THREAD", + async () => { + const result = spawnSync({ + cmd: [bunExe(), "test", import.meta.path], + env: { + ...bunEnv, + // Both flags are necessary to force this condition + "BUN_FEATURE_FLAG_FORCE_WAITER_THREAD": "1", + "BUN_GARBAGE_COLLECTOR_LEVEL": "1", + }, + }); + if (result.exitCode !== 0) { + console.error(result.stderr.toString()); + console.log(result.stdout.toString()); + } + expect(result.exitCode).toBe(0); + }, + 60_000, + ); } describe("spawn unref and kill should not hang", () => { diff --git a/test/js/bun/sqlite/sqlite.test.js b/test/js/bun/sqlite/sqlite.test.js index 474039e1d6..9efdf3ee02 100644 --- a/test/js/bun/sqlite/sqlite.test.js +++ b/test/js/bun/sqlite/sqlite.test.js @@ -15,17 +15,19 @@ it("Database.open", () => { expect(error.message).toBe( process.env.BUN_POLYFILLS_TEST_RUNNER ? "Cannot open database because the directory does not exist" - : "unable to open database file" + : "unable to open database file", ); } // in a file which doesn't exist - if (!process.env.BUN_POLYFILLS_TEST_RUNNER) try { // not sure why this is supposed to error, better-sqlite3 has no issue with it? - Database.open(`/tmp/database-${Math.random()}.sqlite`, constants.SQLITE_OPEN_READWRITE); - throw new Error("Expected an error to be thrown"); - } catch (error) { - expect(error.message).toBe("unable to open database file"); - } + if (!process.env.BUN_POLYFILLS_TEST_RUNNER) + try { + // not sure why this is supposed to error, better-sqlite3 has no issue with it? + Database.open(`/tmp/database-${Math.random()}.sqlite`, constants.SQLITE_OPEN_READWRITE); + throw new Error("Expected an error to be thrown"); + } catch (error) { + expect(error.message).toBe("unable to open database file"); + } // in a file which doesn't exist try { @@ -36,12 +38,14 @@ it("Database.open", () => { } // in a file which doesn't exist - if (!process.env.BUN_POLYFILLS_TEST_RUNNER) try { // not sure why this is supposed to error, better-sqlite3 has no issue with it? (x2) - Database.open(`/tmp/database-${Math.random()}.sqlite`, { readwrite: true }); - throw new Error("Expected an error to be thrown"); - } catch (error) { - expect(error.message).toBe("unable to open database file"); - } + if (!process.env.BUN_POLYFILLS_TEST_RUNNER) + try { + // not sure why this is supposed to error, better-sqlite3 has no issue with it? (x2) + Database.open(`/tmp/database-${Math.random()}.sqlite`, { readwrite: true }); + throw new Error("Expected an error to be thrown"); + } catch (error) { + expect(error.message).toBe("unable to open database file"); + } // create works { @@ -140,8 +144,8 @@ it("int52", () => { it("typechecks", () => { const db = Database.open(":memory:"); db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT)"); - db.exec('INSERT INTO test (name) VALUES (\'Hello\')'); - db.exec('INSERT INTO test (name) VALUES (\'World\')'); + db.exec("INSERT INTO test (name) VALUES ('Hello')"); + db.exec("INSERT INTO test (name) VALUES ('World')"); const q = db.prepare("SELECT * FROM test WHERE (name = ?)"); @@ -173,8 +177,8 @@ it("typechecks", () => { expectfail(Symbol("oh hai")); expectfail(new Date()); - expectfail(class Foo { }); - expectfail(() => class Foo { }); + expectfail(class Foo {}); + expectfail(() => class Foo {}); expectfail(new RangeError("what")); expectfail(new Map()); expectfail(new Map([["foo", "bar"]])); @@ -221,8 +225,8 @@ it("db.query supports TypedArray", () => { it("supports serialize/deserialize", () => { const db = Database.open(":memory:"); db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT)"); - db.exec('INSERT INTO test (name) VALUES (\'Hello\')'); - db.exec('INSERT INTO test (name) VALUES (\'World\')'); + db.exec("INSERT INTO test (name) VALUES ('Hello')"); + db.exec("INSERT INTO test (name) VALUES ('World')"); const input = db.serialize(); const db2 = new Database(input); @@ -286,8 +290,8 @@ it("db.query()", () => { var q = db.query("SELECT * FROM test WHERE name = ?"); expect(q.get("Hello") === null).toBe(true); - db.exec('INSERT INTO test (name) VALUES (\'Hello\')'); - db.exec('INSERT INTO test (name) VALUES (\'World\')'); + db.exec("INSERT INTO test (name) VALUES ('Hello')"); + db.exec("INSERT INTO test (name) VALUES ('World')"); var rows = db.query("SELECT * FROM test WHERE name = ?").all(["Hello"]); @@ -342,9 +346,7 @@ it("db.query()", () => { db.query("SELECT * FROM test where (name = ? OR name = ?)").all("Hello"); } catch (e) { expect(e.message).toBe( - process.env.BUN_POLYFILLS_TEST_RUNNER - ? "Too few parameter values were provided" - : "Expected 2 values, got 1" + process.env.BUN_POLYFILLS_TEST_RUNNER ? "Too few parameter values were provided" : "Expected 2 values, got 1", ); } @@ -410,9 +412,7 @@ it("db.transaction()", () => { throw new Error("Should have thrown"); } catch (exception) { expect(exception.message).toBe( - process.env.BUN_POLYFILLS_TEST_RUNNER - ? "UNIQUE constraint failed: cats.name" - : "constraint failed" + process.env.BUN_POLYFILLS_TEST_RUNNER ? "UNIQUE constraint failed: cats.name" : "constraint failed", ); } @@ -563,8 +563,8 @@ describe("Database.run", () => { var q = db.query("SELECT * FROM test WHERE name = ?"); expect(q.get("Hello") === null).toBe(true); - db.exec('INSERT INTO test (name) VALUES (\'Hello\')'); - db.exec('INSERT INTO test (name) VALUES (\'World\')'); + db.exec("INSERT INTO test (name) VALUES ('Hello')"); + db.exec("INSERT INTO test (name) VALUES ('World')"); try { db.run(" "); diff --git a/test/js/bun/util/bun-isMainThread.test.js b/test/js/bun/util/bun-isMainThread.test.js index 4a71df9450..c00021d0b9 100644 --- a/test/js/bun/util/bun-isMainThread.test.js +++ b/test/js/bun/util/bun-isMainThread.test.js @@ -4,7 +4,8 @@ import { bunEnv, bunExe } from "harness"; test("Bun.isMainThread", () => { expect(Bun.isMainThread).toBeTrue(); - if (!process.env.BUN_POLYFILLS_TEST_RUNNER) { // can be removed once node has web Worker support + if (!process.env.BUN_POLYFILLS_TEST_RUNNER) { + // can be removed once node has web Worker support const { stdout, exitCode } = Bun.spawnSync({ cmd: [bunExe(), ...process.execArgv, import.meta.resolveSync("./main-worker-file.js")], stderr: "inherit", diff --git a/test/js/bun/util/filesink.test.ts b/test/js/bun/util/filesink.test.ts index c82076ec71..c411b78e83 100644 --- a/test/js/bun/util/filesink.test.ts +++ b/test/js/bun/util/filesink.test.ts @@ -45,7 +45,7 @@ describe("FileSink", () => { const path = `/tmp/bun-test-${Bun.hash(label).toString(10)}.txt`; try { require("fs").unlinkSync(path); - } catch (e) { } + } catch (e) {} return path; } @@ -56,7 +56,7 @@ describe("FileSink", () => { const path = `/tmp/bun-test-${Bun.hash(label).toString(10)}.txt`; try { require("fs").unlinkSync(path); - } catch (e) { } + } catch (e) {} mkfifo(path, 0o666); activeFIFO = (async function (stream: ReadableStream) { var chunks: Uint8Array[] = []; diff --git a/test/js/bun/util/peek.test.ts b/test/js/bun/util/peek.test.ts index eaf698f441..934bbe292a 100644 --- a/test/js/bun/util/peek.test.ts +++ b/test/js/bun/util/peek.test.ts @@ -16,7 +16,7 @@ test.skipIf(!!process.env.BUN_POLYFILLS_TEST_RUNNER)("peek", () => { expect(value).toBe(42); // if we peek a pending promise, it returns the promise again - const pending = new Promise(() => { }); + const pending = new Promise(() => {}); expect(peek(pending)).toBe(pending); // If we peek a rejected promise, it: @@ -26,17 +26,17 @@ test.skipIf(!!process.env.BUN_POLYFILLS_TEST_RUNNER)("peek", () => { const peeked = peek(rejected); expect(peeked instanceof Error).toBe(true); expect((peeked as Error).message).toBe("Succesfully tested promise rejection"); - rejected.catch(() => { }); + rejected.catch(() => {}); }); test("peek.status", () => { const promise = Promise.resolve(true); expect(peek.status(promise)).toBe("fulfilled"); - const pending = new Promise(() => { }); + const pending = new Promise(() => {}); expect(peek.status(pending)).toBe("pending"); const rejected = Promise.reject(new Error("oh nooo")); expect(peek.status(rejected)).toBe("rejected"); - rejected.catch(() => { }); + rejected.catch(() => {}); }); diff --git a/test/js/bun/util/which.test.ts b/test/js/bun/util/which.test.ts index d228a0c4e1..29b73e3a2c 100644 --- a/test/js/bun/util/which.test.ts +++ b/test/js/bun/util/which.test.ts @@ -49,7 +49,7 @@ test("which", () => { try { mkdirSync("myscript.sh"); chmodSync("myscript.sh", "755"); - } catch (e) { } + } catch (e) {} // directories should not be returned expect(which("myscript.sh")).toBe(null); @@ -78,7 +78,7 @@ test("which", () => { function writeFixture(path: string) { try { unlinkSync(path); - } catch (e) { } + } catch (e) {} var script_name = path; var script_content = "echo Hello world!";