Repository navigation
Add --hidden-window to run extension tests without showing a window - #344174
Dmitriy Vasyura (dmitrivMS) merged 14 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Native state restoration and CLI activation can still reveal or focus hidden windows, while auxiliary windows can receive an incorrect maximized state.
3 open issues
What changed in this PR
Adds --hidden-window for extension test runs, aiming to prevent visible windows and focus interruptions while keeping rendering and timers active.
Changes:
- Registers the flag and honors it only with
--extensionTestsPath. - Disables initial window visibility and background throttling, and guards explicit show/focus operations.
- Adds unit tests for flag gating, state restoration, and focus suppression.
| File | Description |
|---|---|
src/vs/platform/windows/test/electron-main/windowImpl.test.ts |
Tests hidden-mode gating and window behavior. |
src/vs/platform/windows/electron-main/windows.ts |
Adds the hidden-mode helper and browser-window options. |
src/vs/platform/windows/electron-main/windowImpl.ts |
Guards explicit show and focus calls. |
src/vs/platform/environment/node/argv.ts |
Registers the boolean CLI option. |
src/vs/platform/environment/common/argv.ts |
Adds the typed CLI argument. |
Review effort: Balanced
062b37b to
b34c2eb
Compare
78ad076 to
141a723
Compare
When passed together with --extensionTestsPath, workbench windows are created with `show: false` and background throttling disabled, are not shown after restoring a maximized/fullscreen state, and ignore focus requests, so test runs on macOS no longer steal focus. Rendering stays enabled; `vscode.window.state.focused` reports false.
maximize() and setFullScreen() reveal a window that was never shown, so skipping only the trailing show() was not enough. Test windows can still start maximized or fullscreen via window.newWindowDimensions. In hidden mode, applyState now returns before either call and keeps the default bounds.
LaunchMainService.start called app.focus({ steal: true }) on macOS
whenever another instance forwarded its arguments, which could bring a
--hidden-window extension test instance to the front. Skip it when
isHiddenWindowMode is true; windows it opens are already hidden.
toggleFullScreen (e.g. workbench.action.toggleFullScreen, Zen Mode) and nativeHostMainService.maximizeWindow reveal a never-shown window, and native fullscreen on macOS also switches Spaces. Return early from both in hidden mode. The guard sits in toggleFullScreen rather than setFullScreen so the renderer is not told about a fullscreen change that never happened.
AuxiliaryWindow inferred Maximized from `show === false`, which --hidden-window sets for every window. Carry the requested mode through pendingWindowOptionsQueue instead and fall back to the inference only when no queue entry exists. Fullscreen still restores as maximized, so behavior outside hidden mode is unchanged.
ChatSuspendThrottlingHandler calls setBackgroundThrottling(true) at startup when chat is idle, and NativeHostMainService forwarded it unconditionally, overriding the creation-time setting for --hidden-window windows. Route the value through isBackgroundThrottlingAllowed, which keeps throttling disabled in hidden mode.
141a723 to
bdf280a
Compare
|
cc Connor Peet (@connor4312) Does this change look good? |
There was a problem hiding this comment.
Thanks for the PR! While validating this my agent found a case where the window could be revealed even if initially launched with a hidden window:
[P2] Auxiliary editor windows still become visible in hidden mode
I reproduced this on macOS with Electron 43.8.6, including a visual confirmation of both windows on the desktop. The initial main window stays hidden, but workbench.action.moveEditorToNewWindow makes the auxiliary editor visible. Opening a file through a second CLI invocation afterward also reveals the main window.
This is not the earlier unconditional app.focus() issue: a secondary CLI invocation before creating an auxiliary window stays hidden. Forced window focus and fullscreen requests also stayed hidden in the tests.
What is failing
The constructor overrides in defaultBrowserWindowOptions do not enforce the hidden-mode contract through the actual auxiliary-editor lifecycle:
- Auxiliary windows originate from renderer
window.open('about:blank', ...). I observeddid-create-windowreceivingshow: falseandwebPreferences.backgroundThrottling: false. The child is initially invisible at that event, but becomes visible as the editor is opened. The nativeBaseWindow.focus()guard therefore does not cover the whole path. I have not isolated the final native activation callback responsible for showing it, so I would not attribute that to the CLI'sapp.focus()call. - There is also a concrete throttling problem: the auxiliary WebContents already has
backgroundThrottling === trueatdid-create-window, despite the override being false. Electron creates the popup WebContents before wrapping it in a BrowserWindow. Its existing-WebContents reuse path updates stored preferences but does not callSetBackgroundThrottling; the adopted WebContents retains its native default. Hidden auxiliary windows need the runtime setting applied to the actual WebContents, not only the constructor dictionary.
Please cover real auxiliary creation/editor activation and the subsequent file-open path. The added “normal hidden auxiliary window” test exercises a stubbed TestWindow.applyState(), not an actual window.open/AuxiliaryWindow lifecycle, so it passes while this reproduces.
Minimal repro
Use any valid minimal extension development folder, and save this as repro.cjs inside it:
const vscode = require('vscode');
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
exports.run = async () => {
const document = await vscode.workspace.openTextDocument({
content: 'This auxiliary editor should never appear on screen.'
});
await vscode.window.showTextDocument(document);
await delay(3000); // The main window should still be invisible.
await vscode.commands.executeCommand('workbench.action.moveEditorToNewWindow');
await delay(30000); // Keep the test instance alive for the second CLI invocation.
};From the built checkout, launch it with fresh, isolated directories:
probe=$(mktemp -d)
mkdir -p "$probe/workspace"
printf 'CLI visibility repro\n' > "$probe/workspace/cli.txt"
echo "Use this same probe directory in the second terminal: $probe"
env -u ELECTRON_RUN_AS_NODE VSCODE_SKIP_PRELAUNCH=1 ./scripts/code.sh \
"$probe/workspace" \
--user-data-dir="$probe/profile" \
--extensions-dir="$probe/extensions" \
--shared-data-dir="$probe/shared-data" \
--extensionDevelopmentPath=/absolute/path/to/extension \
--extensionTestsPath=/absolute/path/to/extension/repro.cjs \
--hidden-window --disable-extensions --disable-workspace-trust \
--skip-welcome --skip-release-notesWhile the test is in its final 30-second delay, run this in another terminal, substituting the same probe directory printed above:
probe=/the/probe/directory/printed/above
env -u ELECTRON_RUN_AS_NODE VSCODE_SKIP_PRELAUNCH=1 ./scripts/code.sh \
--user-data-dir="$probe/profile" \
--shared-data-dir="$probe/shared-data" \
--reuse-window "$probe/workspace/cli.txt"Expected: neither window is ever visible; both WebContents remain unthrottled.
Actual: the auxiliary editor appears after the move command, with background throttling enabled; the second CLI open then reveals the main window too.
This was reduced to just showing an untitled document, moving it to a new window, and opening a file via CLI; the earlier webview/focus/fullscreen steps are not required. The visibility failures also reproduced without renderer automation attached. All test instances were isolated and closed afterward.
Auxiliary windows are created by window.open, so Electron creates their WebContents before the BrowserWindow and does not apply the `backgroundThrottling: false` constructor option to it. In hidden mode, turn throttling off on the actual WebContents when the auxiliary window is claimed.
BrowserWindow.moveTop() reveals a hidden window on macOS. The workbench calls it when an editor is activated, so moving an editor to a new window showed the auxiliary window, and a later file open from the CLI showed the main window. In hidden mode, moveWindowTop now does nothing.
|
Thanks for the review! Both issues are fixed:
With your repro on macOS (Electron 43.8.6), both windows now stay hidden through the editor move and the second CLI open, and both WebContents stay unthrottled. On tests: the extension API can't see native visibility or throttling, so an integration test in |
VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. The option is marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder (VS Code exits), so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do (dialogs are never shown); the test project's dialog suite and close-folder hook use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. The option is marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder (VS Code exits), so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do (dialogs are never shown); the test project's dialog suite and close-folder hook use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. The option is marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder (VS Code exits), so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do (dialogs are never shown); the test project's dialog suite and close-folder hook use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. The option is marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder (VS Code exits), so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do (dialogs are never shown); the test project's dialog suite and close-folder hook use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. The option is marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder (VS Code exits), so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do (dialogs are never shown); the test project's dialog suite and close-folder hook use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. The option is marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder (VS Code exits), so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do (dialogs are never shown); the test project's dialog suite and close-folder hook use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. The option is marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder (VS Code exits), so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do (dialogs are never shown); the test project's dialog suite and close-folder hook use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. The option is marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder (VS Code exits), so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do (dialogs are never shown); the test project's dialog suite and close-folder hook use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. The option is marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder (VS Code exits), so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do (dialogs are never shown); the test project's dialog suite and close-folder hook use it. test project's dialog suite and close-folder hook use it. Commands that still reach the executor of the closed session, such as a captured Actions object or a command in flight during the restart, are forwarded to the new session instead of failing with ECONNREFUSED. Linux is not supported: a never-shown window renders unreliably under X11/ Xvfb, so ExTester warns and shows the window there. The new hidden CI jobs run on macOS and Windows. ExTester Runner gets an experimental extesterRunner.hiddenWindow setting that sets EXTESTER_HIDDEN_WINDOW=true for npx extest and custom run commands; a value in the env setting wins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. The option is marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder (VS Code exits), so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do (dialogs are never shown); the test project's dialog suite and close-folder hook use it. test project's dialog suite and close-folder hook use it. Commands that still reach the executor of the closed session, such as a captured Actions object or a command in flight during the restart, are forwarded to the new session instead of failing with ECONNREFUSED. Under X11/Xvfb a never-shown window sometimes starts without being drawn (1-4 animation frames/s). ExTester measures the frame rate after each hidden launch and restarts VS Code up to twice when it is below 10 frames/s. The status bar page object now waits for editor items (language, encoding, position, ...) that VS Code adds on a later frame, and the notifications test allows for a late notification. The new hidden CI jobs run on all three platforms. ExTester Runner gets an experimental extesterRunner.hiddenWindow setting that sets EXTESTER_HIDDEN_WINDOW=true for npx extest and custom run commands; a value in the env setting wins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. The option is marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder (VS Code exits), so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do (dialogs are never shown); the test project's dialog suite and close-folder hook use it. test project's dialog suite and close-folder hook use it. Commands that still reach the executor of the closed session, such as a captured Actions object or a command in flight during the restart, are forwarded to the new session instead of failing with ECONNREFUSED. Under X11/Xvfb a never-shown window sometimes starts without being drawn (1-4 animation frames/s). ExTester measures the frame rate after each hidden launch and restarts VS Code up to twice when it is below 10 frames/s. Before each hidden restart it waits until the processes of the previous instance are gone (via ps, not on Windows), so the new instance does not compete with one that is still shutting down. The status bar page object now waits for editor items (language, encoding, position, ...) that VS Code adds on a later frame, and the notifications test allows for a late notification. The new hidden CI jobs run on all three platforms. ExTester Runner gets an experimental extesterRunner.hiddenWindow setting that sets EXTESTER_HIDDEN_WINDOW=true for npx extest and custom run commands; a value in the env setting wins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. The option is marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder (VS Code exits), so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do (dialogs are never shown); the test project's dialog suite and close-folder hook use it. test project's dialog suite and close-folder hook use it. Commands that still reach the executor of the closed session, such as a captured Actions object or a command in flight during the restart, are forwarded to the new session instead of failing with ECONNREFUSED. Under X11/Xvfb a never-shown window sometimes starts without being drawn (1-4 animation frames/s). ExTester measures the frame rate after each hidden launch and restarts VS Code up to twice when it is below 10 frames/s. The status bar page object now waits for editor items (language, encoding, position, ...) that VS Code adds on a later frame, TextEditor.moveCursor waits for the status bar to show the new position after each key instead of a fixed 20 ms, so a late update no longer makes it press the key once too often, and the notifications test runs the command again when nothing shows up. The new hidden CI jobs run on all three platforms. ExTester Runner gets an experimental extesterRunner.hiddenWindow setting that sets EXTESTER_HIDDEN_WINDOW=true for npx extest and custom run commands; a value in the env setting wins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. The option is marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder (VS Code exits), so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do (dialogs are never shown); the test project's dialog suite and close-folder hook use it. test project's dialog suite and close-folder hook use it. Commands that still reach the executor of the closed session, such as a captured Actions object or a command in flight during the restart, are forwarded to the new session instead of failing with ECONNREFUSED. Under X11/Xvfb a never-shown window sometimes starts without being drawn (1-4 animation frames/s). ExTester measures the frame rate after each hidden launch and restarts VS Code up to twice when it is below 10 frames/s. The status bar page object now waits for editor items (language, encoding, position, ...) that VS Code adds on a later frame, TextEditor.moveCursor waits for the status bar to show the new position after each key instead of a fixed 20 ms, so a late update no longer makes it press the key once too often, the notifications tests run the command again when nothing shows up, and the EditorView setup gives the "Text File" quick pick more time to open. The new hidden CI jobs run on all three platforms. ExTester Runner gets an experimental extesterRunner.hiddenWindow setting that sets EXTESTER_HIDDEN_WINDOW=true for npx extest and custom run commands; a value in the env setting wins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. The option is marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder (VS Code exits), so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do (dialogs are never shown); the test project's dialog suite and close-folder hook use it. test project's dialog suite and close-folder hook use it. Commands that still reach the executor of the closed session, such as a captured Actions object or a command in flight during the restart, are forwarded to the new session instead of failing with ECONNREFUSED. Under X11/Xvfb a never-shown window sometimes starts without being drawn (1-4 animation frames/s). ExTester measures the frame rate after each hidden launch and restarts VS Code up to twice when it is below 10 frames/s. The status bar page object now waits for editor items (language, encoding, position, ...) that VS Code adds on a later frame, TextEditor.moveCursor waits for the status bar to show the new position after each key instead of a fixed 20 ms, so a late update no longer makes it press the key once too often, NotificationsCenter.getNotifications reopens the center when VS Code closed it and skips rows that are not rendered yet, the new NotificationsCenter.waitForNotification(message) waits for a notification by its text, and StatusBar.openNotificationsCenter throws instead of returning a closed center. The notification tests use them and run the command again when nothing shows up, and the EditorView setup opens untitled files with a direct command. The new hidden CI jobs run on all three platforms. ExTester Runner gets an experimental extesterRunner.hiddenWindow setting that sets EXTESTER_HIDDEN_WINDOW=true for npx extest and custom run commands; a value in the env setting wins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester now exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json, and the EXTESTER_HIDDEN_WINDOW environment variable, so a local run no longer takes over the user's screen. The option is marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder (VS Code exits), so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do (dialogs are never shown); the test project's dialog suite and close-folder hook use it. test project's dialog suite and close-folder hook use it. Commands that still reach the executor of the closed session, such as a captured Actions object or a command in flight during the restart, are forwarded to the new session instead of failing with ECONNREFUSED. Under X11/Xvfb a never-shown window sometimes starts without being drawn (1-4 animation frames/s). ExTester measures the frame rate after each hidden launch and restarts VS Code up to twice when it is below 10 frames/s. The status bar page object now waits for editor items (language, encoding, position, ...) that VS Code adds on a later frame, TextEditor.moveCursor waits for the status bar to show the new position after each key instead of a fixed 20 ms, so a late update no longer makes it press the key once too often, NotificationsCenter.getNotifications reopens the center when VS Code closed it and skips rows that are not rendered yet, the new NotificationsCenter.waitForNotification(message) waits for a notification by its text, and StatusBar.openNotificationsCenter throws instead of returning a closed center. Input.clear retries for up to 3 s while the quick input does not accept keys yet. The notification tests use them and run the command again when nothing shows up, and the EditorView setup opens untitled files with a direct command. The new hidden CI jobs run on all three platforms. ExTester Runner gets an experimental extesterRunner.hiddenWindow setting that sets EXTESTER_HIDDEN_WINDOW=true for npx extest and custom run commands; a value in the env setting wins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json and the EXTESTER_HIDDEN_WINDOW environment variable, marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder, so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. Commands that still reach the executor of the closed session are forwarded to the new one. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do. Under X11/Xvfb a never-shown window sometimes starts without being drawn (1-4 animation frames/s), so ExTester measures the frame rate after each hidden launch and restarts VS Code up to twice when it is below 10. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json and the EXTESTER_HIDDEN_WINDOW environment variable, marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder, so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. Commands that still reach the executor of the closed session are forwarded to the new one. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do. Under X11/Xvfb a never-shown window sometimes starts without being drawn (1-4 animation frames/s), so ExTester measures the frame rate after each hidden launch and restarts VS Code up to twice when it is below 10. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json and the EXTESTER_HIDDEN_WINDOW environment variable, marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0 print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder, so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. Commands that still reach the executor of the closed session are forwarded to the new one. VSBrowser.isHiddenWindow lets suites skip what test mode cannot do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json and the EXTESTER_HIDDEN_WINDOW environment variable, marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0, and versions that cannot be parsed, print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder, so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. The restart keeps the user data dir and appends to test.log and chromedriver.log. Commands sent while the restart runs are forwarded to the new session. VSBrowser.isHiddenWindow, known from the moment the browser is created (before the test files load), lets suites skip what test mode cannot do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json and the EXTESTER_HIDDEN_WINDOW environment variable, marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0, and versions that cannot be parsed, print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder, so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. The restart keeps the user data dir and appends to test.log and chromedriver.log. Commands sent while the restart runs are forwarded to the new session. VSBrowser.isHiddenWindow, known from the moment the browser is created (before the test files load), lets suites skip what test mode cannot do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json and the EXTESTER_HIDDEN_WINDOW environment variable, marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0, and versions that cannot be parsed, print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder, so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. The restart keeps the user data dir and appends to test.log and chromedriver.log. Commands sent while the restart runs are forwarded to the new session. VSBrowser.isHiddenWindow, known from the moment the browser is created (before the test files load), lets suites skip what test mode cannot do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>
… showing VS Code VS Code 1.147.0 added a --hidden-window CLI flag (microsoft/vscode#344174) that keeps every window hidden and unfocused. ExTester exposes it as --hidden_window on run-tests and setup-and-run, run.hiddenWindow in extester.config.json and the EXTESTER_HIDDEN_WINDOW environment variable, marked experimental in the CLI help, the config schema and the docs. VS Code honours the flag only while running extension tests, so ExTester also passes --extensionTestsPath with a generated runner whose run() never settles (VS Code exits when the runner settles), plus a manifest-only development path when EXTENSION_DEV_PATH is not set. Releases before 1.147.0, and versions that cannot be parsed, print a warning and launch visibly as before. Extension test mode cannot switch the window to another folder, so in hidden mode openResources() with a folder or .code-workspace restarts VS Code with the resources as launch arguments and moves the new WebDriver session into the existing driver object. The restart keeps the user data dir and appends to test.log and chromedriver.log. Commands sent while the restart runs are forwarded to the new session. VSBrowser.isHiddenWindow, known from the moment the browser is created (before the test files load), lets suites skip what test mode cannot do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SiFCcXrV2iw6iRrgqkeVfu Signed-off-by: Dominik Jelínek <djelinek@redhat.com>


Fixes: #341594
Adds
--hidden-window. It only takes effect together with--extensionTestsPath, so extension tests can run on macOS without showing a window or stealing focus.When it's set:
show: falseand background throttling disabled, including when it's changed at runtime. Pages still reportvisible, and timers andrequestAnimationFramekeep running.maximize()orsetFullScreen(), which would show them.--open-devtools), and the GPU info and content tracing windows. On macOS, the app isn't activated on a second-instance launch, and clicking the Dock icon doesn't open a new window.Known limitations:
vscode.window.state.focusedisfalse, and commands that need keyboard focus (such astype) do nothing.workbench.action.moveEditorToNewWindow, commands likeworkbench.action.closeActiveEditoract on the main window's editor. CallingwebContents.focus()instead doesn't help: windows never lose focus, so routing breaks again after switching windows.isMaximized()andisFullScreen()asfalse. The workbench therefore keeps its title bar instead of switching to its fullscreen layout.--hidden-windowaren't hidden.How to test
On macOS, run an extension test with and without the flag:
--hidden-windowvisiblewindow.state.focusedAdded unit tests for
isHiddenWindowMode, hidden-modeapplyState,focus()andtoggleFullScreen(), runtime background throttling, and the auxiliary window mode used at creation and claim.