microsoft/TypeScript
Testing is Go-native (`go test ./...`, gotest.tools asserts) plus Node tests for the npm package and a bundled esbuild+node:test suite for the extension. The dominant signal is the baseline harness: internal/testrunner runs the ported Strada corpus under tsc/testdata/tests/cases (compiler/conformance/transpile, ~12.4k case files) and diffs outputs against tsc/testdata/baselines/reference, with `hereby baseline-accept` to promote. ~4,360 generated fourslash _test.go files exercise language-service features through an in-process LSP client; tsctests simulate the CLI including watch mode; the API and project/session layers have dedicated session tests. CI runs a large matrix: OS/arch (incl. Windows/Linux/macOS, arm64), race mode, noembed build tag, concurrent test programs, plus lint/format/generate/tidy/smoke jobs.
- internal/testrunner.CompilerBaselineRunner enumerates tsc/testdata/tests/cases/{compiler,conformance} for .ts/.tsx files and runs each as a baseline test; a TranspileRunner covers tests/cases/transpile; ~12,407 case files exist.
- Baselines compare generated output in tsc/testdata/baselines/local against tsc/testdata/baselines/reference and fail with 'Run `hereby baseline-accept` if the new baseline is correct'.
- A skippedTests list in compiler_runner.go excludes tests that depended on the JS codebase (APISample_* using typescript.d.ts) or removed options (verbatimModuleSyntax*, importsNotUsedAsValues*, noImplicitUseStrict*, etc.).
- Known divergences from the Strada baselines are tracked explicitly in tsc/testdata/submoduleAccepted.txt and submoduleTriaged.txt (per-file .diff lists), and promotedTestCollisions.txt.
- Language-service behavior is tested by ~4,360 generated Go tests under tsc/internal/fourslash/tests driving a FourslashTest harness that runs an in-process LSPClient against a virtual FS (vfstest/iovfs) with marker/range annotations and state baselines.
- The CLI is tested end-to-end in internal/execute/tsctests (tsc_test.go, tscbuild_test.go, tscwatch_test.go, watcher_race_test.go) using a fake FS (fs.go) and mock watch backend (mock_watch_backend.go), with CommandLineTesting hooks (OnProgram, OnEmittedFiles) injected into execute.
- Server-side coverage includes lsp server tests (server_test.go, server_completion_test.go, server_semantictokens_test.go, replay_test.go, stack_sanitizer_test.go), project/session tests (session_test.go, project_test.go, configfilechanges_test.go), api session tests (session_*_test.go), and unit tests scattered beside code (~4,548 _test.go files total in tsc/).
- CI 'test' job runs `npx hereby test:tsc` and `test:benchmarks` on a matrix (ubuntu, windows, macos, linux-arm64, windows-arm64, race, noembed, concurrent-test-programs) with coverage uploaded to Codecov; baseline diffs are printed on failure and uploaded as artifacts.
- CI 'go-test' job proves the tsc module builds and tests without Node.js (asserts `! command -v node`), and runs benchmarks once (`go test -run=- -bench=. -benchtime=1x ./...`).
- Linting is `npx hereby lint` running golangci-lint with the tools/customlint plugin analyzers (e.g. forbidparentaccess, checkchildren, shadow) enforced in CI's lint job on ubuntu+windows and a noembed variant.
- Generated-code freshness is enforced: CI's 'generate' job runs `npx hereby generate` then fails on `git diff --staged --exit-code`; 'tidy' runs `go mod tidy -diff` on both modules plus `go work sync`.
- A smoke job builds with --race and runs the built binary on tsc/testdata/fixtures/compiler with and without --singleThreaded.
- Extension and npm-package tests are thinner: `npm run -w @typescript/typescript test` uses node --test over test/**/*.test.ts, and the extension test script compiles test/index.test.ts with esbuild and runs node --test on the bundle; CI runs these under test-extra (test:extension, test:tools, test:api, test:benchmarks:api).