@putout/test 5.13.0 → 6.0.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 +4 -0
- package/lib/processor/index.js +4 -1
- package/lib/test.js +9 -5
- package/package.json +1 -2
package/lib/is-correct-plugin.js
CHANGED
|
@@ -10,6 +10,7 @@ module.exports = (plugin) => {
|
|
|
10
10
|
include,
|
|
11
11
|
exclude,
|
|
12
12
|
replace,
|
|
13
|
+
declare,
|
|
13
14
|
} = plugin;
|
|
14
15
|
|
|
15
16
|
const isFix = isFn(fix);
|
|
@@ -18,6 +19,9 @@ module.exports = (plugin) => {
|
|
|
18
19
|
if (isReplace)
|
|
19
20
|
return true;
|
|
20
21
|
|
|
22
|
+
if (isFn(declare))
|
|
23
|
+
return true;
|
|
24
|
+
|
|
21
25
|
if (!isFix)
|
|
22
26
|
return false;
|
|
23
27
|
|
package/lib/processor/index.js
CHANGED
|
@@ -55,6 +55,9 @@ const createProcess = (dir, options) => (operator) => async (filename, plugins,
|
|
|
55
55
|
}),
|
|
56
56
|
);
|
|
57
57
|
|
|
58
|
+
if (isUpdate())
|
|
59
|
+
return operator.pass('fixtures updated');
|
|
60
|
+
|
|
58
61
|
return operator.equal(processedSource, output, 'fixtures should equal');
|
|
59
62
|
};
|
|
60
63
|
|
|
@@ -120,7 +123,7 @@ async function process(filename, dir, {processors, plugins, extension, fix = tru
|
|
|
120
123
|
processorRunners,
|
|
121
124
|
});
|
|
122
125
|
|
|
123
|
-
if (isUpdate() && !noChange)
|
|
126
|
+
if (isUpdate() && !noChange && fix)
|
|
124
127
|
await update(outputName, processedSource);
|
|
125
128
|
|
|
126
129
|
return {
|
package/lib/test.js
CHANGED
|
@@ -438,6 +438,7 @@ function preTest(test, plugin) {
|
|
|
438
438
|
replace,
|
|
439
439
|
filter,
|
|
440
440
|
match,
|
|
441
|
+
declare,
|
|
441
442
|
}] = entries(plugin).pop();
|
|
442
443
|
|
|
443
444
|
const options = {
|
|
@@ -461,10 +462,11 @@ function preTest(test, plugin) {
|
|
|
461
462
|
return;
|
|
462
463
|
}
|
|
463
464
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
465
|
+
if (!declare)
|
|
466
|
+
test(`${name}: report: is function`, (t) => {
|
|
467
|
+
t.equal(typeof report, 'function', 'should export "report" function');
|
|
468
|
+
t.end();
|
|
469
|
+
}, options);
|
|
468
470
|
|
|
469
471
|
test(`${name}: plugins should be of type: replace, template, traverse or find`, (t) => {
|
|
470
472
|
const result = isCorrectPlugin({
|
|
@@ -479,9 +481,11 @@ function preTest(test, plugin) {
|
|
|
479
481
|
filter,
|
|
480
482
|
match,
|
|
481
483
|
replace,
|
|
484
|
+
|
|
485
|
+
declare,
|
|
482
486
|
});
|
|
483
487
|
|
|
484
|
-
t.ok(result, 'should export "replace", "find", "traverse", "include", "exclude" function');
|
|
488
|
+
t.ok(result, 'should export "replace", "find", "traverse", "include", "exclude", or "declare" function');
|
|
485
489
|
t.end();
|
|
486
490
|
}, options);
|
|
487
491
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/test",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "Test runner for 🐊Putout plugins ",
|
|
7
7
|
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/test#readme",
|
|
8
8
|
"main": "lib/test.js",
|
|
9
|
-
"commitType": "colon",
|
|
10
9
|
"bin": {
|
|
11
10
|
"tape": "bin/test.mjs"
|
|
12
11
|
},
|