diff --git a/src/bun.js/bindings/BunProcess.cpp b/src/bun.js/bindings/BunProcess.cpp index e03743ba17..54fbdb0ca5 100644 --- a/src/bun.js/bindings/BunProcess.cpp +++ b/src/bun.js/bindings/BunProcess.cpp @@ -2742,6 +2742,8 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionReallyKill, result = errno; #else int result = uv_kill(pid, signal); + if (result == UV_ESRCH) + result = 0; #endif RELEASE_AND_RETURN(scope, JSValue::encode(jsNumber(result))); diff --git a/test/integration/next-pages/bun.lockb b/test/integration/next-pages/bun.lockb index 683a48a517..a51a84465f 100755 Binary files a/test/integration/next-pages/bun.lockb and b/test/integration/next-pages/bun.lockb differ diff --git a/test/integration/next-pages/package.json b/test/integration/next-pages/package.json index bb25ca4b5e..7cb2586f32 100644 --- a/test/integration/next-pages/package.json +++ b/test/integration/next-pages/package.json @@ -6,8 +6,7 @@ "dev": "next dev", "build": "next build", "start": "next start", - "lint": "next lint", - "postinstall": "cd node_modules/puppeteer && bun install.mjs" + "lint": "next lint" }, "dependencies": { "@types/node": "20.7.0", diff --git a/test/integration/next-pages/test/__snapshots__/dev-server-ssr-100.test.ts.snap b/test/integration/next-pages/test/__snapshots__/dev-server-ssr-100.test.ts.snap index da10c802c8..2cb240df0d 100644 --- a/test/integration/next-pages/test/__snapshots__/dev-server-ssr-100.test.ts.snap +++ b/test/integration/next-pages/test/__snapshots__/dev-server-ssr-100.test.ts.snap @@ -11482,7 +11482,7 @@ exports[`ssr works for 100-ish requests 1`] = ` }, ], "format": "v2", - "meta_hash": "632a4f7405ad36643df0c844e942395e7c61cf79c7738eb128eba03ebdd1e094", + "meta_hash": "86c6be13420c912f4219afc0429239f52f2322f47b4dd65ec971d04a8064d4ea", "package_index": { "@alloc/quick-lru": 13, "@babel/code-frame": 202, @@ -12016,9 +12016,7 @@ exports[`ssr works for 100-ish requests 1`] = ` "tag": "root", "value": "", }, - "scripts": { - "postinstall": "cd node_modules/puppeteer && bun install.mjs", - }, + "scripts": {}, }, { "bin": { diff --git a/test/integration/next-pages/test/__snapshots__/dev-server.test.ts.snap b/test/integration/next-pages/test/__snapshots__/dev-server.test.ts.snap index 7b40a27d78..4400b456de 100644 --- a/test/integration/next-pages/test/__snapshots__/dev-server.test.ts.snap +++ b/test/integration/next-pages/test/__snapshots__/dev-server.test.ts.snap @@ -11482,7 +11482,7 @@ exports[`hot reloading works on the client (+ tailwind hmr) 1`] = ` }, ], "format": "v2", - "meta_hash": "632a4f7405ad36643df0c844e942395e7c61cf79c7738eb128eba03ebdd1e094", + "meta_hash": "86c6be13420c912f4219afc0429239f52f2322f47b4dd65ec971d04a8064d4ea", "package_index": { "@alloc/quick-lru": 13, "@babel/code-frame": 202, @@ -12016,9 +12016,7 @@ exports[`hot reloading works on the client (+ tailwind hmr) 1`] = ` "tag": "root", "value": "", }, - "scripts": { - "postinstall": "cd node_modules/puppeteer && bun install.mjs", - }, + "scripts": {}, }, { "bin": { diff --git a/test/integration/next-pages/test/__snapshots__/next-build.test.ts.snap b/test/integration/next-pages/test/__snapshots__/next-build.test.ts.snap index c23871f444..44bcf08053 100644 --- a/test/integration/next-pages/test/__snapshots__/next-build.test.ts.snap +++ b/test/integration/next-pages/test/__snapshots__/next-build.test.ts.snap @@ -11482,7 +11482,7 @@ exports[`next build works: bun 1`] = ` }, ], "format": "v2", - "meta_hash": "632a4f7405ad36643df0c844e942395e7c61cf79c7738eb128eba03ebdd1e094", + "meta_hash": "86c6be13420c912f4219afc0429239f52f2322f47b4dd65ec971d04a8064d4ea", "package_index": { "@alloc/quick-lru": 13, "@babel/code-frame": 202, @@ -12016,9 +12016,7 @@ exports[`next build works: bun 1`] = ` "tag": "root", "value": "", }, - "scripts": { - "postinstall": "cd node_modules/puppeteer && bun install.mjs", - }, + "scripts": {}, }, { "bin": { @@ -34086,7 +34084,7 @@ exports[`next build works: node 1`] = ` }, ], "format": "v2", - "meta_hash": "632a4f7405ad36643df0c844e942395e7c61cf79c7738eb128eba03ebdd1e094", + "meta_hash": "86c6be13420c912f4219afc0429239f52f2322f47b4dd65ec971d04a8064d4ea", "package_index": { "@alloc/quick-lru": 13, "@babel/code-frame": 202, @@ -34620,9 +34618,7 @@ exports[`next build works: node 1`] = ` "tag": "root", "value": "", }, - "scripts": { - "postinstall": "cd node_modules/puppeteer && bun install.mjs", - }, + "scripts": {}, }, { "bin": { diff --git a/test/integration/next-pages/test/dev-server-puppeteer.ts b/test/integration/next-pages/test/dev-server-puppeteer.ts index dbba82224a..371f1e38a8 100644 --- a/test/integration/next-pages/test/dev-server-puppeteer.ts +++ b/test/integration/next-pages/test/dev-server-puppeteer.ts @@ -1,6 +1,6 @@ import { ConsoleMessage, Page, launch } from "puppeteer"; import assert from "assert"; -import { copyFileSync } from "fs"; +import { copyFileSync, readFileSync, writeFileSync } from "fs"; import { join } from "path"; const root = join(import.meta.dir, "../"); @@ -12,6 +12,8 @@ if (process.argv.length > 2) { url = process.argv[2]; } +const isWindows = process.platform === "win32"; + const b = await launch({ // While puppeteer is migrating to their new headless: `true` mode, // this causes strange issues on macOS in the cloud (AWS and MacStadium). @@ -22,19 +24,24 @@ const b = await launch({ // Fixes: 'TargetCloseError: Protocol error (Target.setAutoAttach): Target closed' headless: "shell", dumpio: true, - pipe: true, - args: [ - // Fixes: 'dock_plist is not an NSDictionary' - "--no-sandbox", - "--single-process", - "--disable-setuid-sandbox", - "--disable-dev-shm-usage", - // Fixes: 'Navigating frame was detached' - "--disable-features=site-per-process", - // Uncomment if you want debug logs from Chromium: - // "--enable-logging=stderr", - // "--v=1", - ], + pipe: !isWindows, + args: isWindows + ? [ + // On windows, it seems passing these flags actually breaks stuff. + "--no-sandbox", + ] + : [ + // Fixes: 'dock_plist is not an NSDictionary' + "--no-sandbox", + "--single-process", + "--disable-setuid-sandbox", + "--disable-dev-shm-usage", + // Fixes: 'Navigating frame was detached' + "--disable-features=site-per-process", + // Uncomment if you want debug logs from Chromium: + // "--enable-logging=stderr", + // "--v=1", + ], }); async function main() { @@ -54,7 +61,7 @@ async function main() { return promise; } - const console_promise = waitForConsoleMessage(p, /counter a/); + let console_promise = waitForConsoleMessage(p, /counter a/); p.goto(url); await console_promise; @@ -67,6 +74,7 @@ async function main() { const [has_class, style_json_string] = await counter_root.evaluate( x => [(x as HTMLElement).classList.contains("rounded-bl-full"), JSON.stringify(getComputedStyle(x))] as const, ); + console.error("looking at style"); assert.strictEqual(has_class, true); const decoded_style = JSON.parse(style_json_string); assert.strictEqual(decoded_style.borderTopLeftRadius, "0px"); @@ -75,7 +83,11 @@ async function main() { assert.strictEqual(decoded_style.borderBottomLeftRadius, "9999px"); } - const getCount = () => counter_root.$eval("p", x => x.innerText); + const getCount = async () => { + const count = await counter_root.$eval("p", x => x.innerText); + console.error("Counter is at " + count); + return count; + }; assert.strictEqual(await getCount(), "Count A: 0"); await counter_root.$eval(".inc", x => (x as HTMLElement).click()); @@ -85,8 +97,13 @@ async function main() { await counter_root.$eval(".dec", x => (x as HTMLElement).click()); assert.strictEqual(await getCount(), "Count A: 1"); + console.error("Waiting for A again"); + + console_promise = waitForConsoleMessage(p, /counter a/); p.reload({}); - await waitForConsoleMessage(p, /counter a/); + await console_promise; + + console.error("Continue"); assert.strictEqual(await p.$eval("code.font-bold", x => x.innerText), Bun.version); @@ -100,7 +117,9 @@ async function main() { await counter_root.$eval(".dec", x => (x as HTMLElement).click()); assert.strictEqual(await getCount(), "Count A: 1"); - copyFileSync(join(root, "src/Counter2.txt"), join(root, "src/Counter.tsx")); + writeFileSync(join(root, "src/Counter.tsx"), readFileSync(join(root, "src/Counter2.txt"))); + + console.log("Waiting for Next HMR"); await waitForConsoleMessage(p, /counter b loaded/); assert.strictEqual(await getCount(), "Count B: 1"); await counter_root.$eval(".inc", x => (x as HTMLElement).click()); @@ -114,6 +133,7 @@ async function main() { const [has_class, style_json_string] = await counter_root.evaluate( x => [(x as HTMLElement).classList.contains("rounded-br-full"), JSON.stringify(getComputedStyle(x))] as const, ); + console.log("Look at styles"); assert.strictEqual(has_class, true); const decoded_style = JSON.parse(style_json_string); assert.strictEqual(decoded_style.borderTopLeftRadius, "0px"); @@ -122,6 +142,8 @@ async function main() { assert.strictEqual(decoded_style.borderBottomLeftRadius, "0px"); } + console.log("Closing"); + await b.close(); console.error("Finished dev-server-puppeteer.ts"); } diff --git a/test/integration/next-pages/test/dev-server.test.ts b/test/integration/next-pages/test/dev-server.test.ts index a0c669f1ef..cf5de4dde1 100644 --- a/test/integration/next-pages/test/dev-server.test.ts +++ b/test/integration/next-pages/test/dev-server.test.ts @@ -135,6 +135,8 @@ test.skipIf(puppeteer_unsupported || (isWindows && isCI))( var pid: number, exited; let timeout = setTimeout(() => { + console.log('Timeout!'); + if (timeout && pid) { process.kill?.(pid); pid = 0; @@ -144,7 +146,7 @@ test.skipIf(puppeteer_unsupported || (isWindows && isCI))( dev_server_pid = undefined; } } - }, 30000).unref(); + }, 300_000).unref(); ({ exited, pid } = Bun.spawn([bunExe(), "test/dev-server-puppeteer.ts", baseUrl], { cwd: root,