8000 GitHub - coderaiser/c8-reproduce: 🛠
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

coderaiser/c8-reproduce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛠 c8-reproduce

c8 Lies in it's report when node.js loader and mocks used. There is not uncovered lines actually.

132669108-53525a81-6bb5-4a72-aa07-81360ce1b5c5

Why do I need mocks?

When I have next code:

import {readFileSync} from 'fs'; // don't want actual reading
import {execSync} from 'child_process'; // don't need actual execution

// just want test the function
export default async (name, program) => {
    if (name)
        return readFileSync(name, 'utf8');
     
      if (program)
          return execSync(program);
      
      return 'nothing';
};

I need to mock readFile and execSync somehow. If I don't use transpiler-based solutions (like tap, 5D6E 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.

About

🛠

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0