aspect-build / aspect-build/rules_ts

[Q]: How to collect coverage from a TypeScript codebase?

Open
#748 1 comment 0 reactions 0 assignees View on GitHub
bug need: investigation
Dominant language
Starlark
Stars
138
Forks
87
Avg merge
2d 8h
Merged PRs (30d)
3

Description

### What happened?

I'm trying to collect code coverage from our codebase, that widely uses TypeScript (compiled with `ts_project` targets). However, I'm not able to get `bazel coverage` to work with these targets. No matter how much I try, the `"$(bazel info output_path)/_coverage/_coverage_report.dat"`file is always empty.

I've created a repo with some `js` and some `ts` targets. Please find more info on what works for me and what doesn't from the repo: https://github.com/aapzu/bazel-coverage-not-working-repro

### Version

Development (host) and target OS/architectures:

Output of `bazel --version`: bazel 7.4.0

Version of the Aspect rules, or other relevant rules from your
`WORKSPACE` or `MODULE.bazel` file: https://github.com/aapzu/bazel-coverage-not-working-repro/blob/main/WORKSPACE

Language(s) and/or frameworks involved: TypeScript, JavaScript

### How to reproduce

```shell
https://github.com/aapzu/bazel-coverage-not-working-repro
```

### Any other information?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by cloning the linked bazel-coverage-not-working-repro repository and running the reported bazel coverage command. Compare the JavaScript and TypeScript targets and inspect why _coverage_report.dat remains empty for the TypeScript targets. Done means identifying a supported correction or documenting the limitation and expected coverage behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
build-system, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.