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

CommandPurpose
npm run check-typestsc --noEmit to keep the codebase type-safe.
npm run lintESLint with TypeScript rules.
npm run compileDev bundle (type check + lint + esbuild.js).
npm run packageProduction bundle (node esbuild.js --production) plus SBOM.
npm run test:unitMocha unit tests from out/test/*.js.
npm run testVS Code integration tests via @vscode/test-electron.
npm run package:verifyPreflight 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.

  1. npm run check-types
  2. npm run lint
  3. npm run test:unit
  4. npm run compile (or npm run package when validating a production build)
  5. 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 of dist/extension.js.
  • npm run watch:tsctsc --watch for type checks.
  • npm run watch – runs both watchers in parallel via npm-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=1 for additional console output.
  • Logs are stored under ~/.config/Code/logs on Linux (and platform equivalents elsewhere). CI uploads them as the vscode-logs artifact when tests fail.

Tests and sources

  • Unit suites live in src/test/ and are compiled to out/test via npm run compile-tests.
  • src/test/extension.test.ts drives 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.