@putout/test 15.8.2 → 15.9.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/bin/test.js CHANGED
@@ -1,7 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import 'supertape/bin/supertape';
3
+ import process from 'node:process';
4
4
  import {callWhenTestsEnds} from 'supertape';
5
5
  import {whenTestsEnds} from '@putout/printer/type-checker/when-tests-ends';
6
6
 
7
+ const {PUTOUT_INSTRUMENT} = process.env;
8
+
7
9
  callWhenTestsEnds('PUTOUT_INSTRUMENT', whenTestsEnds);
10
+
11
+ // coverage of type checkers lives in the thread that creates them,
12
+
13
+ // so tests must run in the same thread as the report
14
+ if (PUTOUT_INSTRUMENT)
15
+ process.argv.push('--no-worker');
16
+
17
+ await import('supertape/bin/supertape');
@@ -2,7 +2,10 @@ const isFn = (a) => typeof a === 'function';
2
2
 
3
3
  export const getIsCorrectPluginMessage = () => `should export 'replace', 'find', 'traverse', 'include', 'exclude', 'declare' or 'scan' function`;
4
4
 
5
- export const isCorrectPlugin = (plugin) => {
5
+ const {keys} = Object;
6
+ const has = (a, b) => new Set(a).intersection(new Set(b)).size;
7
+
8
+ export const isCorrectPlugin = (plugin, runners = {}) => {
6
9
  const {
7
10
  find,
8
11
  fix,
@@ -14,6 +17,12 @@ export const isCorrectPlugin = (plugin) => {
14
17
  scan,
15
18
  } = plugin;
16
19
 
20
+ const runnersKeys = keys(runners);
21
+ const pluginKeys = keys(plugin);
22
+
23
+ if (runnersKeys && has(pluginKeys, runnersKeys))
24
+ return true;
25
+
17
26
  const isFix = isFn(fix);
18
27
  const isReplace = isFn(replace);
19
28
 
package/lib/pre-test.js CHANGED
@@ -12,7 +12,7 @@ const maybeEntries = (a) => isArray(a) ? a : entries(a).pop();
12
12
  export const _maybeEntries = maybeEntries;
13
13
  export const _maybeTuple = maybeTuple;
14
14
 
15
- export function preTest(test, plugin) {
15
+ export function preTest(test, plugin, runners) {
16
16
  const [name, {
17
17
  report,
18
18
  find,
@@ -26,6 +26,7 @@ export function preTest(test, plugin) {
26
26
  match,
27
27
  declare,
28
28
  scan,
29
+ ...other
29
30
  }] = maybeEntries(plugin);
30
31
 
31
32
  isArray(plugin);
@@ -75,7 +76,8 @@ export function preTest(test, plugin) {
75
76
 
76
77
  declare,
77
78
  scan,
78
- });
79
+ ...other,
80
+ }, runners);
79
81
 
80
82
  t.ok(result, getIsCorrectPluginMessage());
81
83
  t.end();
package/lib/test.js CHANGED
@@ -75,7 +75,7 @@ export function createTest(url, maybeOptions, maybeExtends = {}) {
75
75
  extensionFix,
76
76
  };
77
77
 
78
- preTest(test, plugin);
78
+ preTest(test, plugin, options.runners);
79
79
 
80
80
  return test.extend({
81
81
  transform: transform(dir, linterOptions, options),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/test",
3
- "version": "15.8.2",
3
+ "version": "15.9.1",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Test runner for 🐊Putout plugins ",
@@ -70,7 +70,7 @@
70
70
  "@putout/plugin-remove-console": "*",
71
71
  "@putout/plugin-variables": "*",
72
72
  "@putout/processor-wasm": "*",
73
- "check-dts": "^1.0.0",
73
+ "check-dts": "^2.0.0",
74
74
  "eslint": "^10.0.0",
75
75
  "eslint-plugin-putout": "^31.0.0",
76
76
  "madrun": "^13.0.0",