escover 1.15.0 → 1.16.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.01.27, v1.16.0
2
+
3
+ feature:
4
+ - escover: add support of ternary
5
+
6
+
1
7
  2022.01.26, v1.15.0
2
8
 
3
9
  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([
@@ -179,8 +166,9 @@ export const traverse = ({push}) => ({
179
166
  push(path);
180
167
  },
181
168
  SequenceExpression(path) {
182
- if (compare(path, `(${LINE}, __z)`))
169
+ if (compare(path, `(${LINE}, __z)`)) {
183
170
  return;
171
+ }
184
172
 
185
173
  const expressions = path.get('expressions');
186
174
 
@@ -191,7 +179,7 @@ export const traverse = ({push}) => ({
191
179
  push(expPath);
192
180
  }
193
181
  },
194
- IfStatement(path) {
182
+ 'IfStatement|ConditionalExpression'(path) {
195
183
  const consequentPath = path.get('consequent');
196
184
  const alternatePath = path.get('alternate');
197
185
 
@@ -201,7 +189,7 @@ export const traverse = ({push}) => ({
201
189
  if (!alternatePath.node)
202
190
  return;
203
191
 
204
- if (!alternatePath.isBlockStatement())
192
+ if (!alternatePath.isBlockStatement() && !isExclude(alternatePath))
205
193
  push(alternatePath);
206
194
  },
207
195
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escover",
3
- "version": "1.15.0",
3
+ "version": "1.16.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",