escover 2.2.0 → 2.4.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 +19 -0
- package/README.md +3 -3
- package/lib/cli/cli.js +3 -1
- package/lib/config.js +1 -0
- package/lib/formatters/files.js +1 -0
- package/lib/instrument/index.js +2 -0
- package/lib/instrument/plugin-mark/index.js +15 -1
- package/package.json +4 -4
package/ChangeLog
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
2022.07.30, v2.4.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- (escover) mark: improve support of ArrowFunctionExpressions
|
|
5
|
+
|
|
6
|
+
2022.07.20, v2.3.1
|
|
7
|
+
|
|
8
|
+
feature:
|
|
9
|
+
- package: putout v27.0.1
|
|
10
|
+
- package: eslint-plugin-n v15.2.4
|
|
11
|
+
- package: eslint-plugin-putout v16.0.0
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
2022.07.01, v2.3.0
|
|
15
|
+
|
|
16
|
+
feature:
|
|
17
|
+
- escover: mark: add support of UpdateExpression: inc/dec
|
|
18
|
+
|
|
19
|
+
|
|
1
20
|
2022.05.30, v2.2.0
|
|
2
21
|
|
|
3
22
|
feature:
|
package/README.md
CHANGED
|
@@ -118,12 +118,12 @@ If you want to disable coverage on status code without erroring, use `ESCOVER_SU
|
|
|
118
118
|
import {SKIPED} from 'supertape/exit-codes';
|
|
119
119
|
|
|
120
120
|
const env = {
|
|
121
|
-
ESCOVER_SUCCESS_EXIT_CODE:
|
|
121
|
+
ESCOVER_SUCCESS_EXIT_CODE: SKIPPED,
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
export default {
|
|
125
|
-
|
|
126
|
-
}
|
|
125
|
+
test: () => [env, `escover tape 'test/**/*.js' 'lib/**/*.spec.js'`],
|
|
126
|
+
};
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
## What should I know about `lcov`?
|
package/lib/cli/cli.js
CHANGED
|
@@ -48,6 +48,8 @@ export const cli = ({argv, exit, readCoverage}) => {
|
|
|
48
48
|
process.stdout.write(output);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
+
export const isSuccess = (error) => error?.status === Number(process.env.ESCOVER_SUCCESS_EXIT_CODE);
|
|
52
|
+
|
|
51
53
|
function execute(cmd, exit) {
|
|
52
54
|
const [error] = tryCatch(execSync, cmd, {
|
|
53
55
|
stdio: [0, 1, 2],
|
|
@@ -58,7 +60,7 @@ function execute(cmd, exit) {
|
|
|
58
60
|
},
|
|
59
61
|
});
|
|
60
62
|
|
|
61
|
-
if (error
|
|
63
|
+
if (isSuccess(error))
|
|
62
64
|
return exit(0);
|
|
63
65
|
|
|
64
66
|
if (error) {
|
package/lib/config.js
CHANGED
package/lib/formatters/files.js
CHANGED
package/lib/instrument/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import * as mark from './plugin-mark/index.js';
|
|
|
8
8
|
export const instrument = (url, source) => {
|
|
9
9
|
const c4 = global.__createC4(url);
|
|
10
10
|
const options = {
|
|
11
|
+
fixCount: 1,
|
|
11
12
|
rules: {
|
|
12
13
|
mark: ['on', {
|
|
13
14
|
c4,
|
|
@@ -19,6 +20,7 @@ export const instrument = (url, source) => {
|
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
const ast = parse(source);
|
|
23
|
+
|
|
22
24
|
transform(ast, source, options);
|
|
23
25
|
const {code} = generate(ast);
|
|
24
26
|
|
|
@@ -60,6 +60,7 @@ export const fix = (path, {options}) => {
|
|
|
60
60
|
lineNode.expression,
|
|
61
61
|
node,
|
|
62
62
|
]));
|
|
63
|
+
|
|
63
64
|
return;
|
|
64
65
|
}
|
|
65
66
|
|
|
@@ -97,6 +98,7 @@ export const fix = (path, {options}) => {
|
|
|
97
98
|
lineNode.expression,
|
|
98
99
|
node,
|
|
99
100
|
]));
|
|
101
|
+
|
|
100
102
|
return;
|
|
101
103
|
}
|
|
102
104
|
|
|
@@ -142,7 +144,12 @@ export const traverse = ({push}) => ({
|
|
|
142
144
|
push(path);
|
|
143
145
|
},
|
|
144
146
|
ArrowFunctionExpression(path) {
|
|
145
|
-
|
|
147
|
+
const bodyPath = path.get('body');
|
|
148
|
+
|
|
149
|
+
if (bodyPath.isBlockStatement())
|
|
150
|
+
return;
|
|
151
|
+
|
|
152
|
+
if (isExclude(bodyPath))
|
|
146
153
|
return;
|
|
147
154
|
|
|
148
155
|
push(path);
|
|
@@ -183,6 +190,13 @@ export const traverse = ({push}) => ({
|
|
|
183
190
|
push(expPath);
|
|
184
191
|
}
|
|
185
192
|
},
|
|
193
|
+
UpdateExpression(path) {
|
|
194
|
+
if (compare(path, `(${LINE}, __z)`)) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
push(path);
|
|
199
|
+
},
|
|
186
200
|
'IfStatement|ConditionalExpression'(path) {
|
|
187
201
|
const consequentPath = path.get('consequent');
|
|
188
202
|
const alternatePath = path.get('alternate');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "escover",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.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",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"montag": "^1.2.1",
|
|
48
48
|
"once": "^1.4.0",
|
|
49
49
|
"picomatch": "^2.3.1",
|
|
50
|
-
"putout": "^
|
|
50
|
+
"putout": "^27.0.1",
|
|
51
51
|
"strip-ansi": "^7.0.1",
|
|
52
52
|
"table": "^6.8.0",
|
|
53
53
|
"try-catch": "^3.0.0",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"c8": "^7.8.0",
|
|
64
64
|
"escover": "^2.0.1",
|
|
65
65
|
"eslint": "^8.3.0",
|
|
66
|
-
"eslint-plugin-
|
|
67
|
-
"eslint-plugin-putout": "^
|
|
66
|
+
"eslint-plugin-n": "^15.2.4",
|
|
67
|
+
"eslint-plugin-putout": "^16.0.0",
|
|
68
68
|
"madrun": "^9.0.0",
|
|
69
69
|
"supertape": "^7.0.0"
|
|
70
70
|
}
|