@putout/test 10.0.0 → 11.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 +5 -13
- package/lib/eslint/eslint.mjs +1 -1
- package/lib/test.js +8 -9
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -21,14 +21,6 @@ Set environment variable `UPDATE=1` to update `transform` and `format` fixtures
|
|
|
21
21
|
UPDATE=1 tape test/*.js
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
## Printer
|
|
25
|
-
|
|
26
|
-
You can override default printer (`recast`) with [`putout`](https://github.com/putoutjs/printer) or `babel` using:
|
|
27
|
-
|
|
28
|
-
```sh
|
|
29
|
-
PUTOUT_PRINTER=putout tape test/*.js
|
|
30
|
-
```
|
|
31
|
-
|
|
32
24
|
## Plugins API
|
|
33
25
|
|
|
34
26
|
🐊**Putout** can be used in all IDE's supported by`ESLint` as [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/packages/eslint-plugin-putout).
|
|
@@ -61,7 +53,7 @@ const test = createTest(import.meta.url, {
|
|
|
61
53
|
Check error message (or messages) of a plugin:
|
|
62
54
|
|
|
63
55
|
```js
|
|
64
|
-
test('remove
|
|
56
|
+
test('remove useless variables: for-of', (t) => {
|
|
65
57
|
t.report('dot', 'Dot files should be added to .gitignore');
|
|
66
58
|
t.end();
|
|
67
59
|
});
|
|
@@ -70,7 +62,7 @@ test('remove usless variables: for-of', (t) => {
|
|
|
70
62
|
When you want to check that report called exact count of times pass an array of messages:
|
|
71
63
|
|
|
72
64
|
```js
|
|
73
|
-
test('remove
|
|
65
|
+
test('remove useless variables: for-of', (t) => {
|
|
74
66
|
t.report('dot', ['Dot files should be added to .gitignore']);
|
|
75
67
|
t.end();
|
|
76
68
|
});
|
|
@@ -92,7 +84,7 @@ test('remove debugger: report', (t) => {
|
|
|
92
84
|
Check transform of `filename.js` -> `filename-fix.js` in `test/fixtures` directory:
|
|
93
85
|
|
|
94
86
|
```js
|
|
95
|
-
test('remove
|
|
87
|
+
test('remove useless variables: for-of', (t) => {
|
|
96
88
|
t.transform('array-from', {
|
|
97
89
|
'remove-useless-array-from': removeUselessArrayFrom,
|
|
98
90
|
});
|
|
@@ -236,7 +228,7 @@ test('plugin-apply-numeric-separators: no transform: hex', (t) => {
|
|
|
236
228
|
Check progress of `filename.js`;
|
|
237
229
|
|
|
238
230
|
```js
|
|
239
|
-
test('remove
|
|
231
|
+
test('remove useless variables: for-of', async ({progress}) => {
|
|
240
232
|
await progress('progress', {
|
|
241
233
|
i: 0,
|
|
242
234
|
n: 2,
|
|
@@ -250,7 +242,7 @@ test('remove usless variables: for-of', async ({progress}) => {
|
|
|
250
242
|
Check progress of `filename.js`;
|
|
251
243
|
|
|
252
244
|
```js
|
|
253
|
-
test('remove
|
|
245
|
+
test('remove useless variables: for-of', async ({progressWithOptions}) => {
|
|
254
246
|
const options = {
|
|
255
247
|
from: '/home/coderaiser',
|
|
256
248
|
to: '/',
|
package/lib/eslint/eslint.mjs
CHANGED
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
extname,
|
|
10
10
|
basename,
|
|
11
11
|
} from 'node:path';
|
|
12
|
+
import process from 'node:process';
|
|
12
13
|
import eslint from '@putout/eslint';
|
|
13
14
|
import tryToCatch from 'try-to-catch';
|
|
14
15
|
import {extend} from 'supertape';
|
|
15
16
|
import {lint} from '@putout/eslint/lint';
|
|
16
17
|
import tryCatch from 'try-catch';
|
|
17
|
-
import process from 'node:process';
|
|
18
18
|
|
|
19
19
|
const {keys} = Object;
|
|
20
20
|
const {isArray} = Array;
|
package/lib/test.js
CHANGED
|
@@ -34,7 +34,6 @@ global.__putout_test_fs = {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
const isUpdate = () => Boolean(Number(process.env.UPDATE));
|
|
37
|
-
const getPrinter = () => process.env.PUTOUT_PRINTER;
|
|
38
37
|
|
|
39
38
|
const fail = (t, message) => {
|
|
40
39
|
const {__putout_test_fail = t.fail} = global;
|
|
@@ -293,7 +292,6 @@ const progress = (dir, options) => (t) => async (name, expected) => {
|
|
|
293
292
|
once(progress, 'file'),
|
|
294
293
|
putout(input, {
|
|
295
294
|
progress,
|
|
296
|
-
printer: getPrinter(),
|
|
297
295
|
isTS,
|
|
298
296
|
...options,
|
|
299
297
|
}),
|
|
@@ -318,7 +316,6 @@ const progressWithOptions = (dir, options) => (t) => async (name, pluginOptions,
|
|
|
318
316
|
putout(input, {
|
|
319
317
|
rules,
|
|
320
318
|
progress,
|
|
321
|
-
printer: getPrinter(),
|
|
322
319
|
isTS,
|
|
323
320
|
...options,
|
|
324
321
|
}),
|
|
@@ -340,7 +337,6 @@ const transform = currify((dir, options, t, name, transformed = null, addons = {
|
|
|
340
337
|
addons = addons || {};
|
|
341
338
|
|
|
342
339
|
const {code} = putout(input, {
|
|
343
|
-
printer: getPrinter(),
|
|
344
340
|
isTS,
|
|
345
341
|
...options,
|
|
346
342
|
plugins: [{
|
|
@@ -378,7 +374,6 @@ const transformWithOptions = currify((dir, options, t, name, pluginOptions) => {
|
|
|
378
374
|
};
|
|
379
375
|
|
|
380
376
|
const {code} = putout(input, {
|
|
381
|
-
printer: getPrinter(),
|
|
382
377
|
isTS,
|
|
383
378
|
rules,
|
|
384
379
|
...options,
|
|
@@ -440,7 +435,6 @@ const noTransform = currify((dir, options, t, name, addons = {}) => {
|
|
|
440
435
|
const [input, isTS] = readFixture(full);
|
|
441
436
|
|
|
442
437
|
const {code} = putout(input, {
|
|
443
|
-
printer: getPrinter(),
|
|
444
438
|
isTS,
|
|
445
439
|
...options,
|
|
446
440
|
plugins: [{
|
|
@@ -504,14 +498,14 @@ const noReport = currify((dir, options, t, name) => {
|
|
|
504
498
|
|
|
505
499
|
module.exports._createNoReport = noReport;
|
|
506
500
|
|
|
507
|
-
const noReportAfterTransform = currify((dir, options, t, name) => {
|
|
501
|
+
const noReportAfterTransform = currify((dir, options, t, name, addons = {}) => {
|
|
508
502
|
const full = join(dir, name);
|
|
509
503
|
const [source, isTS] = readFixture(full);
|
|
510
504
|
|
|
511
505
|
return noReportCodeAfterTransform({
|
|
512
506
|
isTS,
|
|
513
507
|
...options,
|
|
514
|
-
}, t, source);
|
|
508
|
+
}, t, source, addons);
|
|
515
509
|
});
|
|
516
510
|
|
|
517
511
|
module.exports._createNoReportAfterTransform = noReportAfterTransform;
|
|
@@ -595,10 +589,15 @@ const noReportCode = currify((options, t, source) => {
|
|
|
595
589
|
return t.deepEqual(places, [], 'should not report');
|
|
596
590
|
});
|
|
597
591
|
|
|
598
|
-
const noReportCodeAfterTransform = currify((options, t, source) => {
|
|
592
|
+
const noReportCodeAfterTransform = currify((options, t, source, addons = {}) => {
|
|
593
|
+
const {plugins} = options;
|
|
599
594
|
const {places} = putout(source, {
|
|
600
595
|
fix: true,
|
|
601
596
|
...options,
|
|
597
|
+
plugins: [{
|
|
598
|
+
...toObject(plugins),
|
|
599
|
+
...addons,
|
|
600
|
+
}],
|
|
602
601
|
});
|
|
603
602
|
|
|
604
603
|
return t.deepEqual(places, [], 'should not report after transform');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/test",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.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 ",
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"require": "./lib/processor/index.js",
|
|
19
19
|
"import": "./lib/processor/index.mjs"
|
|
20
20
|
},
|
|
21
|
-
"./formatter": "./lib/formatter/index.mjs",
|
|
22
21
|
"./eslint": "./lib/eslint/eslint.mjs"
|
|
23
22
|
},
|
|
24
23
|
"release": false,
|
|
@@ -26,7 +25,7 @@
|
|
|
26
25
|
"changelog": false,
|
|
27
26
|
"repository": {
|
|
28
27
|
"type": "git",
|
|
29
|
-
"url": "git://github.com/coderaiser/putout.git"
|
|
28
|
+
"url": "git+https://github.com/coderaiser/putout.git"
|
|
30
29
|
},
|
|
31
30
|
"scripts": {
|
|
32
31
|
"test": "madrun test",
|
|
@@ -65,10 +64,10 @@
|
|
|
65
64
|
"@putout/plugin-remove-console": "*",
|
|
66
65
|
"@putout/plugin-remove-empty": "*",
|
|
67
66
|
"@putout/plugin-remove-unused-variables": "*",
|
|
68
|
-
"c8": "^
|
|
67
|
+
"c8": "^10.0.0",
|
|
69
68
|
"eslint": "^9.0.0",
|
|
70
69
|
"eslint-plugin-n": "^17.0.0",
|
|
71
|
-
"eslint-plugin-putout": "^
|
|
70
|
+
"eslint-plugin-putout": "^23.0.0",
|
|
72
71
|
"lerna": "^6.0.1",
|
|
73
72
|
"madrun": "^10.0.0",
|
|
74
73
|
"mock-require": "^3.0.3",
|