escover 1.3.4 → 1.4.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.15, v1.4.0
2
+
3
+ feature:
4
+ - escover: add ability to preserve fileEntries
5
+
6
+
1
7
  2022.01.15, v1.3.4
2
8
 
3
9
  fix:
package/lib/c4.js CHANGED
@@ -1,17 +1,36 @@
1
- export const __fileEntries = new Map();
1
+ const noop = () => {};
2
2
 
3
+ global.__fileEntries = global.__fileEntries || new Map();
4
+
5
+ export const {__fileEntries} = global;
3
6
  export const createFileEntry = (url) => {
4
- const lines = __fileEntries.get(url) || new Map();
7
+ url = url.replace(/\?.*$/, '');
8
+ let lines = __fileEntries.get(url);
9
+
10
+ if (lines) {
11
+ return {
12
+ '🧨': set(lines),
13
+ 'init': noop,
14
+ };
15
+ }
16
+
17
+ lines = new Map();
18
+
5
19
  __fileEntries.set(url, lines);
6
20
 
7
21
  return {
8
- '🧨': (line, column) => {
9
- lines.set(`${line}:${column}`, true);
10
- },
11
- 'init': (line, column) => {
12
- lines.set(`${line}:${column}`, false);
13
- },
22
+ '🧨': set(lines),
23
+ 'init': init(lines),
14
24
  };
15
25
  };
16
26
 
27
+ const set = (lines) => (line, column) => {
28
+ lines.set(`${line}:${column}`, true);
29
+ };
30
+
31
+ const init = (lines) => (line, column) => {
32
+ lines.set(`${line}:${column}`, false);
33
+ };
34
+
17
35
  export const getFileEntries = () => __fileEntries;
36
+
package/lib/coverage.js CHANGED
@@ -23,6 +23,7 @@ export const write = () => {
23
23
  return;
24
24
 
25
25
  const parsed = transform(files);
26
+
26
27
  const merged = merge(parsed);
27
28
  const name = findCacheDir({
28
29
  name: NAME,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escover",
3
- "version": "1.3.4",
3
+ "version": "1.4.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",