escover 2.2.0 → 2.3.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 +6 -0
- package/README.md +4 -4
- 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 +1 -0
- package/lib/instrument/plugin-mark/index.js +9 -0
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -115,15 +115,15 @@ NODE_OPTIONS="'--loader zenlend'" ZENLOAD='escover,mock-import' escover npm test
|
|
|
115
115
|
If you want to disable coverage on status code without erroring, use `ESCOVER_SUCCESS_EXIT_CODE`:
|
|
116
116
|
|
|
117
117
|
```js
|
|
118
|
-
import {
|
|
118
|
+
import {SKIPPED} 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
|
@@ -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');
|