@putout/test 14.1.0 → 14.3.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/eslint/eslint.mjs +3 -3
- package/lib/fixture.js +6 -6
- package/lib/format/index.js +4 -3
- package/lib/processor/index.js +5 -5
- package/lib/test.js +2 -2
- package/package.json +8 -9
package/lib/eslint/eslint.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
basename,
|
|
11
11
|
} from 'node:path';
|
|
12
12
|
import process from 'node:process';
|
|
13
|
-
import eslint from '@putout/eslint';
|
|
13
|
+
import {eslint} from '@putout/eslint';
|
|
14
14
|
import tryToCatch from 'try-to-catch';
|
|
15
15
|
import {extend} from 'supertape';
|
|
16
16
|
import {lint} from '@putout/eslint/lint';
|
|
@@ -22,7 +22,7 @@ const {isArray} = Array;
|
|
|
22
22
|
const isUpdate = () => process.env.UPDATE === '1';
|
|
23
23
|
|
|
24
24
|
const update = (name, data) => {
|
|
25
|
-
const fn =
|
|
25
|
+
const fn = globalThis.writeFileSync || writeFileSync;
|
|
26
26
|
fn(name, data);
|
|
27
27
|
};
|
|
28
28
|
|
|
@@ -31,7 +31,7 @@ const remove = (name) => {
|
|
|
31
31
|
const base = basename(name, ext);
|
|
32
32
|
const fixtureName = name.replace(base, `${base}-fix`);
|
|
33
33
|
|
|
34
|
-
const fn =
|
|
34
|
+
const fn = globalThis.unlinkSync || unlinkSync;
|
|
35
35
|
|
|
36
36
|
tryCatch(fn, String(fixtureName));
|
|
37
37
|
};
|
package/lib/fixture.js
CHANGED
|
@@ -10,7 +10,7 @@ const TS = {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
module.exports.readFixture = (name, extension) => {
|
|
13
|
-
const {readFileSync} =
|
|
13
|
+
const {readFileSync} = globalThis.__putout_test_fs;
|
|
14
14
|
const [eTS, dataTS] = tryCatch(readFileSync, `${name}.ts`, 'utf8');
|
|
15
15
|
|
|
16
16
|
if (!eTS)
|
|
@@ -44,27 +44,27 @@ module.exports.readFixture = (name, extension) => {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
module.exports.writeFixFixture = ({full, code, extension}) => {
|
|
47
|
-
const {writeFileSync} =
|
|
47
|
+
const {writeFileSync} = globalThis.__putout_test_fs;
|
|
48
48
|
writeFileSync(`${full}-fix.${extension}`, code);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
module.exports.writeFormatFixture = (full, code) => {
|
|
52
|
-
const {writeFileSync} =
|
|
52
|
+
const {writeFileSync} = globalThis.__putout_test_fs;
|
|
53
53
|
writeFileSync(`${full}-format`, code);
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
module.exports.readFormatFixture = (full) => {
|
|
57
|
-
const {readFileSync} =
|
|
57
|
+
const {readFileSync} = globalThis.__putout_test_fs;
|
|
58
58
|
return readFileSync(`${full}-format`, 'utf8');
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
module.exports.writeFixture = ({full, code, extension}) => {
|
|
62
|
-
const {writeFileSync} =
|
|
62
|
+
const {writeFileSync} = globalThis.__putout_test_fs;
|
|
63
63
|
writeFileSync(`${full}.${extension}`, code);
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
module.exports.rmFixture = (name, extension) => {
|
|
67
|
-
const {unlinkSync} =
|
|
67
|
+
const {unlinkSync} = globalThis.__putout_test_fs;
|
|
68
68
|
|
|
69
69
|
if (!isUpdate())
|
|
70
70
|
return;
|
package/lib/format/index.js
CHANGED
|
@@ -5,6 +5,7 @@ const {join} = require('node:path');
|
|
|
5
5
|
|
|
6
6
|
const putout = require('putout');
|
|
7
7
|
const currify = require('currify');
|
|
8
|
+
const {initReport} = require('@putout/engine-reporter/report');
|
|
8
9
|
|
|
9
10
|
const {
|
|
10
11
|
readFixture,
|
|
@@ -25,7 +26,7 @@ module.exports.format = currify((dir, options, t) => async (formatter, name, for
|
|
|
25
26
|
...options,
|
|
26
27
|
});
|
|
27
28
|
|
|
28
|
-
const report =
|
|
29
|
+
const report = initReport();
|
|
29
30
|
|
|
30
31
|
const result = await report(formatter, {
|
|
31
32
|
formatterOptions,
|
|
@@ -55,7 +56,7 @@ module.exports.noFormat = currify((dir, options, t) => async (formatter, name, f
|
|
|
55
56
|
const [input] = readFixture(full);
|
|
56
57
|
const {places} = putout(input, options);
|
|
57
58
|
|
|
58
|
-
const report =
|
|
59
|
+
const report = initReport();
|
|
59
60
|
|
|
60
61
|
const result = await report(formatter, {
|
|
61
62
|
name,
|
|
@@ -83,7 +84,7 @@ module.exports.formatMany = currify((dir, options, t) => async (formatter, names
|
|
|
83
84
|
let result = '';
|
|
84
85
|
|
|
85
86
|
const count = names.length;
|
|
86
|
-
const report =
|
|
87
|
+
const report = initReport();
|
|
87
88
|
|
|
88
89
|
for (let index = 0; index < count; index++) {
|
|
89
90
|
const name = names[index];
|
package/lib/processor/index.js
CHANGED
|
@@ -19,20 +19,20 @@ const processFile = require('@putout/cli-process-file');
|
|
|
19
19
|
const {runProcessors} = require('@putout/engine-processor');
|
|
20
20
|
|
|
21
21
|
const isStr = (a) => typeof a === 'string';
|
|
22
|
-
const isUpdate = () => Number(
|
|
22
|
+
const isUpdate = () => Number(globalThis.process.env.UPDATE);
|
|
23
23
|
|
|
24
24
|
const update = async (a, b) => {
|
|
25
|
-
const write =
|
|
25
|
+
const write = globalThis.writeFile || writeFile;
|
|
26
26
|
await write(a, b);
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
const remove = async (a) => {
|
|
30
|
-
const remove =
|
|
30
|
+
const remove = globalThis.unlink || unlink;
|
|
31
31
|
await tryToCatch(remove, a);
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const read = async (a, b) => {
|
|
35
|
-
const read =
|
|
35
|
+
const read = globalThis.readFile || readFile;
|
|
36
36
|
return await read(a, b);
|
|
37
37
|
};
|
|
38
38
|
|
|
@@ -47,7 +47,7 @@ const addDot = (a) => a ? `.${a}` : '';
|
|
|
47
47
|
const fail = (t, message) => {
|
|
48
48
|
const {
|
|
49
49
|
__putout_test_fail = t.fail,
|
|
50
|
-
} =
|
|
50
|
+
} = globalThis;
|
|
51
51
|
|
|
52
52
|
return __putout_test_fail(message);
|
|
53
53
|
};
|
package/lib/test.js
CHANGED
|
@@ -38,7 +38,7 @@ const isObject = (a) => typeof a === 'object';
|
|
|
38
38
|
|
|
39
39
|
const {keys} = Object;
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
globalThis.__putout_test_fs = {
|
|
42
42
|
readFileSync,
|
|
43
43
|
writeFileSync,
|
|
44
44
|
existsSync,
|
|
@@ -50,7 +50,7 @@ const isUpdate = () => Boolean(Number(process.env.UPDATE));
|
|
|
50
50
|
const fail = (t, message) => {
|
|
51
51
|
const {
|
|
52
52
|
__putout_test_fail = t.fail,
|
|
53
|
-
} =
|
|
53
|
+
} = globalThis;
|
|
54
54
|
|
|
55
55
|
return __putout_test_fail(message);
|
|
56
56
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/test",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.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 ",
|
|
@@ -40,8 +40,9 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@putout/cli-process-file": "^4.0.0",
|
|
42
42
|
"@putout/engine-processor": "*",
|
|
43
|
+
"@putout/engine-reporter": "^8.0.1",
|
|
43
44
|
"@putout/engine-runner": "*",
|
|
44
|
-
"@putout/eslint": "^
|
|
45
|
+
"@putout/eslint": "^5.0.0",
|
|
45
46
|
"@putout/plugin-filesystem": "*",
|
|
46
47
|
"currify": "^4.0.0",
|
|
47
48
|
"montag": "^1.2.1",
|
|
@@ -61,20 +62,18 @@
|
|
|
61
62
|
"@putout/eslint-flat": "^3.0.0",
|
|
62
63
|
"@putout/formatter-dump": "*",
|
|
63
64
|
"@putout/formatter-progress": "*",
|
|
65
|
+
"@putout/plugin-destructuring": "*",
|
|
64
66
|
"@putout/plugin-esm": "*",
|
|
65
|
-
"@putout/plugin-extract-object-properties": "*",
|
|
66
67
|
"@putout/plugin-putout": "*",
|
|
67
68
|
"@putout/plugin-remove-console": "*",
|
|
68
|
-
"@putout/plugin-
|
|
69
|
+
"@putout/plugin-variables": "*",
|
|
69
70
|
"@putout/processor-wasm": "*",
|
|
70
71
|
"c8": "^10.0.0",
|
|
71
|
-
"eslint": "^
|
|
72
|
+
"eslint": "^10.0.0-alpha.0",
|
|
72
73
|
"eslint-plugin-n": "^17.0.0",
|
|
73
|
-
"eslint-plugin-putout": "^
|
|
74
|
+
"eslint-plugin-putout": "^29.0.0",
|
|
74
75
|
"madrun": "^11.0.0",
|
|
75
|
-
"
|
|
76
|
-
"nodemon": "^3.0.1",
|
|
77
|
-
"strip-ansi": "^7.1.0"
|
|
76
|
+
"nodemon": "^3.0.1"
|
|
78
77
|
},
|
|
79
78
|
"license": "MIT",
|
|
80
79
|
"engines": {
|