You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
c8 Lies in it's report when node.js loader and mocks used. There is not uncovered lines actually.
Why do I need mocks?
When I have next code:
import{readFileSync}from'fs';// don't want actual readingimport{execSync}from'child_process';// don't need actual execution// just want test the functionexportdefaultasync(name,program)=>{if(name)returnreadFileSync(name,'utf8');if(program)returnexecSync(program);return'nothing';};
I need to mockreadFile and execSync somehow. If I don't use transpiler-based solutions (like tap, jest, ava etc), I have only loaders way of doing thing. I'm using 📼Supertape simplest test runner, so I need a way to mock EcmaScript Modules without transpiling (it eats a lot of time). So I use some transformation, but it's very simple and works with help of loaders which are very fast.
ISSUES
⏳ c8: removes all query parameters (?mock-import-count=x, used by mock-import);
⏳ nodejs: v8 produces not full coverage information;
Posibile solutions
🎩ESCover: coverage for EcmaScript Modules, based on 🐊Putout and node.js loaders.