escover 2.1.3 → 2.3.1
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 +20 -0
- package/README.md +23 -1
- package/lib/cli/cli.js +5 -0
- package/lib/config.js +1 -0
- package/lib/formatters/files.js +1 -0
- package/lib/instrument/index.js +1 -0
- package/lib/instrument/plugin-mark/index.js +9 -0
- package/package.json +4 -4
package/ChangeLog
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
2022.07.20, v2.3.1
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- package: putout v27.0.1
|
|
5
|
+
- package: eslint-plugin-n v15.2.4
|
|
6
|
+
- package: eslint-plugin-putout v16.0.0
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
2022.07.01, v2.3.0
|
|
10
|
+
|
|
11
|
+
feature:
|
|
12
|
+
- escover: mark: add support of UpdateExpression: inc/dec
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
2022.05.30, v2.2.0
|
|
16
|
+
|
|
17
|
+
feature:
|
|
18
|
+
- escover: add support of ESCOVER_SUCCESS_EXIT_CODE
|
|
19
|
+
|
|
20
|
+
|
|
1
21
|
2022.05.29, v2.1.3
|
|
2
22
|
|
|
3
23
|
fix:
|
package/README.md
CHANGED
|
@@ -95,15 +95,37 @@ Experimental `loaders` supports only one, for now. So [zenload](https://github.c
|
|
|
95
95
|
Install it with:
|
|
96
96
|
|
|
97
97
|
```sh
|
|
98
|
-
npm i escover
|
|
98
|
+
npm i escover
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
Then run:
|
|
102
102
|
|
|
103
|
+
```sh
|
|
104
|
+
escover npm test
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
This is the same as:
|
|
108
|
+
|
|
103
109
|
```sh
|
|
104
110
|
NODE_OPTIONS="'--loader zenlend'" ZENLOAD='escover,mock-import' escover npm test
|
|
105
111
|
```
|
|
106
112
|
|
|
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: SKIPPED,
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export default {
|
|
125
|
+
test: () => [env, `escover tape 'test/**/*.js' 'lib/**/*.spec.js'`],
|
|
126
|
+
};
|
|
127
|
+
```
|
|
128
|
+
|
|
107
129
|
## What should I know about `lcov`?
|
|
108
130
|
|
|
109
131
|
Format used by 🎩**ESCover** located in `coverage/lcov.info`.
|
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,6 +60,9 @@ function execute(cmd, exit) {
|
|
|
58
60
|
},
|
|
59
61
|
});
|
|
60
62
|
|
|
63
|
+
if (isSuccess(error))
|
|
64
|
+
return exit(0);
|
|
65
|
+
|
|
61
66
|
if (error) {
|
|
62
67
|
console.error(error.message);
|
|
63
68
|
return exit(1);
|
package/lib/config.js
CHANGED
package/lib/formatters/files.js
CHANGED
package/lib/instrument/index.js
CHANGED
|
@@ -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
|
|
|
@@ -183,6 +185,13 @@ export const traverse = ({push}) => ({
|
|
|
183
185
|
push(expPath);
|
|
184
186
|
}
|
|
185
187
|
},
|
|
188
|
+
UpdateExpression(path) {
|
|
189
|
+
if (compare(path, `(${LINE}, __z)`)) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
push(path);
|
|
194
|
+
},
|
|
186
195
|
'IfStatement|ConditionalExpression'(path) {
|
|
187
196
|
const consequentPath = path.get('consequent');
|
|
188
197
|
const alternatePath = path.get('alternate');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "escover",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.3.1",
|
|
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
|
}
|