escover 1.2.3 → 1.3.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,10 @@
1
+ 2022.01.15, v1.3.0
2
+
3
+ feature:
4
+ - escover: exclude test
5
+ - escover: config -> coverage
6
+
7
+
1
8
  2022.01.15, v1.2.3
2
9
 
3
10
  fix:
package/bin/escover.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import {cli} from '../lib/cli/cli.js';
4
- import {read} from '../lib/config.js';
4
+ import {read} from '../lib/coverage.js';
5
5
 
6
6
  cli({
7
7
  argv: process.argv,
package/lib/escover.js CHANGED
@@ -10,6 +10,8 @@ global.__createC4 = createFileEntry;
10
10
 
11
11
  process.once('exit', exit);
12
12
 
13
+ const EXCLUDE = ['.spec.', 'node_modules', '/fixture/', '.madrun.', '/test/'];
14
+
13
15
  export async function load(url, context, defaultLoad) {
14
16
  const {format, source: rawSource} = await defaultLoad(url, context, defaultLoad);
15
17
 
@@ -18,7 +20,7 @@ export async function load(url, context, defaultLoad) {
18
20
  format,
19
21
  };
20
22
 
21
- if (exclude(url, ['.spec.', 'node_modules', '/fixture/', '.madrun.']))
23
+ if (exclude(url, EXCLUDE))
22
24
  return {
23
25
  format,
24
26
  source: rawSource,
package/lib/exit.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import once from 'once';
2
- import {write} from './config.js';
2
+ import {write} from './coverage.js';
3
3
 
4
4
  export const exit = once(() => {
5
5
  write();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escover",
3
- "version": "1.2.3",
3
+ "version": "1.3.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",
package/lib/config.js DELETED
@@ -1,43 +0,0 @@
1
- import tryCatch from 'try-catch';
2
- import {
3
- writeFileSync,
4
- readFileSync,
5
- } from 'fs';
6
- import {getFiles} from './c4.js';
7
- import {transform} from './transform.js';
8
- import {merge} from './merge.js';
9
- import findCacheDir from 'find-cache-dir';
10
-
11
- const {
12
- stringify,
13
- parse,
14
- } = JSON;
15
-
16
- const NAME = 'escover';
17
- const buildName = (a) => `${a}/${NAME}.json`;
18
-
19
- export const write = () => {
20
- const files = getFiles();
21
- const parsed = transform(files);
22
- const merged = merge(parsed);
23
- const name = findCacheDir({
24
- name: NAME,
25
- create: true,
26
- });
27
-
28
- writeFileSync(buildName(name), stringify(merged, null, 4));
29
- };
30
-
31
- export const read = () => {
32
- const name = findCacheDir({
33
- name: NAME,
34
- });
35
-
36
- const [error, data] = tryCatch(readFileSync, buildName(name), 'utf8');
37
-
38
- if (error)
39
- return [];
40
-
41
- return parse(data);
42
- };
43
-