Testing SecureZip
July 6, 2026 · View on GitHub
This guide covers the scripts and workflows we use to verify SecureZip so local runs match what GitHub Actions executes.
Prerequisites
- Node.js 24.x (matches all workflows).
- npm 10.9.0 (pinned in CI for reproducible SBOM generation).
- VS Code installed locally if you plan to run the integration tests outside CI.
Install dependencies once per clone:
npm install
Core scripts
| Command | Purpose |
|---|---|
npm run check-types | tsc --noEmit to keep the codebase type-safe. |
npm run lint | ESLint with TypeScript rules. |
npm run compile | Dev bundle (type check + lint + esbuild.js). |
npm run package | Production bundle (node esbuild.js --production) plus SBOM. |
npm run test:unit | Mocha unit tests from out/test/*.js. |
npm run test | VS Code integration tests via @vscode/test-electron. |
npm run package:verify | Preflight vsce packaging (@vscode/vsce) to catch engines.vscode/@types/vscode mismatches before release. |
CI (preview/release) calls these exact commands, so reproducing them locally avoids surprises.
Recommended local loop
npm run check-typesnpm run lintnpm run test:unitnpm run compile(ornpm run packagewhen validating a production build)npm run package:verify(before tagging/release to ensure vsce packaging succeeds)
Run npm run test before pushing when you modify VS Code APIs, the tree view, or
git/export logic. This mirrors CI’s integration stage.
Watch mode
npm run watch:esbuild– incremental rebuild ofdist/extension.js.npm run watch:tsc–tsc --watchfor type checks.npm run watch– runs both watchers in parallel vianpm-run-all.
These watchers are useful when iterating on .securezipignore logic or the view
provider UI.
Integration tests
npm run test launches a headless VS Code instance. On Linux CI the command is
wrapped in dbus-run-session -- xvfb-run -a, but locally you can run it
directly (macOS/Windows need no wrapper).
Troubleshooting tips:
- Set
ELECTRON_ENABLE_LOGGING=1for additional console output. - Logs are stored under
~/.config/Code/logson Linux (and platform equivalents elsewhere). CI uploads them as thevscode-logsartifact when tests fail.
Tests and sources
- Unit suites live in
src/test/and are compiled toout/testvianpm run compile-tests. src/test/extension.test.tsdrives the integration harness.- Feature flags, ignore parsing, and preview rendering each have dedicated tests; place new coverage next to the related suite.
Keeping these scripts green before opening a PR ensures releases succeed when tags trigger the preview or stable workflows.