speculative fixes, it works on my machine now

This commit is contained in:
Dave Caruso
2024-08-01 22:46:32 -07:00
parent 214b3ccca0
commit e3f96c2e72
8 changed files with 54 additions and 37 deletions

View File

@@ -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)));

View File

@@ -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",

View File

@@ -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": {

View File

@@ -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": {

View File

@@ -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": {

View File

@@ -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");
}

View File

@@ -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,