From c40eab39a7dc82f3dba2da2c6af2445496f59e7d Mon Sep 17 00:00:00 2001 From: Ehab Younes Date: Fri, 17 Apr 2026 16:19:40 +0000 Subject: [PATCH 1/3] docs: add devcontainer config and update integration test command Add a devcontainer configuration using the official MS typescript-node:24-bookworm image with xvfb pre-installed for headless integration testing. Update the AGENTS.md integration tests command to use xvfb-run -a, which is required on headless environments (matching CI). --- .devcontainer/Dockerfile | 9 +++++++++ .devcontainer/devcontainer.json | 18 ++++++++++++++++++ AGENTS.md | 8 ++++++++ 3 files changed, 35 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..7884bde1 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,9 @@ +FROM mcr.microsoft.com/devcontainers/typescript-node:24-bookworm@sha256:7958dd7e6fe4242fce6ba4f57b9de561ea82233d5542921b5335d435c2c78791 + +# Electron and VS Code need native Chromium libraries to run tests. +# Playwright's install-deps handles installing them automatically. +# xvfb provides a virtual X display for headless test execution. +RUN npx playwright install-deps chromium && \ + apt-get update --quiet && apt-get install --yes --no-install-recommends xvfb && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..321d8620 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,18 @@ +{ + "name": "vscode-coder", + "build": { + "dockerfile": "Dockerfile" + }, + "customizations": { + "vscode": { + "extensions": [ + "esbenp.prettier-vscode", + "dbaeumer.vscode-eslint", + "vitest.explorer", + "ms-vscode.extension-test-runner", + "christian-kohler.npm-intellisense" + ] + } + }, + "postCreateCommand": "CI=true pnpm install" +} diff --git a/AGENTS.md b/AGENTS.md index 22cffe04..3b5d0cee 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -42,6 +42,14 @@ doesn't make sense. Honesty over agreeableness. | **Single extension test** | `pnpm test:extension ./test/unit/filename.test.ts` | | **Single webview test** | `pnpm test:webview ./test/webview/filename.test.ts` | +Integration tests launch VS Code and need a display. On headless +environments (CI, devcontainers, SSH) prefix the command with +`xvfb-run -a` (requires the `xvfb` package): + +```sh +xvfb-run -a pnpm test:integration +``` + ## Testing - Test observable behavior and outputs, not implementation details From 1fdef63b0a109da5c0751c41eac9cf1a5b111992 Mon Sep 17 00:00:00 2001 From: Ehab Younes Date: Fri, 17 Apr 2026 21:33:50 +0300 Subject: [PATCH 2/3] fix(devcontainer): tidy setup and track base image via dependabot Set remoteUser to node so pnpm install writes files as UID 1000 rather than root on the mounted workspace. Drop the redundant apt-get update since playwright install-deps already refreshed the cache, and remove /root/.npm so the cached playwright tarball does not bloat the image. Gitignore the .pnpm-store workspace fallback that pnpm creates when the default store sits on a different filesystem than the bind mount. Drop the npm-intellisense extension recommendation since the project is a strict pnpm workspace. Flag the headless caveat on the integration tests table row so a scanner sees it before running the wrong command. Add a docker dependabot ecosystem pointed at .devcontainer so the base image sha256 digest stays current on weekly cadence. --- .devcontainer/Dockerfile | 10 +++++----- .devcontainer/devcontainer.json | 4 ++-- .github/dependabot.yml | 6 ++++++ .gitignore | 1 + AGENTS.md | 2 +- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 7884bde1..9609c55c 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,9 +1,9 @@ FROM mcr.microsoft.com/devcontainers/typescript-node:24-bookworm@sha256:7958dd7e6fe4242fce6ba4f57b9de561ea82233d5542921b5335d435c2c78791 -# Electron and VS Code need native Chromium libraries to run tests. -# Playwright's install-deps handles installing them automatically. +# Electron and VS Code need the same native libraries as Chromium to run +# integration tests. Playwright's install-deps maintains that list upstream. # xvfb provides a virtual X display for headless test execution. -RUN npx playwright install-deps chromium && \ - apt-get update --quiet && apt-get install --yes --no-install-recommends xvfb && \ +RUN npx --yes playwright install-deps chromium && \ + apt-get install --yes --no-install-recommends xvfb && \ apt-get clean && \ - rm -rf /var/lib/apt/lists/* + rm -rf /var/lib/apt/lists/* /root/.npm diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 321d8620..4d3ebee3 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,14 +3,14 @@ "build": { "dockerfile": "Dockerfile" }, + "remoteUser": "node", "customizations": { "vscode": { "extensions": [ "esbenp.prettier-vscode", "dbaeumer.vscode-eslint", "vitest.explorer", - "ms-vscode.extension-test-runner", - "christian-kohler.npm-intellisense" + "ms-vscode.extension-test-runner" ] } }, diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ab1f1612..6723c1d9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,6 +11,12 @@ updates: interval: "weekly" cooldown: default-days: 7 + - package-ecosystem: "docker" + directory: "/.devcontainer" + schedule: + interval: "weekly" + cooldown: + default-days: 7 - package-ecosystem: "npm" directory: "/" schedule: diff --git a/.gitignore b/.gitignore index 2f41ff05..f85999f1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ /.vscode-test/ /.nyc_output/ /coverage/ +/.pnpm-store/ *.vsix pnpm-debug.log .eslintcache diff --git a/AGENTS.md b/AGENTS.md index 3b5d0cee..ffcd79de 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -38,7 +38,7 @@ doesn't make sense. Honesty over agreeableness. | **All unit tests** | `pnpm test` | | **Extension tests** | `pnpm test:extension` | | **Webview tests** | `pnpm test:webview` | -| **Integration tests** | `pnpm test:integration` | +| **Integration tests** | `pnpm test:integration` (see note on headless) | | **Single extension test** | `pnpm test:extension ./test/unit/filename.test.ts` | | **Single webview test** | `pnpm test:webview ./test/webview/filename.test.ts` | From 2a2f1ae6f3d97d347fdfbf224d1827de8371999c Mon Sep 17 00:00:00 2001 From: Ehab Younes Date: Sat, 18 Apr 2026 18:12:53 +0300 Subject: [PATCH 3/3] refactor(devcontainer): align with CI and add README Switch base to Node 22 to match CI and package.json engines. Use pnpm install --frozen-lockfile instead of CI=true for explicit intent. Add apt-get update before xvfb install for robustness. Add a small README with an Open in Dev Containers badge. Tidy AGENTS.md wording. --- .devcontainer/Dockerfile | 8 ++++---- .devcontainer/README.md | 10 ++++++++++ .devcontainer/devcontainer.json | 2 +- AGENTS.md | 5 ++--- 4 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 .devcontainer/README.md diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9609c55c..59f814be 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,9 +1,9 @@ -FROM mcr.microsoft.com/devcontainers/typescript-node:24-bookworm@sha256:7958dd7e6fe4242fce6ba4f57b9de561ea82233d5542921b5335d435c2c78791 +FROM mcr.microsoft.com/devcontainers/typescript-node:22-bookworm@sha256:7653612ebf9384fa1cbd32413d8f4fbf7daaf24e39e8664d9fc030de8c0c0af2 -# Electron and VS Code need the same native libraries as Chromium to run -# integration tests. Playwright's install-deps maintains that list upstream. -# xvfb provides a virtual X display for headless test execution. +# VS Code/Electron share Chromium's native library requirements; playwright +# install-deps tracks that list upstream. xvfb enables headless test runs. RUN npx --yes playwright install-deps chromium && \ + apt-get update && \ apt-get install --yes --no-install-recommends xvfb && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /root/.npm diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 00000000..d903d566 --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,10 @@ +# vscode-coder devcontainer + +[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/coder/vscode-coder) + +A ready-to-code environment matching CI: Node 22, pnpm, and `xvfb` for +headless integration tests. Click the badge above (or run **Dev +Containers: Clone Repository in Container Volume…** from the command +palette) to spin it up. + +See [`AGENTS.md`](../AGENTS.md) for build, lint, and test commands. diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 4d3ebee3..cc14f5cd 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,5 +14,5 @@ ] } }, - "postCreateCommand": "CI=true pnpm install" + "postCreateCommand": "pnpm install --frozen-lockfile" } diff --git a/AGENTS.md b/AGENTS.md index ffcd79de..752eb913 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -38,13 +38,12 @@ doesn't make sense. Honesty over agreeableness. | **All unit tests** | `pnpm test` | | **Extension tests** | `pnpm test:extension` | | **Webview tests** | `pnpm test:webview` | -| **Integration tests** | `pnpm test:integration` (see note on headless) | +| **Integration tests** | `pnpm test:integration` | | **Single extension test** | `pnpm test:extension ./test/unit/filename.test.ts` | | **Single webview test** | `pnpm test:webview ./test/webview/filename.test.ts` | Integration tests launch VS Code and need a display. On headless -environments (CI, devcontainers, SSH) prefix the command with -`xvfb-run -a` (requires the `xvfb` package): +environments (CI, devcontainers) prefix with `xvfb-run -a`: ```sh xvfb-run -a pnpm test:integration