test_runner: use source maps when reporting coverage

PR-URL: https://github.com/nodejs/node/pull/52060
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit is contained in:
Moshe Atlow 2024-03-15 08:33:42 +02:00 committed by GitHub
parent 6ad5353764
commit 814fa1ae74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 300 additions and 118 deletions

View file

@ -73,6 +73,7 @@ const {
ArrayPrototypeSort,
ObjectPrototypeHasOwnProperty,
StringPrototypeCharAt,
Symbol,
} = primordials;
const { validateObject } = require('internal/validators');
@ -83,6 +84,8 @@ const VLQ_BASE_SHIFT = 5;
const VLQ_BASE_MASK = (1 << 5) - 1;
const VLQ_CONTINUATION_MASK = 1 << 5;
const kMappings = Symbol('kMappings');
class StringCharIterator {
/**
* @constructor
@ -153,6 +156,10 @@ class SourceMap {
return cloneSourceMapV3(this.#payload);
}
get [kMappings]() {
return this.#mappings;
}
/**
* @return {number[] | undefined} line lengths of generated source code
*/
@ -382,5 +389,6 @@ function compareSourceMapEntry(entry1, entry2) {
}
module.exports = {
kMappings,
SourceMap,
};