@putout/test 12.0.0 → 12.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/README.md +2 -2
- package/lib/test.js +20 -7
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ const test = createTest(import.meta.url, {
|
|
|
58
58
|
});
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
### `report(filename, message: string | string[])`
|
|
61
|
+
### `report(filename, message: string | string[], plugins?: PutoutPlugin[])`
|
|
62
62
|
|
|
63
63
|
Check error message (or messages) of a plugin:
|
|
64
64
|
|
|
@@ -78,7 +78,7 @@ test('remove useless variables: dot', (t) => {
|
|
|
78
78
|
});
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
### `reportCode(input, message)`
|
|
81
|
+
### `reportCode(input: string, message: string | string[], plugins?: PutoutPlugins)`
|
|
82
82
|
|
|
83
83
|
Check error message of a plugin from `input` code:
|
|
84
84
|
|
package/lib/test.js
CHANGED
|
@@ -473,16 +473,20 @@ const noTransformCode = currify((lint, options, t, input) => {
|
|
|
473
473
|
|
|
474
474
|
const getMessage = ({message}) => message;
|
|
475
475
|
|
|
476
|
-
const report = (dir, lint, options) => (t) => (name, message) => {
|
|
476
|
+
const report = (dir, lint, options) => (t) => (name, message, plugins) => {
|
|
477
477
|
checkReport(name, message);
|
|
478
478
|
|
|
479
479
|
const full = join(dir, name);
|
|
480
480
|
const [source, isTS] = readFixture(full);
|
|
481
481
|
|
|
482
|
-
|
|
482
|
+
const addT = reportCode(lint, {
|
|
483
483
|
isTS,
|
|
484
484
|
...options,
|
|
485
|
-
}
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
const run = addT(t);
|
|
488
|
+
|
|
489
|
+
return run(source, message, plugins);
|
|
486
490
|
};
|
|
487
491
|
|
|
488
492
|
const noReport = currify((dir, lint, options, t, name) => {
|
|
@@ -542,11 +546,15 @@ const reportWithOptions = currify((dir, lint, options, t, name, message, ruleOpt
|
|
|
542
546
|
[rule]: ['on', ruleOptions],
|
|
543
547
|
};
|
|
544
548
|
|
|
545
|
-
|
|
549
|
+
const addT = reportCode(lint, {
|
|
546
550
|
...options,
|
|
547
551
|
rules,
|
|
548
552
|
isTS,
|
|
549
|
-
}
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
const run = addT(t);
|
|
556
|
+
|
|
557
|
+
return run(source, message);
|
|
550
558
|
});
|
|
551
559
|
|
|
552
560
|
const noReportWithOptions = currify((dir, lint, options, t, name, ruleOptions) => {
|
|
@@ -567,10 +575,15 @@ const noReportWithOptions = currify((dir, lint, options, t, name, ruleOptions) =
|
|
|
567
575
|
}, t, source);
|
|
568
576
|
});
|
|
569
577
|
|
|
570
|
-
const reportCode =
|
|
578
|
+
const reportCode = (lint, options) => (t) => (source, message, addons) => {
|
|
579
|
+
const {plugins} = options;
|
|
571
580
|
const {places} = lint(source, {
|
|
572
581
|
fix: false,
|
|
573
582
|
...options,
|
|
583
|
+
plugins: [{
|
|
584
|
+
...toObject(plugins),
|
|
585
|
+
...addons,
|
|
586
|
+
}],
|
|
574
587
|
});
|
|
575
588
|
|
|
576
589
|
const resultMessages = places.map(getMessage);
|
|
@@ -579,7 +592,7 @@ const reportCode = currify((lint, options, t, source, message) => {
|
|
|
579
592
|
return t.deepEqual(resultMessages, message);
|
|
580
593
|
|
|
581
594
|
return t.equal(resultMessages[0], message);
|
|
582
|
-
}
|
|
595
|
+
};
|
|
583
596
|
|
|
584
597
|
const noReportCode = currify((lint, options, t, source) => {
|
|
585
598
|
const {places} = lint(source, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/test",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.1.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 ",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@putout/cli-process-file": "^2.0.1",
|
|
42
42
|
"@putout/engine-processor": "*",
|
|
43
43
|
"@putout/engine-runner": "*",
|
|
44
|
-
"@putout/eslint": "^
|
|
44
|
+
"@putout/eslint": "^4.0.0",
|
|
45
45
|
"@putout/plugin-filesystem": "*",
|
|
46
46
|
"currify": "^4.0.0",
|
|
47
47
|
"montag": "^1.2.1",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"c8": "^10.0.0",
|
|
70
70
|
"eslint": "^9.0.0",
|
|
71
71
|
"eslint-plugin-n": "^17.0.0",
|
|
72
|
-
"eslint-plugin-putout": "^
|
|
72
|
+
"eslint-plugin-putout": "^25.0.1",
|
|
73
73
|
"madrun": "^10.0.0",
|
|
74
74
|
"mock-require": "^3.0.3",
|
|
75
75
|
"nodemon": "^3.0.1",
|