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 CHANGED
@@ -1,3 +1,9 @@
1
+ 2022.07.01, v2.3.0
2
+
3
+ feature:
4
+ - escover: mark: add support of UpdateExpression: inc/dec
5
+
6
+
1
7
  2022.05.30, v2.2.0
2
8
 
3
9
  feature:
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 {SKIPED} from 'supertape/exit-codes';
118
+ import {SKIPPED} from 'supertape/exit-codes';
119
119
 
120
120
  const env = {
121
- ESCOVER_SUCCESS_EXIT_CODE: SKIPED,
121
+ ESCOVER_SUCCESS_EXIT_CODE: SKIPPED,
122
122
  };
123
123
 
124
124
  export default {
125
- 'test': () => [env, `escover tape 'test/**/*.js' 'lib/**/*.spec.js'`],
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?.status === Number(process.env.ESCOVER_SUCCESS_EXIT_CODE))
63
+ if (isSuccess(error))
62
64
  return exit(0);
63
65
 
64
66
  if (error) {
package/lib/config.js CHANGED
@@ -36,6 +36,7 @@ export const readConfig = () => {
36
36
  return defaults;
37
37
 
38
38
  const data = readFileSync(name, 'utf8');
39
+
39
40
  return {
40
41
  ...defaults,
41
42
  ...parse(data),
@@ -58,6 +58,7 @@ export function formatLines(array) {
58
58
  return lines;
59
59
 
60
60
  const latest = array.at(-1);
61
+
61
62
  return `${lines}..${latest}`;
62
63
  }
63
64
 
@@ -19,6 +19,7 @@ export const instrument = (url, source) => {
19
19
  };
20
20
 
21
21
  const ast = parse(source);
22
+
22
23
  transform(ast, source, options);
23
24
  const {code} = generate(ast);
24
25
 
@@ -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.2.0",
3
+ "version": "2.3.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",