escover 1.16.0 → 1.18.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,27 @@
1
+ 2022.01.30, v1.18.0
2
+
3
+ feature:
4
+ - escover: improve generation of SequenceExpressions
5
+
6
+
7
+ 2022.01.27, v1.17.2
8
+
9
+ fix:
10
+ - mark: StringLiteral
11
+
12
+
13
+ 2022.01.27, v1.17.1
14
+
15
+ fix:
16
+ - escover: transform: mergeLines: & -> &&
17
+
18
+
19
+ 2022.01.27, v1.17.0
20
+
21
+ feature:
22
+ - escover: improve ternary support: Identifier
23
+
24
+
1
25
  2022.01.27, v1.16.0
2
26
 
3
27
  feature:
@@ -1,4 +1,8 @@
1
- import putout from 'putout';
1
+ import {
2
+ parse,
3
+ generate,
4
+ transform,
5
+ } from 'putout';
2
6
  import * as mark from './plugin-mark/index.js';
3
7
 
4
8
  export const instrument = (url, source) => {
@@ -14,7 +18,10 @@ export const instrument = (url, source) => {
14
18
  ],
15
19
  };
16
20
 
17
- const {code} = putout(source, options);
21
+ const ast = parse(source);
22
+ transform(ast, source, options);
23
+ const {code} = generate(ast);
24
+
18
25
  return code;
19
26
  };
20
27
 
@@ -90,6 +90,16 @@ export const fix = (path, {options}) => {
90
90
  ]);
91
91
  }
92
92
 
93
+ if (path.isExpression()) {
94
+ const {node} = path;
95
+
96
+ replaceWith(path, SequenceExpression([
97
+ lineNode.expression,
98
+ node,
99
+ ]));
100
+ return;
101
+ }
102
+
93
103
  replaceWith(path, BlockStatement([
94
104
  node,
95
105
  ]));
package/lib/transform.js CHANGED
@@ -25,7 +25,7 @@ function mergeLines(places) {
25
25
  const [line] = place.split(':');
26
26
 
27
27
  if (isBool(result[line])) {
28
- result[line] &= covered;
28
+ result[line] = result[line] && covered;
29
29
  continue;
30
30
  }
31
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escover",
3
- "version": "1.16.0",
3
+ "version": "1.18.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",