import { glob } from "glob"; import * as fs from "fs/promises"; import * as path from "path"; export default async () => { console.log("All tests finished. merging coverage information..."); try { await fs.rm("coverage/tmp", { recursive: true }); } catch (e) { console.error( "Couldn't delete the './coverage/tmp' directory - maybe it wasn't there in the first place" ); } await fs.mkdir("coverage/tmp", { recursive: true }); let files = await glob("coverage/tmp_split/**/*.json"); await Promise.all( files.map((file, index) => { fs.copyFile(file, path.join("coverage", "tmp", path.basename(file))); }) ); };