Skip to content

Conversation

fry69
Copy link
Contributor

@fry69 fry69 commented Sep 25, 2025

fix #3378

Signing esbuild binaries seem to fix the problem with failing tests on my machine (M1 Air/macOS 15.7):

$ deno test -A 
[...]
ok | 476 passed (14 steps) | 0 failed | 17 ignored (2m26s)
$ deno test -A --parallel
[...]
ok | 476 passed (14 steps) | 0 failed | 17 ignored (1m42s)

Before:

$ deno test -A packages/plugin-vite/tests/dev_server_test.ts
[...]
FAILED | 21 passed | 7 failed | 1 ignored (11s)

Below is an analysis why this is happening.

Caveat: I am not sure if this fix is correct, or if this hiding symptoms for a deeper root cause, that this manual codesign step should not be necessary. But it works for me, now, and that makes me happy.

For the curious, here are my notes while debugging this problem with the help of GPT-5 Codex -> https://gist.github.com/fry69/dca16c1164defd93a62adecaa0a2b2dd


Investigated the mac-only failures and found that macOS was killing the Vite/esbuild helper when a second dev server spun up; the crash logs showed SIGKILL (Code Signature Invalid) for the esbuild binary. These tests keep one long-lived server running while launching others, so the unsigned/adhoc esbuild binary in the npm cache got revalidated and terminated only on this platform, which is why CI (Linux) kept passing.

actions taken

  • Added ensureEsbuildSigned() in test_utils.ts to locate npm:esbuild/bin/esbuild, run codesign --force --sign - … once per process on Darwin, and surface clear guidance if codesign isn’t available.
  • Hooked that helper into launchDevServer, spawnDevServer, and buildVite so every Vite invocation now runs against a freshly re-signed binary.
  • Kept the rest of the test utilities unchanged, cleaned up the temporary debug artifacts, and ran formatter.

verification

  • deno fmt packages/plugin-vite/tests/test_utils.ts
  • deno test -A packages/plugin-vite/tests/dev_server_test.ts (all 28 relevant cases now pass locally on macOS)

notes & follow-ups

  • The new logic depends on the macOS codesign tool (installed with the Xcode Command Line Tools). If it’s missing, developers will get a direct error telling them to install it or sign the binary manually.
  • No CI impact is expected; the helper early-outs on non-Darwin systems.
  • Root cause mapped: macOS code-signing enforcement → esbuild killed mid-launch → Vite servers never reported their address → tests crashed. The fix ensures the binary stays valid before any server starts.

@fry69
Copy link
Contributor Author

fry69 commented Sep 25, 2025

Fixed in #3493 so this is no longer needed, but I think it is a good idea to keep this pull request open as a draft for future reference, as the underlying problem may surface again.

Otherwise, feel free to close this PR at any time.

@fry69 fry69 marked this pull request as draft September 25, 2025 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some tests are failing when run locally

1 participant