escover 1.15.0 → 1.17.2

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.27, v1.17.2
2
+
3
+ fix:
4
+ - mark: StringLiteral
5
+
6
+
7
+ 2022.01.27, v1.17.1
8
+
9
+ fix:
10
+ - escover: transform: mergeLines: & -> &&
11
+
12
+
13
+ 2022.01.27, v1.17.0
14
+
15
+ feature:
16
+ - escover: improve ternary support: Identifier
17
+
18
+
19
+ 2022.01.27, v1.16.0
20
+
21
+ feature:
22
+ - escover: add support of ternary
23
+
24
+
1
25
  2022.01.26, v1.15.0
2
26
 
3
27
  fix:
@@ -1,7 +1,8 @@
1
1
  import chalk from 'chalk';
2
- const {entries} = Object;
3
2
 
3
+ const {entries} = Object;
4
4
  const createOut = (output) => (a) => output.push(a);
5
+
5
6
  export default (coverageFile) => {
6
7
  const output = [];
7
8
  const out = createOut(output);
@@ -68,19 +68,6 @@ export const fix = (path, {options}) => {
68
68
  lineNode.expression,
69
69
  path.node,
70
70
  ]));
71
- /*
72
- if (path.isLogicalExpression()) {
73
- replaceWith(path.get('left'), SequenceExpression([
74
- lineNode.expression,
75
- path.node.left,
76
- ]));
77
- replaceWith(path.get('right'), SequenceExpression([
78
- getLineNode(c4, path.node.right.loc.start).expression,
79
- path.node.right,
80
- ]));
81
- return;
82
- }
83
- */
84
71
 
85
72
  if (path.isAssignmentPattern() || path.isAssignmentExpression()) {
86
73
  replaceWith(path.get('right'), SequenceExpression([
@@ -103,6 +90,16 @@ export const fix = (path, {options}) => {
103
90
  ]);
104
91
  }
105
92
 
93
+ if (path.isExpression()) {
94
+ const {node} = path;
95
+
96
+ replaceWith(path, SequenceExpression([
97
+ lineNode.expression,
98
+ node,
99
+ ]));
100
+ return;
101
+ }
102
+
106
103
  replaceWith(path, BlockStatement([
107
104
  node,
108
105
  ]));
@@ -179,8 +176,9 @@ export const traverse = ({push}) => ({
179
176
  push(path);
180
177
  },
181
178
  SequenceExpression(path) {
182
- if (compare(path, `(${LINE}, __z)`))
179
+ if (compare(path, `(${LINE}, __z)`)) {
183
180
  return;
181
+ }
184
182
 
185
183
  const expressions = path.get('expressions');
186
184
 
@@ -191,7 +189,7 @@ export const traverse = ({push}) => ({
191
189
  push(expPath);
192
190
  }
193
191
  },
194
- IfStatement(path) {
192
+ 'IfStatement|ConditionalExpression'(path) {
195
193
  const consequentPath = path.get('consequent');
196
194
  const alternatePath = path.get('alternate');
197
195
 
@@ -201,7 +199,7 @@ export const traverse = ({push}) => ({
201
199
  if (!alternatePath.node)
202
200
  return;
203
201
 
204
- if (!alternatePath.isBlockStatement())
202
+ if (!alternatePath.isBlockStatement() && !isExclude(alternatePath))
205
203
  push(alternatePath);
206
204
  },
207
205
  });
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.15.0",
3
+ "version": "1.17.2",
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",