Skip to content

Add test:local npm script for running tests from inside VS Code#35

Merged
helly25 merged 1 commit into
mainfrom
chore/test-local-script
May 30, 2026
Merged

Add test:local npm script for running tests from inside VS Code#35
helly25 merged 1 commit into
mainfrom
chore/test-local-script

Conversation

@helly25
Copy link
Copy Markdown
Owner

@helly25 helly25 commented May 30, 2026

Summary

Adds a test:local npm script that makes npm test runnable from VS Code's integrated terminal (and Claude Code).

Why

When tests are launched from inside the VS Code extension host, ELECTRON_RUN_AS_NODE=1 leaks into the shell environment. That forces the downloaded test copy of VS Code's Electron binary to run as plain Node, which then rejects every Electron/Chromium launch flag with bad option: --no-sandbox and aborts the run (exit code 9).

Unsetting ELECTRON_RUN_AS_NODE (plus the VSCODE_IPC_HOOK/VSCODE_PID vars, so the spawned instance doesn't try to attach to the running editor) lets the test instance launch cleanly:

  Extension Test Suite
    ✔ parseCommandLine test
    ✔ parseCommandLine test quotes
    ✔ parseCommandLine test escape
  3 passing

Notes

  • env -u is POSIX, so test:local targets macOS/Linux local runs.
  • Plain npm test is unchanged and remains the cross-platform / CI entry point — the variable isn't set in CI, so it already works there.

🤖 Generated with Claude Code

When tests are run from VS Code's integrated terminal, ELECTRON_RUN_AS_NODE=1
leaks from the extension host into the environment, forcing the downloaded
test copy of VS Code to launch as plain Node and reject all its Electron/
Chromium flags ("bad option: --no-sandbox"). Unset that (and the VS Code IPC
vars) so the test instance launches cleanly. Plain `npm test` remains the
cross-platform/CI entry point.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@helly25 helly25 requested a review from Fab-Cat May 30, 2026 17:56
@helly25 helly25 merged commit 0141163 into main May 30, 2026
2 checks passed
@helly25 helly25 deleted the chore/test-local-script branch May 30, 2026 18:03
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.

2 participants