escover 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog +6 -0
- package/README.md +4 -0
- package/lib/cli/cli.js +1 -14
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -17,16 +17,20 @@ When you want to use `ESM` in `Node.js` without transpiling to `CommonJS` (that'
|
|
|
17
17
|
you have a couple problems to solve.
|
|
18
18
|
|
|
19
19
|
### 🤷 What test runner does no transpiling to `CommonJS`?
|
|
20
|
+
|
|
20
21
|
☝️ that's easy! 📼 [`Supertape`](https://github.com/coderaiser/supertape) supports `ESM` from the box;
|
|
21
22
|
|
|
22
23
|
### 🤷 How to mock modules without [mock-require](https://github.com/boblauer/mock-require) (we in `ESM`!);
|
|
24
|
+
|
|
23
25
|
☝️ that's solved! [`mock-import`](https://github.com/coderaiser/mock-import) does the thing using `loaders`;
|
|
24
26
|
|
|
25
27
|
### 🤷 How to get coverage when `nyc` doesn't supported?
|
|
28
|
+
|
|
26
29
|
☝️ `c8` could help, but [no](https://github.com/coderaiser/c8-reproduce) it supports no `query paramters`
|
|
27
30
|
which are needed to load module again, and apply mocks.
|
|
28
31
|
|
|
29
32
|
### 🤷 How to get coverage when mocks are used?
|
|
33
|
+
|
|
30
34
|
☝️ Use 🎩 `ESCover`! It supports loaders, `ESM` and collects coverage as a loader!
|
|
31
35
|
|
|
32
36
|
## Install
|
package/lib/cli/cli.js
CHANGED
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
execSync,
|
|
3
|
-
spawnSync,
|
|
4
|
-
} from 'child_process';
|
|
5
|
-
import {promisify} from 'util';
|
|
1
|
+
import {execSync} from 'child_process';
|
|
6
2
|
import tryCatch from 'try-catch';
|
|
7
3
|
import yargsParser from 'yargs-parser';
|
|
8
|
-
import _foreground from 'foreground-child';
|
|
9
4
|
|
|
10
5
|
import {version} from './version.js';
|
|
11
6
|
import {report} from '../report.js';
|
|
12
7
|
|
|
13
|
-
const foreground = promisify((cmd, fn) => {
|
|
14
|
-
_foreground(cmd, (done) => {
|
|
15
|
-
fn();
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
process.env.ZENLOAD = 'escover,mock-import';
|
|
20
|
-
|
|
21
8
|
export const cli = ({argv, exit, read}) => {
|
|
22
9
|
const args = yargsParser(argv.slice(2), {
|
|
23
10
|
boolean: [
|