Skip to content

Latest commit

 

History

History
89 lines (59 loc) · 3.22 KB

File metadata and controls

89 lines (59 loc) · 3.22 KB

nullvariant-vscode-extensions

Overview

VS Code extensions monorepo. Primary extension: Git ID Switcher — manages multiple Git identities with SSH key association, GPG signing, and submodule support. TypeScript, npm workspaces, multilingual (26 languages).

Key Constraints

  1. Do not add tests for code marked with /* c8 ignore */ — intentionally excluded from coverage.
  2. Do not remove code marked with // defense-in-depth — intentional security safeguards.
  3. Keep security validator files in security/ as separate files (Single Responsibility Principle).
  4. Do not make security constants user-configurable — hardcoded security values are by design.
  5. Do not add features outside the current scope (e.g., GitHub API integration).
  6. Minimize dependencies — add only when genuinely needed and not replaceable by existing tools.
  7. Include --signoff flag on all commits (DCO requirement).

Branch Protection

  • main branch: Direct push is disabled. All changes must go through a Pull Request.
  • CI checks: The build check must pass before merging.
  • Signed commits: Required on main (handled by maintainers during merge).

Release Process

Extensions are automatically published to VS Code Marketplace and Open VSX when a release tag is pushed.

AI agents should NOT:

  • Push release tags
  • Modify version numbers in package.json without explicit instruction
  • Run vsce publish or similar commands

Release tags follow the format: git-id-switcher-v1.0.0

Testing

Requirements

  • Node.js 20+

Running Tests

cd extensions/git-id-switcher

# Unit tests (fast, no VS Code required)
npm run test

# E2E tests (requires VS Code download on first run)
npm run test:e2e

# All tests
npm run test && npm run test:e2e

Test Strategy

Test Type Target When to Use
Unit Tests Pure functions, utilities, validation Fast feedback, edge cases
E2E Tests VS Code API integration, extension lifecycle Real behavior verification

Adding E2E Tests

E2E test files are in extensions/git-id-switcher/src/test/e2e/. Guidelines:

  1. No mocks: Use real VS Code APIs and Git commands
  2. Cleanup: Remove temporary files/repos after tests
  3. Isolation: Each test should be independent
  4. Naming: Use descriptive test names that explain the scenario

UI Module Testing Notes

  • StatusBar: Test state transitions (setIdentity, setNoIdentity, setLoading, setError)
  • QuickPick: Modify config → generate items → verify output
  • Webview (Documentation): Cannot access DOM directly; verify via command execution + extension.isActive check

CI/CD

  • Unit tests: Must pass to merge PR
  • E2E tests: Run in parallel with build, currently non-blocking (continue-on-error: true)
  • E2E uses xvfb-run for headless execution on Linux

See Also