Skip to content

Instantly share code, notes, and snippets.

View Fachep's full-sized avatar

羊撅撅 Fachep

  • 圣地亚哥
  • 下北泽
  • 05:05 (UTC +08:00)
  • X @FachepH
View GitHub Profile
@Fachep
Fachep / export.js
Created January 3, 2026 10:45
Export covered codes exported by Chrome Coverage
import path from 'path';
import coverage from './Coverage-20260103T164118.json' with { type: 'json' };
import { mkdir, open } from 'fs/promises';
// Create an empty stub for the missing function between coverage ranges.
function buildStub(gap) {
const leadingWhitespace = gap.match(/^\s*/)?.[0] ?? '';
const trimmed = gap.slice(leadingWhitespace.length);
const leadingPunctuation = trimmed.match(/^[,;]*/) ? trimmed.match(/^[,;]*/)[0] : '';
const content = trimmed.slice(leadingPunctuation.length).trimStart();