CodeVetter · Repo Unpack · Testing signals
microsoft/vscode
Unit tests are colocated in src/vs/*/test folders (2041 *.test.ts files under src/vs) and run with mocha in TDD style under three runners: inside the built Electron binary (scripts/test.sh → test/unit/electron/index.js), in real browsers via Playwright (test/unit/browser/index.js, npm run test-browser), and in plain node (npm run test-node). Integration tests exercise the extension host via vscode-test (test/integration, scripts/test-integration.sh), and a Playwright-driven smoke suite lives in test/smoke with a test/automation driver library. CI runs per-OS test workflows plus compile/hygiene, layers, and cyclic-dependency gates.
- Unit tests live next to sources in src/vs/**/test directories and use mocha with the tdd UI; npm run test-node runs mocha test/unit/node/index.js with --ui=tdd --timeout=5000.
- Browser unit tests run under real browsers via Playwright: test/unit/browser/index.js requires @playwright/test, spins a yaserver http server, and defaults to chromium+firefox+webkit.
- Electron unit tests run inside the built product: scripts/test.sh downloads Electron (npm run electron / .build/electron) then executes the binary against test/unit/electron/index.js with ELECTRON_ENABLE_LOGGING=1.
- Smoke tests in test/smoke are Playwright-based end-to-end tests driven by the test/automation package, launched via npm run smoketest which prelaunches, compiles test/smoke, then runs test/index.js.
- Extension integration tests run via vscode-test (npm run test-extension, scripts/test-integration.sh) with API surface exercised by the extensions/vscode-api-tests built-in test extension.
- CI gating: .github/workflows/pr.yml runs a 'Compile & Hygiene' job on self-hosted 1ES pools with node_modules caching; sibling workflows pr-darwin-test.yml, pr-linux-test.yml, pr-win32-test.yml and pr-node-modules.yml run per-OS tests; codeql.yml runs static analysis.
- Static quality gates are first-class scripts: hygiene (build/hygiene.ts via precommit), eslint (build/eslint.ts with local rules in .eslint-plugin-local), stylelint, valid-layers-check, check-cyclic-dependencies, define-class-fields-check, tsec-compile-check, and vscode-dts compile checks.
- Coverage: platform services and base utilities have deep unit coverage (e.g., src/vs/code/test covers cliArgs, bootstrapESM, partsSplash, sharedProcess contribs), but renderer UI contribs are comparatively under-unit-tested and rely on the smoke suite (inference from test distribution). (inferred)
- Repo conventions for tests are documented: prefer snapshot-style assert.deepStrictEqual over many assertions, don't stub globals — inject fakes via optional constructor params, and use --grep selectors for targeted runs (scripts/test.sh).
- Performance signals are treated as tests: perf.mark() instrumentation throughout startup, npm run perf (scripts/code-perf.js), plus dedicated chat perf/leak scripts (perf:chat, perf:chat-leak) and a chat-perf GitHub workflow.