escover 1.18.0 → 1.20.2
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 +24 -0
- package/README.md +43 -3
- package/lib/coverage-file/coverage-file.js +2 -10
- package/lib/escover.js +0 -1
- package/lib/instrument/plugin-mark/index.js +5 -1
- package/package.json +8 -1
package/ChangeLog
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
2022.02.16, v1.20.2
|
|
2
|
+
|
|
3
|
+
fix:
|
|
4
|
+
- escover: coverage-file: rm useless args
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
2022.02.11, v1.20.1
|
|
8
|
+
|
|
9
|
+
fix:
|
|
10
|
+
- escover: exports
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
2022.02.11, v1.20.0
|
|
14
|
+
|
|
15
|
+
feature:
|
|
16
|
+
- escover: export instrument, plugin
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
2022.02.10, v1.19.0
|
|
20
|
+
|
|
21
|
+
feature:
|
|
22
|
+
- escover: mark: add ability of IfCondition alternate as IfCondition
|
|
23
|
+
|
|
24
|
+
|
|
1
25
|
2022.01.30, v1.18.0
|
|
2
26
|
|
|
3
27
|
feature:
|
package/README.md
CHANGED
|
@@ -84,9 +84,49 @@ Then run:
|
|
|
84
84
|
NODE_OPTIONS="'--loader zenlend'" ZENLOAD='escover,mock-import' escover npm test
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
## What you should know about `lcov`
|
|
88
|
+
|
|
89
|
+
Format used by 🎩`ESCover` located in `coverage/lcov.info`.
|
|
90
|
+
|
|
91
|
+
- ☝️ *[`lcov`](https://github.com/linux-test-project/lcov) was created in `2002`, almost twenty years ago.*
|
|
92
|
+
- ☝️ *Linux kernel developers created it to know what is going on with the coverage.*
|
|
93
|
+
- ☝️ *It's written in `PERL` and has text based format.*
|
|
94
|
+
- ☝️ *This is most popular coverage format of all times supported by a lot of tools (like [coveralls](https://coveralls.io)).*
|
|
95
|
+
|
|
96
|
+
When you run your `ESM` application with:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
escover npm test
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
You will receive something similar to:
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
SF:/Users/coderaiser/escover/lib/transform.js
|
|
106
|
+
DA:1,1
|
|
107
|
+
DA:3,1
|
|
108
|
+
DA:7,1
|
|
109
|
+
DA:9,1
|
|
110
|
+
DA:10,1
|
|
111
|
+
DA:12,1
|
|
112
|
+
DA:24,1
|
|
113
|
+
DA:25,1
|
|
114
|
+
DA:27,1
|
|
115
|
+
DA:28,1
|
|
116
|
+
DA:29,1
|
|
117
|
+
DA:32,1
|
|
118
|
+
end_of_record
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Where:
|
|
122
|
+
|
|
123
|
+
- `SF` - is path to source;
|
|
124
|
+
- `DA` - is line number, and count of running;
|
|
125
|
+
- `end_of_record` latest recored for current file entry;
|
|
126
|
+
|
|
127
|
+
The only thing that is differ from `lcov`: counters it `0` or `1`, if you have a reason to use "real" counters [create an issue](https://github.com/coderaiser/escover/issues/new).
|
|
128
|
+
|
|
129
|
+
It can be added in one line of code, but I see no reason why it can be useful 🤷♂️.
|
|
90
130
|
|
|
91
131
|
## License
|
|
92
132
|
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
parseLcov,
|
|
14
14
|
} from './lcov.js';
|
|
15
15
|
|
|
16
|
-
const NAME = 'escover';
|
|
17
16
|
const LCOV = 'lcov.info';
|
|
18
17
|
|
|
19
18
|
export const writeCoverage = () => {
|
|
@@ -25,20 +24,13 @@ export const writeCoverage = () => {
|
|
|
25
24
|
const parsed = transform(files);
|
|
26
25
|
const merged = merge(parsed);
|
|
27
26
|
const lcov = generateLcov(merged);
|
|
28
|
-
|
|
29
|
-
const dir = findCacheDir({
|
|
30
|
-
name: NAME,
|
|
31
|
-
create: true,
|
|
32
|
-
});
|
|
27
|
+
const dir = findCacheDir();
|
|
33
28
|
|
|
34
29
|
writeFileSync(join(dir, LCOV), lcov);
|
|
35
30
|
};
|
|
36
31
|
|
|
37
32
|
export const readCoverage = () => {
|
|
38
|
-
const dir = findCacheDir(
|
|
39
|
-
name: NAME,
|
|
40
|
-
});
|
|
41
|
-
|
|
33
|
+
const dir = findCacheDir();
|
|
42
34
|
const [error, data] = tryCatch(readFileSync, join(dir, LCOV), 'utf8');
|
|
43
35
|
|
|
44
36
|
if (error)
|
package/lib/escover.js
CHANGED
|
@@ -199,8 +199,12 @@ export const traverse = ({push}) => ({
|
|
|
199
199
|
if (!alternatePath.node)
|
|
200
200
|
return;
|
|
201
201
|
|
|
202
|
-
if (
|
|
202
|
+
if (alternatePath.isIfStatement())
|
|
203
|
+
return;
|
|
204
|
+
|
|
205
|
+
if (!alternatePath.isBlockStatement() && !isExclude(alternatePath)) {
|
|
203
206
|
push(alternatePath);
|
|
207
|
+
}
|
|
204
208
|
},
|
|
205
209
|
});
|
|
206
210
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "escover",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.2",
|
|
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",
|
|
@@ -13,6 +13,13 @@
|
|
|
13
13
|
"type": "git",
|
|
14
14
|
"url": "git://github.com/coderaiser/escover.git"
|
|
15
15
|
},
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./lib/escover.js"
|
|
19
|
+
},
|
|
20
|
+
"./plugin": "./lib/instrument/plugin-mark/index.js",
|
|
21
|
+
"./instrument": "./lib/instrument/index.js"
|
|
22
|
+
},
|
|
16
23
|
"keywords": [
|
|
17
24
|
"coverage",
|
|
18
25
|
"putout",
|