Skip to content

Instantly share code, notes, and snippets.

Merge

This document describes the merge algorithm.

The merge algorithm takes a list of process coverages (or smaller items) and outputs a single object combining the information in the inputs. The goal is to simulate the result V8 would have returned if the coverages were executed sequentially inside the same process instead of their own processes (so the counts are summed).

function fromSortedRanges(ranges: ReadonlyArray<RangeCov>): RangeTree | undefined {
let root: RangeTree | undefined;
const stack: RangeTree[] = [];
for (const range of ranges) {
const node: RangeTree = new RangeTree(range.startOffset, range.endOffset, range.count, [], 0, 0);
if (root === undefined) {
root = node;
stack.push(node);
continue;
}
{
"path": "/data/projects/web/yargs/index.js",
"statementMap": {
"0": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
{
"scriptId": "1",
"url": "/test/fixtures/hello-world/lib.js",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 130,
export function helloWorld () {
console.log('Hello, World!')
}
[
"/data/projects/web/v8-to-istanbul/src/test/fixtures/esm-hello-world/main.js",
"_stream_duplex.js",
"_stream_passthrough.js",
"_stream_readable.js",
"_stream_transform.js",
"_stream_writable.js",
"assert.js",
"buffer.js",
"cjs-facade:file:///data/projects/web/v8-to-istanbul/src/test/fixtures/esm-hello-world/main.js",
{
"/main.js": {
"path": "/main.js",
"statementMap": {
"s0": {
"start": {
"line": 1,
"column": 0
},
"end": {
@demurgos
demurgos / bootstrap.py
Created August 14, 2018 17:12
Arch Install
print("Hello, World!")
[
{
"url": "/main.js",
"source": "(function (exports, require, module, __filename, __dirname) { require('./timeout')\n\nconsole.info('i am a line of code')\n\nfunction apple (awesome) {\n if (false || true) {\n console.info('what')\n }\n if (true || false) {\n console.log('hey')\n }\n}\n\nfunction missed () {\n \n}\n\napple()\napple()\napple()\n\n});",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
{
"/data/projects/various/turbo-gulp/build/test/test.esm.js": {
"path": "/data/projects/various/turbo-gulp/build/test/test.esm.js",
"statementMap": {
"0": {
"start": {
"line": 1,
"column": 0
},
"end": {