escover 1.0.3 → 1.0.4
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 +6 -0
- package/coverage.json +1 -8
- package/lib/c4.js +2 -2
- package/lib/escover.js +0 -2
- package/lib/instrument/plugin-mark/fixture/arrow-fix.js +2 -2
- package/lib/instrument/plugin-mark/fixture/assignment-fix.js +2 -1
- package/lib/instrument/plugin-mark/fixture/assignment.js +1 -0
- package/lib/instrument/plugin-mark/fixture/if-fix.js +4 -1
- package/lib/instrument/plugin-mark/fixture/if.js +3 -0
- package/lib/instrument/plugin-mark/fixture/logical-fix.js +2 -2
- package/lib/instrument/plugin-mark/fixture/mark-line-fix.js +11 -11
- package/lib/instrument/plugin-mark/fixture/new-fix.js +1 -1
- package/lib/instrument/plugin-mark/fixture/no-loc-fix.js +3 -3
- package/lib/instrument/plugin-mark/index.js +10 -14
- package/lib/report.js +3 -3
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/coverage.json
CHANGED
package/lib/c4.js
CHANGED
|
@@ -5,10 +5,10 @@ export const createFileEntry = (url) => {
|
|
|
5
5
|
files.set(url, lines);
|
|
6
6
|
|
|
7
7
|
return {
|
|
8
|
-
|
|
8
|
+
'🧨': (line, column) => {
|
|
9
9
|
lines.set(`${line}:${column}`, true);
|
|
10
10
|
},
|
|
11
|
-
init: (line, column) => {
|
|
11
|
+
'init': (line, column) => {
|
|
12
12
|
lines.set(`${line}:${column}`, false);
|
|
13
13
|
},
|
|
14
14
|
};
|
package/lib/escover.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
const [error, {packageJson} = (__c4
|
|
1
|
+
const [error, {packageJson} = (__c4['🧨'](1, 14), {})] = (__c4['🧨'](1, 36), tryCatch(readPackageUpSync));
|
|
2
|
+
data += (__c4['🧨'](2, 0), 'fix:' + '\n');
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
if (error) {
|
|
2
|
-
throw (__c4
|
|
2
|
+
throw (__c4['🧨'](2, 4), `error reading package.json: ${error.message}`);
|
|
3
3
|
}
|
|
4
|
+
|
|
5
|
+
if (error)
|
|
6
|
+
throw (__c4['🧨'](6, 4), (__c4.mark(11, 8), `error reading package.json: ${error.message}`));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
if ((__c4
|
|
2
|
-
__c4
|
|
1
|
+
if ((__c4['🧨'](1, 4), a) || (__c4['🧨'](1, 9), b)) {
|
|
2
|
+
__c4['🧨'](1, 12);
|
|
3
3
|
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
const a = () => {
|
|
2
|
-
a = 5;
|
|
3
|
-
__c4
|
|
2
|
+
a = (__c4['🧨'](2, 4), 5);
|
|
3
|
+
__c4['🧨'](3, 4), console.log(5);
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
function x() {
|
|
8
8
|
|
|
9
9
|
if (a > 2) {
|
|
10
|
-
__c4
|
|
10
|
+
__c4['🧨'](9, 14), a();
|
|
11
11
|
} else {
|
|
12
|
-
__c4
|
|
12
|
+
__c4['🧨'](10, 9), b();
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
for (const x of y) {
|
|
17
|
-
__c4
|
|
17
|
+
__c4['🧨'](13, 19);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const ax = ((__c4
|
|
21
|
-
const bx = (c, (__c4
|
|
20
|
+
const ax = ((__c4['🧨'](16, 12), a()), (__c4['🧨'](16, 17), b()));
|
|
21
|
+
const bx = (c, (__c4['🧨'](17, 15), d()));
|
|
22
22
|
|
|
23
|
-
if ((__c4
|
|
24
|
-
__c4
|
|
23
|
+
if ((__c4['🧨'](19, 4), a) || (__c4['🧨'](19, 9), b)) {
|
|
24
|
+
__c4['🧨'](19, 12);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
function x1(a, b = (__c4
|
|
29
|
-
__c4
|
|
28
|
+
function x1(a, b = (__c4['🧨'](23, 15), 5)) {
|
|
29
|
+
__c4['🧨'](23, 22);
|
|
30
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const files = (__c4
|
|
1
|
+
const files = (__c4['🧨'](1, 14), new Map());
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
__c4
|
|
1
|
+
__c4['🧨'](1, 0), cli({
|
|
2
2
|
stdout,
|
|
3
3
|
stderr,
|
|
4
4
|
exit,
|
|
5
|
-
cwd: (__c4
|
|
6
|
-
argv: (__c4
|
|
5
|
+
cwd: (__c4['🧨'](5, 9), process.cwd()),
|
|
6
|
+
argv: (__c4['🧨'](6, 10), process.argv.slice(2))
|
|
7
7
|
});
|
|
8
8
|
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
} from 'putout';
|
|
6
6
|
import {addMarkToReturn} from './return.js';
|
|
7
7
|
import {addMarkToArrowFunction} from './arrow.js';
|
|
8
|
+
import {addMarkToThrow} from './throw.js';
|
|
8
9
|
|
|
9
10
|
const {
|
|
10
11
|
NumericLiteral,
|
|
@@ -13,12 +14,11 @@ const {
|
|
|
13
14
|
} = types;
|
|
14
15
|
|
|
15
16
|
const {
|
|
16
|
-
replaceWithMultiple,
|
|
17
17
|
replaceWith,
|
|
18
18
|
compareAny,
|
|
19
19
|
} = operator;
|
|
20
20
|
|
|
21
|
-
const LINE = '
|
|
21
|
+
const LINE = `__c4['🧨'](__l, __c)`;
|
|
22
22
|
const buildLineNode = template(LINE, {
|
|
23
23
|
placeholderPattern: /^__[a-z]$/,
|
|
24
24
|
});
|
|
@@ -80,11 +80,11 @@ export const fix = (path, {options}) => {
|
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
if (path.isAssignmentPattern()) {
|
|
84
|
-
|
|
85
|
-
lineNode,
|
|
83
|
+
if (path.isAssignmentPattern() || path.isAssignmentExpression()) {
|
|
84
|
+
replaceWith(path.get('right'), SequenceExpression([
|
|
85
|
+
lineNode.expression,
|
|
86
86
|
node.right,
|
|
87
|
-
]);
|
|
87
|
+
]));
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -102,12 +102,8 @@ export const fix = (path, {options}) => {
|
|
|
102
102
|
if (path.isArrowFunctionExpression())
|
|
103
103
|
return addMarkToArrowFunction(path, lineNode);
|
|
104
104
|
|
|
105
|
-
if (path.isThrowStatement())
|
|
106
|
-
return
|
|
107
|
-
lineNode.expression,
|
|
108
|
-
node.argument,
|
|
109
|
-
]));
|
|
110
|
-
}
|
|
105
|
+
if (path.isThrowStatement())
|
|
106
|
+
return addMarkToThrow(path, lineNode);
|
|
111
107
|
|
|
112
108
|
replaceWith(path, BlockStatement([
|
|
113
109
|
node,
|
|
@@ -132,7 +128,7 @@ export const include = () => [
|
|
|
132
128
|
];
|
|
133
129
|
|
|
134
130
|
export const traverse = ({push}) => ({
|
|
135
|
-
AssignmentPattern(path) {
|
|
131
|
+
'AssignmentPattern|AssignmentExpression'(path) {
|
|
136
132
|
if (compareAny(path.get('right'), EXCLUDE))
|
|
137
133
|
return;
|
|
138
134
|
|
|
@@ -170,7 +166,7 @@ export const traverse = ({push}) => ({
|
|
|
170
166
|
const consequentPath = path.get('consequent');
|
|
171
167
|
const alternatePath = path.get('alternate');
|
|
172
168
|
|
|
173
|
-
if (!consequentPath.isBlockStatement())
|
|
169
|
+
if (!consequentPath.isBlockStatement() && !compareAny(consequentPath, EXCLUDE))
|
|
174
170
|
push(consequentPath);
|
|
175
171
|
|
|
176
172
|
if (!alternatePath.node)
|
package/lib/report.js
CHANGED
|
@@ -14,7 +14,7 @@ export const report = () => {
|
|
|
14
14
|
uncoveredCount: 0,
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
console.log('#
|
|
17
|
+
console.log('# CAP version 13');
|
|
18
18
|
console.log('');
|
|
19
19
|
|
|
20
20
|
for (const {name, lines} of coverageFile) {
|
|
@@ -45,9 +45,9 @@ export const report = () => {
|
|
|
45
45
|
for (const {name, covered, uncoveredLines} of files) {
|
|
46
46
|
if (!covered) {
|
|
47
47
|
console.log(`# ${name}`);
|
|
48
|
-
console.log('
|
|
48
|
+
console.log('🧨 should be covered');
|
|
49
49
|
console.log('---');
|
|
50
|
-
console.log(`lines: ${chalk.red(uncoveredLines.join(','))}`);
|
|
50
|
+
console.log(`lines: ${chalk.red(uncoveredLines.join(', '))}`);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|