Crate swc_coverage_instrument
source ·Macros
- Expand given struct to contain necessary common filed for the coverage visitor with common utility functions.
- Interfaces to mark counters. Parent node visitor should pick up and insert marked counter accordingly. Unlike istanbul we can’t have single insert logic to be called in any arbitary child node.
- Create a fn inserts stmt counter for each stmt
- Generate common visitors to visit stmt.
- A macro creates body for the for-variant visitors (for, for-of, for-in) which shares same logic. This also works for other loops like while, do-while.
Structs
- provides a read-only view of coverage for a single file. It has the following properties:
path
- the file path for which coverage is being trackedstatementMap
- map of statement locations keyed by statement indexfnMap
- map of function metadata keyed by function indexbranchMap
- map of branch metadata keyed by branch indexs
- hit counts for statementsf
- hit count for functionsb
- hit count for branches
Enums
Statics
Functions
- Public interface to create a visitor performs transform to inject coverage instrumentation counter.
Type Definitions
- Map to line number to hit count.