escover 3.4.0 → 3.5.1

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,20 @@
1
+ 2023.07.31, v3.5.1
2
+
3
+ fix:
4
+ - ba6e405 escover: write coverage on exit -> write coverage each time
5
+
6
+ 2023.07.31, v3.5.0
7
+
8
+ fix:
9
+ - 2411d57 escover
10
+ - 830082d escover: exit
11
+
12
+ feature:
13
+ - b6b1301 package: @putout/test v7.0.1
14
+ - e9502cc package: c8 v8.0.1
15
+ - 882431a package: eslint-plugin-putout v18.2.0
16
+ - eb15154 package: putout v30.7.0
17
+
1
18
  2023.06.08, v3.4.0
2
19
 
3
20
  feature:
package/lib/cli/cli.js CHANGED
@@ -4,6 +4,7 @@ import yargsParser from 'yargs-parser';
4
4
  import {version} from './version.js';
5
5
  import reportLines from '../formatters/lines.js';
6
6
  import reportFiles from '../formatters/files.js';
7
+ import {exit as mainExit} from '../exit.js';
7
8
 
8
9
  const {ESCOVER_FORMAT} = process.env;
9
10
 
@@ -11,12 +12,8 @@ export const ESCOVER_NODE_OPTIONS = '--no-warnings --loader zenload';
11
12
 
12
13
  export const cli = ({argv, exit, readCoverage}) => {
13
14
  const args = yargsParser(argv.slice(2), {
14
- string: [
15
- 'format',
16
- ],
17
- boolean: [
18
- 'version',
19
- ],
15
+ string: ['format'],
16
+ boolean: ['version'],
20
17
  alias: {
21
18
  v: 'version',
22
19
  f: 'format',
@@ -34,7 +31,7 @@ export const cli = ({argv, exit, readCoverage}) => {
34
31
  const cmd = argv.slice(2);
35
32
 
36
33
  if (cmd.length) {
37
- execute(`"${cmd.join('" "')}"`, exit);
34
+ execute(`"${cmd.join('" "')}"`, () => {});
38
35
  }
39
36
 
40
37
  const coverage = readCoverage();
@@ -49,7 +46,7 @@ export const cli = ({argv, exit, readCoverage}) => {
49
46
  process.stdout.write(output);
50
47
  };
51
48
 
52
- export const isSuccess = (error) => error?.status === Number(process.env.ESCOVER_SUCCESS_EXIT_CODE);
49
+ export const isSuccess = (error) => !error || error?.status === Number(process.env.ESCOVER_SUCCESS_EXIT_CODE);
53
50
 
54
51
  function execute(cmd, exit) {
55
52
  const [error] = tryCatch(execSync, cmd, {
@@ -61,8 +58,9 @@ function execute(cmd, exit) {
61
58
  },
62
59
  });
63
60
 
64
- if (isSuccess(error))
61
+ if (isSuccess(error)) {
65
62
  return exit(0);
63
+ }
66
64
 
67
65
  if (error) {
68
66
  console.error(error.message);
package/lib/escover.js CHANGED
@@ -7,15 +7,12 @@ import {
7
7
  readConfig,
8
8
  isExclude,
9
9
  } from './config.js';
10
-
11
- !global.__createC4 && process.once('exit', exit);
10
+ import {writeCoverage} from './coverage-file/coverage-file.js';
12
11
 
13
12
  global.__createC4 = createFileEntry;
14
13
 
15
14
  const port = {};
16
-
17
15
  const CWD = process.cwd();
18
-
19
16
  const {exclude} = readConfig();
20
17
 
21
18
  const EXCLUDE = [
@@ -43,10 +40,12 @@ export function globalPreload({port}) {
43
40
  const c4 = createFileEntry(url);
44
41
 
45
42
  if (type === 'set')
46
- return c4['🧨'](line, column);
43
+ c4['🧨'](line, column);
47
44
 
48
45
  if (type === 'init')
49
- return c4.init(line, column);
46
+ c4.init(line, column);
47
+
48
+ writeCoverage();
50
49
  };
51
50
 
52
51
  return `(${escover})();`;
@@ -78,10 +77,7 @@ function escover() {
78
77
  }
79
78
 
80
79
  export async function load(url, context, defaultLoad) {
81
- const {
82
- format,
83
- source: rawSource,
84
- } = await defaultLoad(url, context, defaultLoad);
80
+ const {format, source: rawSource} = await defaultLoad(url, context, defaultLoad);
85
81
 
86
82
  if (/commonjs|builtin/.test(format))
87
83
  return {
@@ -6,10 +6,7 @@ import chalk from 'chalk';
6
6
 
7
7
  const CWD = process.cwd();
8
8
 
9
- const {
10
- entries,
11
- keys,
12
- } = Object;
9
+ const {entries, keys} = Object;
13
10
 
14
11
  export default (coverageFile) => {
15
12
  const files = parseCoverageFile(coverageFile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escover",
3
- "version": "3.4.0",
3
+ "version": "3.5.1",
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",
@@ -40,7 +40,6 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@putout/plugin-convert-optional-to-logical": "^1.0.0",
43
- "@putout/printer": "^1.80.3",
44
43
  "chalk": "^5.0.0",
45
44
  "find-cache-dir": "^4.0.0",
46
45
  "find-up": "^6.2.0",
@@ -48,7 +47,7 @@
48
47
  "montag": "^1.2.1",
49
48
  "once": "^1.4.0",
50
49
  "picomatch": "^2.3.1",
51
- "putout": "^29.0.0",
50
+ "putout": "^30.7.0",
52
51
  "strip-ansi": "^7.0.1",
53
52
  "table": "^6.8.0",
54
53
  "try-catch": "^3.0.0",
@@ -60,12 +59,12 @@
60
59
  },
61
60
  "license": "MIT",
62
61
  "devDependencies": {
63
- "@putout/test": "^6.4.0",
64
- "c8": "^7.8.0",
62
+ "@putout/test": "^7.0.1",
63
+ "c8": "^8.0.1",
65
64
  "escover": "^3.2.0",
66
65
  "eslint": "^8.3.0",
67
66
  "eslint-plugin-n": "^16.0.0",
68
- "eslint-plugin-putout": "^17.5.1",
67
+ "eslint-plugin-putout": "^18.2.0",
69
68
  "madrun": "^9.0.0",
70
69
  "supertape": "^8.0.1"
71
70
  }