escover 1.0.1 → 1.0.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,12 @@
1
+ 2022.01.08, v1.0.2
2
+
3
+ fix:
4
+ - escover: impove support of AssignmentPattern
5
+
6
+ feature:
7
+ - escover: plugin-mark-line -> plugin-mark
8
+
9
+
1
10
  2022.01.08, v1.0.1
2
11
 
3
12
  fix:
package/coverage.json CHANGED
@@ -2,8 +2,7 @@
2
2
  {
3
3
  "name": "file:///Users/coderaiser/escover/example/example.js",
4
4
  "lines": {
5
- "1": true,
6
- "3": false
5
+ "1": true
7
6
  }
8
7
  }
9
8
  ]
@@ -1,4 +1,4 @@
1
1
  export const sum = (a, b) => a + b;
2
2
 
3
- export const mul = (a, b) => a * b;
3
+ // export const mul = (a, b) => a * b;
4
4
 
@@ -1,17 +1,17 @@
1
1
  import putout, {} from 'putout';
2
2
 
3
- import * as markLine from './plugin-mark-line/index.js';
3
+ import * as mark from './plugin-mark/index.js';
4
4
 
5
5
  export const instrument = (url, source) => {
6
6
  const __c4 = global.__createC4(url);
7
7
  const options = {
8
8
  rules: {
9
- 'mark-line': ['on', {
9
+ mark: ['on', {
10
10
  __c4,
11
11
  }],
12
12
  },
13
13
  plugins: [
14
- ['mark-line', markLine],
14
+ ['mark', mark],
15
15
  ],
16
16
  };
17
17
 
@@ -0,0 +1 @@
1
+ const [error, {packageJson} = (__c4.mark(1, 14), {})] = (__c4.mark(1, 36), tryCatch(readPackageUpSync));
@@ -0,0 +1 @@
1
+ const [error, {packageJson} = {}] = tryCatch(readPackageUpSync);
@@ -25,6 +25,6 @@ if ((__c4.mark(19, 4), a) || (__c4.mark(19, 9), b)) {
25
25
  }
26
26
 
27
27
 
28
- function x1(a, b = (__c4.mark(23, 15), b)) {
28
+ function x1(a, b = (__c4.mark(23, 15), 5)) {
29
29
  __c4.mark(23, 22);
30
30
  }
@@ -10,6 +10,7 @@ const {
10
10
  NumericLiteral,
11
11
  SequenceExpression,
12
12
  BlockStatement,
13
+ ExpressionStatement,
13
14
  } = types;
14
15
 
15
16
  const {
@@ -83,7 +84,7 @@ export const fix = (path, {options}) => {
83
84
  if (path.isAssignmentPattern()) {
84
85
  replaceWithMultiple(path.get('right'), [
85
86
  lineNode,
86
- node.left,
87
+ node.right,
87
88
  ]);
88
89
  return;
89
90
  }
@@ -117,13 +118,18 @@ const EXCLUDE = [
117
118
  export const exclude = () => EXCLUDE;
118
119
 
119
120
  export const include = () => [
120
- 'AssignmentPattern',
121
121
  'CallExpression',
122
122
  'NewExpression',
123
123
  'ReturnStatement',
124
124
  ];
125
125
 
126
126
  export const traverse = ({push}) => ({
127
+ AssignmentPattern(path) {
128
+ if (compareAny(path.get('right'), EXCLUDE))
129
+ return;
130
+
131
+ push(path);
132
+ },
127
133
  ArrowFunctionExpression(path) {
128
134
  if (path.get('body').isBlockStatement())
129
135
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escover",
3
- "version": "1.0.1",
3
+ "version": "1.0.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",