escover 1.14.0 → 1.15.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.26, v1.15.0
2
+
3
+ fix:
4
+ - escover: logical: find up
5
+
6
+
1
7
  2022.01.21, v1.14.0
2
8
 
3
9
  feature:
@@ -63,6 +63,12 @@ export const fix = (path, {options}) => {
63
63
  return;
64
64
  }
65
65
 
66
+ if (path.parentPath.isLogicalExpression())
67
+ return replaceWith(path, SequenceExpression([
68
+ lineNode.expression,
69
+ path.node,
70
+ ]));
71
+ /*
66
72
  if (path.isLogicalExpression()) {
67
73
  replaceWith(path.get('left'), SequenceExpression([
68
74
  lineNode.expression,
@@ -74,6 +80,7 @@ export const fix = (path, {options}) => {
74
80
  ]));
75
81
  return;
76
82
  }
83
+ */
77
84
 
78
85
  if (path.isAssignmentPattern() || path.isAssignmentExpression()) {
79
86
  replaceWith(path.get('right'), SequenceExpression([
@@ -110,10 +117,13 @@ const EXCLUDE = [
110
117
 
111
118
  const SEQUENCE = `(${LINE}, __z)`;
112
119
  const isExclude = (node) => {
113
- return compareAny(node, [
120
+ const templates = [
114
121
  ...EXCLUDE,
115
122
  SEQUENCE,
116
- ]);
123
+ ];
124
+ return compareAny(node, templates, {
125
+ findUp: false,
126
+ });
117
127
  };
118
128
 
119
129
  export const exclude = () => EXCLUDE;
@@ -153,10 +163,14 @@ export const traverse = ({push}) => ({
153
163
  push(path);
154
164
  },
155
165
  LogicalExpression(path) {
156
- if (isExclude(path.get('left')))
157
- return;
166
+ const leftPath = path.get('left');
167
+ const rightPath = path.get('right');
158
168
 
159
- push(path);
169
+ if (!isExclude(leftPath))
170
+ push(leftPath);
171
+
172
+ if (!isExclude(rightPath))
173
+ push(rightPath);
160
174
  },
161
175
  BlockStatement(path) {
162
176
  if (path.node.body.length)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escover",
3
- "version": "1.14.0",
3
+ "version": "1.15.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",