escover 2.0.2 → 2.1.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 +6 -0
- package/README.md +6 -6
- package/lib/instrument/plugin-mark/index.js +1 -7
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 🎩ESCover [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
|
|
2
2
|
|
|
3
3
|
[NPMIMGURL]: https://img.shields.io/npm/v/escover.svg?style=flat
|
|
4
4
|
[BuildStatusURL]: https://github.com/coderaiser/escover/actions?query=workflow%3A%22Node+CI%22 "Build Status"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
[CoverageURL]: https://coveralls.io/github/coderaiser/escover?branch=master
|
|
10
10
|
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/escover/badge.svg?branch=master&service=github
|
|
11
11
|
|
|
12
|
-
Coverage for EcmaScript Modules based on 🐊[
|
|
12
|
+
Coverage for EcmaScript Modules based on 🐊[**Putout**](https://github.com/coderaiser/putout) and [loaders](https://nodejs.org/dist/latest-v16.x/docs/api/esm.html#loaders).
|
|
13
13
|
|
|
14
14
|
## Why another coverage tool?
|
|
15
15
|
|
|
@@ -18,7 +18,7 @@ you have a couple problems to solve.
|
|
|
18
18
|
|
|
19
19
|
### 🤷 What test runner does no transpiling to `CommonJS`?
|
|
20
20
|
|
|
21
|
-
☝️ that's easy! 📼 [
|
|
21
|
+
☝️ that's easy! 📼 [**Supertape**](https://github.com/coderaiser/supertape) supports `ESM` from the box;
|
|
22
22
|
|
|
23
23
|
### 🤷 How to mock modules without [mock-require](https://github.com/boblauer/mock-require) (we in `ESM`!);
|
|
24
24
|
|
|
@@ -31,7 +31,7 @@ which are needed to load module again, and apply mocks.
|
|
|
31
31
|
|
|
32
32
|
### 🤷 How to get coverage when mocks are used?
|
|
33
33
|
|
|
34
|
-
☝️ Use
|
|
34
|
+
☝️ Use 🎩**ESCover**! It supports loaders, `ESM` and collects coverage as a loader!
|
|
35
35
|
|
|
36
36
|
### 🤷 What with [`coveralls`](https://coveralls.io/)? Does [`lcov`](https://github.com/StevenLooman/mocha-lcov-reporter) supported?
|
|
37
37
|
|
|
@@ -88,7 +88,7 @@ NODE_OPTIONS="'--loader zenlend'" ZENLOAD='escover,mock-import' escover npm test
|
|
|
88
88
|
|
|
89
89
|
Format used by 🎩`ESCover` located in `coverage/lcov.info`.
|
|
90
90
|
|
|
91
|
-
- ☝️ *[`lcov`](https://github.com/linux-test-project/lcov) was created in `2002`,
|
|
91
|
+
- ☝️ *[`lcov`](https://github.com/linux-test-project/lcov) was created in `2002`, twenty years ago.*
|
|
92
92
|
- ☝️ *Linux kernel developers created it to know what is going on with the coverage.*
|
|
93
93
|
- ☝️ *It's written in `PERL` and has text based format.*
|
|
94
94
|
- ☝️ *This is most popular coverage format of all times supported by a lot of tools (like [coveralls](https://coveralls.io)).*
|
|
@@ -124,7 +124,7 @@ Where:
|
|
|
124
124
|
- `DA` - is line number, and count of running;
|
|
125
125
|
- `end_of_record` latest recored for current file entry;
|
|
126
126
|
|
|
127
|
-
The only thing that is differ from `lcov`: counters
|
|
127
|
+
The only thing that is differ from `lcov`: counters are `0` or `1`, if you have a reason to use "real" counters [create an issue](https://github.com/coderaiser/escover/issues/new).
|
|
128
128
|
|
|
129
129
|
It can be added in one line of code, but I see no reason why it can be useful 🤷♂️.
|
|
130
130
|
|
|
@@ -38,7 +38,7 @@ export const report = () => 'Mark line';
|
|
|
38
38
|
|
|
39
39
|
export const fix = (path, {options}) => {
|
|
40
40
|
const {node} = path;
|
|
41
|
-
const {start} = path.node.loc;
|
|
41
|
+
const {start} = path.node.loc || path.parentPath.node.loc;
|
|
42
42
|
|
|
43
43
|
const {
|
|
44
44
|
c4 = {
|
|
@@ -129,12 +129,6 @@ export const traverse = ({push}) => ({
|
|
|
129
129
|
'ThrowStatement|ReturnStatement'(path) {
|
|
130
130
|
push(path);
|
|
131
131
|
},
|
|
132
|
-
CallExpression(path) {
|
|
133
|
-
if (compare(path.parentPath.node, SEQUENCE))
|
|
134
|
-
return;
|
|
135
|
-
|
|
136
|
-
push(path);
|
|
137
|
-
},
|
|
138
132
|
'CallExpression|NewExpression'(path) {
|
|
139
133
|
if (compare(path.parentPath.node, SEQUENCE))
|
|
140
134
|
return;
|