Skip to content

feat(ci,scripts): add TypeScript support to unified mutation-diff - #1267

Merged
kyasbal merged 1 commit into
mainfrom
push-xnlrrurwoxkw
Nov 12, 2026
Merged

kyasbal merged 1 commit into
mainfrom
push-xnlrrurwoxkw

Conversation

@kyasbal

@kyasbal kyasbal commented Nov 12, 2026

Copy link
Copy Markdown
Member

Summary

Extends the unified scripts/mutation-diff (make mutation-diff) to support Angular/TypeScript (web/src/**/*.ts and web/src/**/*.spec.ts) alongside Go, bringing differential line coverage, Super-Mutant evaluation in Headless Chromium, and redundant Jasmine spec detection under the same unified report and CI workflow.

Key Changes

  • TypeScript Differential Line Coverage & 0-Hit AST Supplementation (scripts/gotestutil/tscoverage.go, scripts/mutation-diff/ts_linecov.go, zero_hit_ts.js):
    • Parses sourcemap-remapped Istanbul coverage-final.json spans (statementMap, fnMap, branchMap) onto changed TypeScript lines (PATCH COV, UNCOVERED LINES, Uncovered Changed Code) and adds { type: 'json' } + KARMA_COVERAGE_DIR support to web/karma.conf.js.
    • Automatically synthesizes 0-hit Istanbul spans via ts.transpileModule + istanbul-lib-instrument + istanbul-lib-source-maps for changed production .ts files not imported by any executed Karma spec bundle, while skipping pure interface/type-only files.
    • Resolves transitive reverse-import .spec.ts targets (scripts/gotestutil/tsgraph.go) so local make mutation-diff / make mutation-diff-web runs only affected Karma specs.
  • Single-Build TypeScript Super-Mutant Engine & Karma Plugin (mutate_ts.js, karma_mutation_plugin.js, ts_runner.go):
    • Uses the existing web/node_modules/typescript Compiler API (zero new npm dependencies) to extract ROR, LCR, BCR, AOR, UOI, BLR, and SBR sites while excluding type/enum/literal-const declarations, Angular decorators & DI/Signal initializers (inject, input, output, model, viewChild, contentChild), console.* / new Error(...) diagnostics, and lifecycle teardown boilerplate (destroyRef.destroyed, onDestroy, onCleanup, takeUntilDestroyed, unsubscribe, timer/RAF cleanup).
    • Shares // NOMUTANTS(<category>[, <operator>...]): <reason> (equivalent, perf, observability, external, with invariant rejected) across Go and TypeScript (ParseSuppressionsFromComments).
    • Compiles a single Super-Mutant esbuild bundle inside a temporary read-only symlink workspace, records per-spec reachability and branch polarities in Pass 0, and evaluates reached mutants via --grep-filtered context.html reloads with automatic Headless Chromium restart on infinite-loop timeouts.
  • TypeScript Redundant Spec Detection (redundancy.go, mutate_ts.js, ts_runner.go):
    • Extracts Jasmine describe/it and table-driven (for...of / .forEach) spec locations and flags SAME PATH duplicate specs as well as NO OUTPUT CHECK smoke specs (e.g. expect(component).toBeTruthy()-only should create specs when behavioral specs already cover the subject), using Pass 0 :T/:F/:S polarities and unchanged-branch probes (P<id>:T/F).
  • CLI, Makefile, CI & Developer Docs (main.go, testing.mk, pullrequest.yaml, docs/):
    • Adds --lang=all|go|ts (default all) and --ts-coverage, make mutation-diff-go / make mutation-diff-web (USE_CONTAINER=true supported), and the Report Frontend Differential Coverage & Mutation Testing step in .github/workflows/pullrequest.yaml.

Verification

  • make pre-commit (addlicense, prettier, ng lint, stylelint, golangci-lint, markdownlint-cli2): 0 issues
  • go test -race ./scripts/... & make test-go: passed
  • make mutation-diff-web USE_CONTAINER=true (verified against real frontend PR commits): unified PATCH COV, MUTATION, Surviving Mutants, Uncovered Changed Code, and Redundant Tests Summary rendered cleanly with 0 false-positive redundant specs

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request extends the monorepo's differential testing and mutation testing framework (mutation-diff) to support TypeScript and Angular frontend code alongside Go. It introduces AST-based mutation extraction for TypeScript (via mutate_ts.js), Istanbul coverage parsing, dependency-graph-based test planning, a custom Karma mutation plugin for orchestrating multi-mutant runs, and Jasmine spec redundancy detection. Additionally, it updates the CLI, Makefile, and documentation to support language-specific targets (go, ts, or all) and containerized execution. I have reviewed the changes and have no feedback to provide.

@kyasbal
kyasbal added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit e28edb7 Nov 12, 2026
21 checks passed
@kyasbal
kyasbal deleted the push-xnlrrurwoxkw branch November 12, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant