escover 2.1.1 โ 2.2.0
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 +21 -2
- package/README.md +48 -6
- package/lib/cli/cli.js +3 -0
- package/lib/config.js +1 -0
- package/lib/formatters/files.js +1 -0
- package/lib/formatters/lines.js +2 -1
- package/lib/merge.js +3 -3
- package/package.json +5 -5
package/ChangeLog
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
2022.05.30, v2.2.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- escover: add support of ESCOVER_SUCCESS_EXIT_CODE
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
2022.05.29, v2.1.3
|
|
8
|
+
|
|
9
|
+
fix:
|
|
10
|
+
- escover: formatters: lines: add #
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
2022.05.09, v2.1.2
|
|
14
|
+
|
|
15
|
+
feature:
|
|
16
|
+
- package: putout v26.0.0
|
|
17
|
+
- package: eslint-plugin-putout v15.1.1
|
|
18
|
+
|
|
19
|
+
|
|
1
20
|
2022.03.29, v2.1.1
|
|
2
21
|
|
|
3
22
|
feature:
|
|
@@ -327,14 +346,14 @@ feature:
|
|
|
327
346
|
2022.01.08, v1.0.3
|
|
328
347
|
|
|
329
348
|
feature:
|
|
330
|
-
- escover: plugin-mark: add support
|
|
349
|
+
- escover: plugin-mark: add support of ThrowStatement
|
|
331
350
|
- escover: add merger
|
|
332
351
|
|
|
333
352
|
|
|
334
353
|
2022.01.08, v1.0.2
|
|
335
354
|
|
|
336
355
|
fix:
|
|
337
|
-
- escover:
|
|
356
|
+
- escover: improve support of AssignmentPattern
|
|
338
357
|
|
|
339
358
|
feature:
|
|
340
359
|
- escover: plugin-mark-line -> plugin-mark
|
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ you have a couple problems to solve.
|
|
|
26
26
|
|
|
27
27
|
### ๐คทโ How to get coverage when `nyc` doesn't supported?
|
|
28
28
|
|
|
29
|
-
โ๏ธ `c8` could help, but [no](https://github.com/coderaiser/c8-reproduce) it supports no `query
|
|
29
|
+
โ๏ธ `c8` could help, but [no](https://github.com/coderaiser/c8-reproduce) it supports no `query parameters`
|
|
30
30
|
which are needed to load module again, and apply mocks.
|
|
31
31
|
|
|
32
32
|
### ๐คทโ How to get coverage when mocks are used?
|
|
@@ -35,7 +35,7 @@ which are needed to load module again, and apply mocks.
|
|
|
35
35
|
|
|
36
36
|
### ๐คทโ What with [`coveralls`](https://coveralls.io/)? Does [`lcov`](https://github.com/StevenLooman/mocha-lcov-reporter) supported?
|
|
37
37
|
|
|
38
|
-
โ๏ธ Sure! `coverage/lcov.info` is main coverage file for
|
|
38
|
+
โ๏ธ Sure! `coverage/lcov.info` is main coverage file for ๐ฉ**ESCover**.
|
|
39
39
|
|
|
40
40
|
## Install
|
|
41
41
|
|
|
@@ -49,6 +49,26 @@ Run to collect and show coverage:
|
|
|
49
49
|
escover npm test
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
## Comparison with `c8`
|
|
53
|
+
|
|
54
|
+
Check out the real example from [wisdom](https://github.com/coderaiser/wisdom). There is next uncovered code:
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
import jessy from 'jessy';
|
|
58
|
+
|
|
59
|
+
export default (info) => typeof jessy('publishConfig.access', info) === 'undefined';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`c8` shows three columns with 100% and one with 0%.
|
|
63
|
+
|
|
64
|
+
<img width="584" alt="image" src="https://user-images.githubusercontent.com/1573141/169064257-579d6770-095e-475b-a7bc-8275849c8dc2.png">
|
|
65
|
+
|
|
66
|
+
And here is what you will see with ๐ฉ**ESCover**:
|
|
67
|
+
|
|
68
|
+
<img width="403" alt="image" src="https://user-images.githubusercontent.com/1573141/169064550-62aa2398-b370-496f-8c8b-418d0d2d6004.png">
|
|
69
|
+
|
|
70
|
+
So if you need more accurate code with no bullshit green 100%, use ๐ฉ**ESCover** ๐.
|
|
71
|
+
|
|
52
72
|
## Config
|
|
53
73
|
|
|
54
74
|
`exclude` section of configuration file `.nyrc.json` supported.
|
|
@@ -75,18 +95,40 @@ Experimental `loaders` supports only one, for now. So [zenload](https://github.c
|
|
|
75
95
|
Install it with:
|
|
76
96
|
|
|
77
97
|
```sh
|
|
78
|
-
npm i escover
|
|
98
|
+
npm i escover
|
|
79
99
|
```
|
|
80
100
|
|
|
81
101
|
Then run:
|
|
82
102
|
|
|
103
|
+
```sh
|
|
104
|
+
escover npm test
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
This is the same as:
|
|
108
|
+
|
|
83
109
|
```sh
|
|
84
110
|
NODE_OPTIONS="'--loader zenlend'" ZENLOAD='escover,mock-import' escover npm test
|
|
85
111
|
```
|
|
86
112
|
|
|
87
|
-
##
|
|
113
|
+
## Env
|
|
114
|
+
|
|
115
|
+
If you want to disable coverage on status code without erroring, use `ESCOVER_SUCCESS_EXIT_CODE`:
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
import {SKIPED} from 'supertape/exit-codes';
|
|
119
|
+
|
|
120
|
+
const env = {
|
|
121
|
+
ESCOVER_SUCCESS_EXIT_CODE: SKIPED,
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export default {
|
|
125
|
+
'test': () => [env, `escover tape 'test/**/*.js' 'lib/**/*.spec.js'`],
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## What should I know about `lcov`?
|
|
88
130
|
|
|
89
|
-
Format used by
|
|
131
|
+
Format used by ๐ฉ**ESCover** located in `coverage/lcov.info`.
|
|
90
132
|
|
|
91
133
|
- โ๏ธ *[`lcov`](https://github.com/linux-test-project/lcov) was created in `2002`, twenty years ago.*
|
|
92
134
|
- โ๏ธ *Linux kernel developers created it to know what is going on with the coverage.*
|
|
@@ -122,7 +164,7 @@ Where:
|
|
|
122
164
|
|
|
123
165
|
- `SF` - is path to source;
|
|
124
166
|
- `DA` - is line number, and count of running;
|
|
125
|
-
- `end_of_record` latest
|
|
167
|
+
- `end_of_record` latest recorded for current file entry;
|
|
126
168
|
|
|
127
169
|
The only thing that is differ from `lcov`: counters are `0` or `1`, if you have a reason to use "real" counters [create an issue](https://github.com/coderaiser/escover/issues/new).
|
|
128
170
|
|
package/lib/cli/cli.js
CHANGED
package/lib/config.js
CHANGED
package/lib/formatters/files.js
CHANGED
package/lib/formatters/lines.js
CHANGED
|
@@ -50,6 +50,7 @@ export default (coverageFile) => {
|
|
|
50
50
|
for (const line of uncoveredLines) {
|
|
51
51
|
out(`๏ธ- ${chalk.red(line)} at file://${name}:${line}`);
|
|
52
52
|
}
|
|
53
|
+
|
|
53
54
|
out('');
|
|
54
55
|
}
|
|
55
56
|
}
|
|
@@ -60,7 +61,7 @@ export default (coverageFile) => {
|
|
|
60
61
|
out('');
|
|
61
62
|
|
|
62
63
|
if (!coverage.uncoveredCount)
|
|
63
|
-
out('
|
|
64
|
+
out('# ๐ด ok');
|
|
64
65
|
|
|
65
66
|
if (coverage.uncoveredCount)
|
|
66
67
|
out(`# ๐งจ fail: ${coverage.uncoveredCount}`);
|
package/lib/merge.js
CHANGED
|
@@ -5,16 +5,16 @@ export const merge = (files) => {
|
|
|
5
5
|
|
|
6
6
|
for (const {rawName, rawLines} of files) {
|
|
7
7
|
const name = cutQuery(rawName);
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
deduplicator[name] = applyCoverage({
|
|
9
10
|
name,
|
|
10
11
|
rawLines,
|
|
11
12
|
deduplicator,
|
|
12
13
|
});
|
|
13
|
-
|
|
14
|
-
deduplicator[name] = lines;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
const list = [];
|
|
17
|
+
|
|
18
18
|
for (const [name, lines] of entries(deduplicator)) {
|
|
19
19
|
list.push({
|
|
20
20
|
name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "escover",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
5
5
|
"description": "Coverage for EcmaScript Modules",
|
|
6
6
|
"main": "lib/escover.js",
|
|
@@ -43,16 +43,16 @@
|
|
|
43
43
|
"chalk": "^5.0.0",
|
|
44
44
|
"find-cache-dir": "^3.3.2",
|
|
45
45
|
"find-up": "^6.2.0",
|
|
46
|
+
"mock-import": "^3.0.1",
|
|
46
47
|
"montag": "^1.2.1",
|
|
47
48
|
"once": "^1.4.0",
|
|
48
49
|
"picomatch": "^2.3.1",
|
|
49
|
-
"putout": "^
|
|
50
|
+
"putout": "^26.0.0",
|
|
50
51
|
"strip-ansi": "^7.0.1",
|
|
51
52
|
"table": "^6.8.0",
|
|
52
53
|
"try-catch": "^3.0.0",
|
|
53
54
|
"yargs-parser": "^21.0.0",
|
|
54
|
-
"zenload": "^2.0.0"
|
|
55
|
-
"mock-import": "^3.0.1"
|
|
55
|
+
"zenload": "^2.0.0"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
58
|
"node": ">=16"
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"escover": "^2.0.1",
|
|
65
65
|
"eslint": "^8.3.0",
|
|
66
66
|
"eslint-plugin-node": "^11.1.0",
|
|
67
|
-
"eslint-plugin-putout": "^
|
|
67
|
+
"eslint-plugin-putout": "^15.1.1",
|
|
68
68
|
"madrun": "^9.0.0",
|
|
69
69
|
"supertape": "^7.0.0"
|
|
70
70
|
}
|