diff --git a/CMakeLists.txt b/CMakeLists.txt index 037d499453..37edc34bd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.22) cmake_policy(SET CMP0091 NEW) cmake_policy(SET CMP0067 NEW) -set(Bun_VERSION "1.0.34") +set(Bun_VERSION "1.0.35") set(WEBKIT_TAG 089023cc9078b3aa173869fd6685f3e7bed2a994) if(APPLE AND DEFINED ENV{CI}) diff --git a/src/bun.js/module_loader.zig b/src/bun.js/module_loader.zig index 513f9bd794..dbda33c413 100644 --- a/src/bun.js/module_loader.zig +++ b/src/bun.js/module_loader.zig @@ -594,7 +594,7 @@ pub const RuntimeTranspilerStore = struct { .source_url = duped.createIfDifferent(path.text), .hash = 0, }; - this.resolved_source.source_code.value.WTFStringImpl.ensureHash(); + this.resolved_source.source_code.ensureHash(); return; } @@ -683,7 +683,7 @@ pub const RuntimeTranspilerStore = struct { // Before ensureHash: // 506.00 ms 6.1% 506.00 ms WTF::StringImpl::hashSlowCase() const // - result.value.WTFStringImpl.ensureHash(); + result.ensureHash(); break :brk result; }; diff --git a/src/string.zig b/src/string.zig index 662e6b302f..77bdc5beeb 100644 --- a/src/string.zig +++ b/src/string.zig @@ -295,6 +295,10 @@ pub const String = extern struct { return this.tag == Tag.ZigString and this.value.ZigString.isGloballyAllocated(); } + pub fn ensureHash(this: String) void { + if (this.tag == .WTFStringImpl) this.value.WTFStringImpl.ensureHash(); + } + pub fn toOwnedSlice(this: String, allocator: std.mem.Allocator) ![]u8 { switch (this.tag) { .ZigString => return try this.value.ZigString.toOwnedSlice(allocator), diff --git a/test/integration/next/default-pages-dir/test/dev-server-puppeteer.ts b/test/integration/next/default-pages-dir/test/dev-server-puppeteer.ts index d493b8a474..1b6de6db47 100644 --- a/test/integration/next/default-pages-dir/test/dev-server-puppeteer.ts +++ b/test/integration/next/default-pages-dir/test/dev-server-puppeteer.ts @@ -15,7 +15,6 @@ if (process.argv.length > 2) { const b = await launch({ headless: true, dumpio: true, - protocol: "webDriverBiDi", }); async function main() { diff --git a/test/js/bun/test/expect.test.js b/test/js/bun/test/expect.test.js index 78c505e147..b0b7f5dab0 100644 --- a/test/js/bun/test/expect.test.js +++ b/test/js/bun/test/expect.test.js @@ -2315,7 +2315,7 @@ describe("expect()", () => { [[1n, "abc", null, -1n, undefined], -1n], [[Symbol.for("a")], Symbol.for("a")], [new Set([1, 2, 3]), 1], - [new Set([[], { a: 1 }, new Headers()]), new Headers()], + ...[!isJest ? [new Set([[], { a: 1 }, new Headers()]), new Headers()] : []], [new Set(["a", "b", "c"]), "c"], [new Set([new Map([[1, 2]])]), new Map([[1, 2]])], [new Uint8Array([1, 2, 3]), 1], @@ -3267,18 +3267,22 @@ describe("expect()", () => { label: `Buffer.from("")`, value: Buffer.from(""), }, - { - label: `new Headers()`, - value: new Headers(), - }, - { - label: `new URLSearchParams()`, - value: new URLSearchParams(), - }, - { - label: `new FormData()`, - value: new FormData(), - }, + ...(isBun + ? [ + { + label: `new Headers()`, + value: new Headers(), + }, + { + label: `new URLSearchParams()`, + value: new URLSearchParams(), + }, + { + label: `new FormData()`, + value: new FormData(), + }, + ] + : []), { label: `(function* () {})()`, value: (function* () {})(), @@ -3343,26 +3347,30 @@ describe("expect()", () => { label: `Buffer.from(" ")`, value: Buffer.from(" "), }, - { - label: `new Headers({...})`, - value: new Headers({ - a: "b", - c: "d", - }), - }, - { - label: `URL.searchParams`, - value: new URL("https://example.com?d=e&f=g").searchParams, - }, - { - label: `FormData`, - value: (() => { - var a = new FormData(); - a.append("a", "b"); - a.append("c", "d"); - return a; - })(), - }, + ...(isBun + ? [ + { + label: `new Headers({...})`, + value: new Headers({ + a: "b", + c: "d", + }), + }, + { + label: `URL.searchParams`, + value: new URL("https://example.com?d=e&f=g").searchParams, + }, + { + label: `FormData`, + value: (() => { + var a = new FormData(); + a.append("a", "b"); + a.append("c", "d"); + return a; + })(), + }, + ] + : []), { label: `generator function`, value: (function* () { @@ -4282,7 +4290,7 @@ describe("expect()", () => { expect(expect.assertions(1)).toBeUndefined(); }); - const mocked = mock(() => {}); + const mocked = isBun ? mock(() => {}) : jest.fn(() => {}); mocked(); test("fail to return undefined", () => {