@putout/test 15.8.1 → 15.9.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/lib/is-correct-plugin.js +10 -1
- package/lib/pre-test.js +4 -2
- package/lib/test.js +2 -2
- package/package.json +2 -2
package/lib/is-correct-plugin.js
CHANGED
|
@@ -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
|
-
|
|
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),
|
|
@@ -199,7 +199,7 @@ const transform = currify((dir, linterOptions, options, t, name, transformed = n
|
|
|
199
199
|
return t.pass('fixed fixture updated');
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
const [output] = isStr ? [transformed] : readFixture(`${full}-fix`,
|
|
202
|
+
const [output] = isStr ? [transformed] : readFixture(`${full}-fix`, currentExtension);
|
|
203
203
|
|
|
204
204
|
return t.equal(code, output);
|
|
205
205
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/test",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.9.0",
|
|
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": "^
|
|
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",
|