escover 3.2.2 → 3.2.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 CHANGED
@@ -1,3 +1,13 @@
1
+ 2023.05.10, v3.2.4
2
+
3
+ fix:
4
+ - 74c5607 escover: cli: add quotes to NODE_OPTIONS
5
+
6
+ 2023.05.07, v3.2.3
7
+
8
+ fix:
9
+ - f0e959e escover: add montag
10
+
1
11
  2023.05.05, v3.2.2
2
12
 
3
13
  feature:
package/README.md CHANGED
@@ -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 🐊[**Putout**](https://github.com/coderaiser/putout) and [loaders](https://nodejs.org/dist/latest-v16.x/docs/api/esm.html#loaders).
12
+ Coverage for EcmaScript Modules based on 🐊[**Putout**](https://github.com/coderaiser/putout) and [loaders](https://nodejs.org/dist/latest-v20.x/docs/api/esm.html#loaders).
13
13
 
14
14
  ## Why another coverage tool?
15
15
 
package/bin/escover.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  import {cli} from '../lib/cli/cli.js';
3
4
  import {readCoverage} from '../lib/coverage-file/coverage-file.js';
4
5
  import {readConfig} from '../lib/config.js';
package/lib/cli/cli.js CHANGED
@@ -10,6 +10,8 @@ const {
10
10
  NODE_OPTIONS = '',
11
11
  } = process.env;
12
12
 
13
+ export const ESCOVER_NODE_OPTIONS = `'--no-warnings --loader zenload ${NODE_OPTIONS}'`;
14
+
13
15
  export const cli = ({argv, exit, readCoverage}) => {
14
16
  const args = yargsParser(argv.slice(2), {
15
17
  string: [
@@ -58,7 +60,7 @@ function execute(cmd, exit) {
58
60
  env: {
59
61
  ZENLOAD: 'escover,mock-import',
60
62
  ...process.env,
61
- NODE_OPTIONS: `--no-warnings --loader zenload ${NODE_OPTIONS} `,
63
+ NODE_OPTIONS: ESCOVER_NODE_OPTIONS,
62
64
  },
63
65
  });
64
66
 
@@ -1,4 +1,5 @@
1
1
  import {readFileSync} from 'fs';
2
+
2
3
  const {parse} = JSON;
3
4
  const packageJson = new URL('../../package.json', import.meta.url);
4
5
 
package/lib/escover.js CHANGED
@@ -8,9 +8,10 @@ import {
8
8
  isExclude,
9
9
  } from './config.js';
10
10
 
11
+ !global.__createC4 && process.once('exit', exit);
12
+
11
13
  global.__createC4 = createFileEntry;
12
14
 
13
- process.once('exit', exit);
14
15
  const CWD = process.cwd();
15
16
 
16
17
  const {exclude} = readConfig();
@@ -65,6 +66,7 @@ export function globalPreload({port}) {
65
66
  };
66
67
  `;
67
68
  }
69
+
68
70
  export async function load(url, context, defaultLoad) {
69
71
  const {
70
72
  format,
@@ -94,7 +96,7 @@ export async function load(url, context, defaultLoad) {
94
96
  source: rawSource,
95
97
  };
96
98
 
97
- const source = `
99
+ const source = montag`
98
100
  const __c4 = global.__createC4('${url}');
99
101
  ${instrument(url, String(rawSource))}
100
102
  `;
@@ -2,9 +2,13 @@ import putout from 'putout';
2
2
  import * as mark from './plugin-mark/index.js';
3
3
  import convertOptionalToLogical from '@putout/plugin-convert-optional-to-logical';
4
4
 
5
+ const cut = (a) => a.replace('#!/usr/bin/env node', '');
6
+
5
7
  export const instrument = (url, source) => {
6
8
  const c4 = global.__createC4(url);
7
9
 
10
+ source = cut(source);
11
+
8
12
  const {code} = putout(source, {
9
13
  printer: 'putout',
10
14
  fixCount: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escover",
3
- "version": "3.2.2",
3
+ "version": "3.2.4",
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",