escover 4.0.0 โ†’ 4.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 CHANGED
@@ -1,3 +1,18 @@
1
+ 2024.01.29, v4.1.0
2
+
3
+ feature:
4
+ - 51103b4 escover: find-up v7.0.0
5
+ - 427406f escover: c8 v9.1.0
6
+ - 0d53d2f escover: @putout/test v8.4.0
7
+ - e6fde48 escover: eslint-plugin-putout v22.3.1
8
+ - 4e58f46 escover: putout v35.0.1
9
+ - f57fb20 escover: supertape v10.0.0
10
+
11
+ 2023.12.10, v4.0.1
12
+
13
+ feature:
14
+ - 98fd927 escover: mock-import v4.0.0
15
+
1
16
  2023.12.10, v4.0.0
2
17
 
3
18
  feature:
package/README.md CHANGED
@@ -90,7 +90,7 @@ You can choose formatter with `ESCOVER_FORMAT` env variable.
90
90
 
91
91
  ## What if I want to use ๐ŸŽฉ`ESCover` with `mock-import`?
92
92
 
93
- Experimental `loaders` supports only one, for now. So [zenload](https://github.com/coderaiser/zenload) should be used.
93
+ [`mock-import`](https://github.com/coderaiser/mock-import) is used by default in ๐ŸŽฉ`ESCover`.
94
94
 
95
95
  Install it with:
96
96
 
package/lib/c4.js CHANGED
@@ -7,12 +7,11 @@ export const createFileEntry = (url) => {
7
7
  url = url.replace(/\?.*$/, '');
8
8
  let lines = __fileEntries.get(url);
9
9
 
10
- if (lines) {
10
+ if (lines)
11
11
  return {
12
12
  '๐Ÿงจ': set(lines),
13
13
  'init': noop,
14
14
  };
15
- }
16
15
 
17
16
  lines = new Map();
18
17
 
package/lib/cli/cli.js CHANGED
@@ -32,9 +32,8 @@ export const cli = ({argv, exit, readCoverage}) => {
32
32
 
33
33
  const cmd = argv.slice(2);
34
34
 
35
- if (cmd.length) {
35
+ if (cmd.length)
36
36
  execute(`"${cmd.join('" "')}"`, noop);
37
- }
38
37
 
39
38
  const coverage = readCoverage();
40
39
 
@@ -50,25 +49,17 @@ export const cli = ({argv, exit, readCoverage}) => {
50
49
 
51
50
  export const isSuccess = (error) => !error || error?.status === Number(process.env.ESCOVER_SUCCESS_EXIT_CODE);
52
51
 
53
- export function createZenload() {
54
- return {
55
- ZENLOAD: 'escover,mock-import',
56
- }
57
- }
58
-
59
52
  function execute(cmd, exit) {
60
53
  const [error] = tryCatch(execSync, cmd, {
61
54
  stdio: [0, 1, 2],
62
55
  env: {
63
- ...createZenload,
64
56
  ...process.env,
65
57
  NODE_OPTIONS: ESCOVER_NODE_OPTIONS,
66
58
  },
67
59
  });
68
60
 
69
- if (isSuccess(error)) {
61
+ if (isSuccess(error))
70
62
  return exit(0);
71
- }
72
63
 
73
64
  if (error) {
74
65
  console.error(error.message);
@@ -2,8 +2,10 @@ import {
2
2
  writeFileSync,
3
3
  readFileSync,
4
4
  } from 'node:fs';
5
- import tryCatch from 'try-catch';
6
5
  import {join} from 'node:path';
6
+
7
+ import tryCatch from 'try-catch';
8
+
7
9
  import {getFileEntries} from '../c4.js';
8
10
  import {transform} from '../transform.js';
9
11
  import {merge} from '../merge.js';
@@ -11,4 +11,3 @@ export function findCacheDir() {
11
11
 
12
12
  return name;
13
13
  }
14
-
package/lib/escover.js CHANGED
@@ -10,7 +10,6 @@ import {writeCoverage} from './coverage-file/coverage-file.js';
10
10
 
11
11
  global.__createC4 = createFileEntry;
12
12
 
13
- const port = {};
14
13
  const CWD = process.cwd();
15
14
  const {exclude} = readConfig();
16
15
 
@@ -85,4 +84,3 @@ export async function load(url, context, defaultLoad) {
85
84
  shortCircuit: true,
86
85
  };
87
86
  }
88
-
@@ -111,4 +111,3 @@ export function getLinesPercent(linesCount, uncoveredLinesCount) {
111
111
 
112
112
  return 100 - Math.round(100 / linesCount * uncoveredLinesCount);
113
113
  }
114
-
package/lib/fresh.js CHANGED
@@ -10,6 +10,7 @@ import {MessageChannel} from 'node:worker_threads';
10
10
  // between the main (application) thread and the hooks running on the hooks
11
11
  // thread, by sending `port2` to the `initialize` hook.
12
12
  const __filename = fileURLToPath(import.meta.url);
13
+
13
14
  // This example showcases how a message channel can be used to communicate
14
15
  // between the main (application) thread and the hooks running on the hooks
15
16
  // thread, by sending `port2` to the `initialize` hook.
@@ -27,4 +28,3 @@ register('./escover.js', {
27
28
  },
28
29
  transferList: [port2],
29
30
  });
30
-
@@ -44,14 +44,13 @@ const findLoc = (path) => {
44
44
  const current = path.find(isLoc);
45
45
  const {loc} = current.node;
46
46
 
47
- if (current.__escover_loc_column) {
47
+ if (current.__escover_loc_column)
48
48
  return {
49
49
  start: {
50
50
  ...loc.start,
51
51
  column: ++current.__escover_loc_column,
52
52
  },
53
53
  };
54
- }
55
54
 
56
55
  current.__escover_loc_column = 1;
57
56
 
@@ -103,12 +102,11 @@ export const fix = (path, {options}) => {
103
102
  if (path.isReturnStatement() || path.isThrowStatement())
104
103
  return addMarkToArgument(path, lineNode);
105
104
 
106
- if (path.isContinueStatement() || path.isBreakStatement()) {
105
+ if (path.isContinueStatement() || path.isBreakStatement())
107
106
  return replaceWithMultiple(path, [
108
107
  lineNode,
109
108
  path.node,
110
109
  ]);
111
- }
112
110
 
113
111
  if (path.isExpression()) {
114
112
  const {node} = path;
@@ -193,9 +191,8 @@ export const traverse = ({push}) => ({
193
191
  push(path);
194
192
  },
195
193
  SequenceExpression(path) {
196
- if (compare(path, `(${LINE}, __z)`)) {
194
+ if (compare(path, `(${LINE}, __z)`))
197
195
  return;
198
- }
199
196
 
200
197
  const expressions = path.get('expressions');
201
198
 
@@ -207,9 +204,8 @@ export const traverse = ({push}) => ({
207
204
  }
208
205
  },
209
206
  UpdateExpression(path) {
210
- if (compare(path, `(${LINE}, __z)`)) {
207
+ if (compare(path, `(${LINE}, __z)`))
211
208
  return;
212
- }
213
209
 
214
210
  push(path);
215
211
  },
@@ -226,8 +222,7 @@ export const traverse = ({push}) => ({
226
222
  if (alternatePath.isIfStatement())
227
223
  return;
228
224
 
229
- if (!alternatePath.isBlockStatement() && !isExclude(alternatePath)) {
225
+ if (!alternatePath.isBlockStatement() && !isExclude(alternatePath))
230
226
  push(alternatePath);
231
- }
232
227
  },
233
228
  });
package/lib/register.js CHANGED
@@ -1,16 +1,17 @@
1
- import {pathToFileURL} from 'node:url';
2
- import { register } from 'node:module';
3
- import { MessageChannel } from 'node:worker_threads';
1
+ import {register} from 'node:module';
2
+ import {MessageChannel} from 'node:worker_threads';
4
3
 
5
- const { port1, port2 } = new MessageChannel();
4
+ const {port1, port2} = new MessageChannel();
6
5
 
7
6
  initialize({
8
- port: port1
7
+ port: port1,
9
8
  });
10
9
 
11
10
  register('./escover.js', import.meta.url, {
12
- parentURL: import.meta.url,
13
- data: { port: port2 },
11
+ parentURL: import.meta.url,
12
+ data: {
13
+ port: port2,
14
+ },
14
15
  transferList: [port2],
15
16
  });
16
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escover",
3
- "version": "4.0.0",
3
+ "version": "4.1.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",
@@ -44,30 +44,29 @@
44
44
  "@putout/plugin-convert-optional-to-logical": "^3.1.0",
45
45
  "chalk": "^5.0.0",
46
46
  "find-cache-dir": "^5.0.0",
47
- "find-up": "^6.2.0",
48
- "mock-import": "^3.0.1",
47
+ "find-up": "^7.0.0",
48
+ "mock-import": "^4.0.0",
49
49
  "montag": "^1.2.1",
50
50
  "once": "^1.4.0",
51
51
  "picomatch": "^2.3.1",
52
- "putout": "^34.0.0",
52
+ "putout": "^35.0.1",
53
53
  "strip-ansi": "^7.0.1",
54
54
  "table": "^6.8.0",
55
55
  "try-catch": "^3.0.0",
56
- "yargs-parser": "^21.0.0",
57
- "zenload": "^2.0.0"
56
+ "yargs-parser": "^21.0.0"
58
57
  },
59
58
  "engines": {
60
59
  "node": ">=18"
61
60
  },
62
61
  "license": "MIT",
63
62
  "devDependencies": {
64
- "@putout/test": "^7.0.1",
65
- "c8": "^8.0.1",
66
- "escover": "^3.2.0",
63
+ "@putout/test": "^8.4.0",
64
+ "c8": "^9.1.0",
65
+ "escover": "file:.",
67
66
  "eslint": "^8.3.0",
68
67
  "eslint-plugin-n": "^16.0.0",
69
- "eslint-plugin-putout": "^21.0.2",
68
+ "eslint-plugin-putout": "^22.3.1",
70
69
  "madrun": "^10.0.0",
71
- "supertape": "^8.0.1"
70
+ "supertape": "^10.0.0"
72
71
  }
73
72
  }