@putout/test 6.5.0 → 7.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/processor/index.js +2 -1
- package/lib/test.js +14 -11
- package/package.json +3 -3
package/lib/processor/index.js
CHANGED
|
@@ -98,7 +98,7 @@ const createComparePlaces = (dir, options) => (operator) => async (filename, exp
|
|
|
98
98
|
|
|
99
99
|
module.exports._createComparePlaces = createComparePlaces;
|
|
100
100
|
|
|
101
|
-
async function process(filename, dir, {processors, plugins, extension, fix = true, noChange = false, processorRunners}) {
|
|
101
|
+
async function process(filename, dir, {printer, processors, plugins, extension, fix = true, noChange = false, processorRunners}) {
|
|
102
102
|
extension = addDot(extname(filename).slice(1) || extension);
|
|
103
103
|
filename = basename(filename, String(extension));
|
|
104
104
|
|
|
@@ -121,6 +121,7 @@ async function process(filename, dir, {processors, plugins, extension, fix = tru
|
|
|
121
121
|
fix,
|
|
122
122
|
name: inputName,
|
|
123
123
|
processFile: processFile({
|
|
124
|
+
printer,
|
|
124
125
|
fix,
|
|
125
126
|
}),
|
|
126
127
|
options,
|
package/lib/test.js
CHANGED
|
@@ -90,8 +90,6 @@ const parsePlugin = (plugins) => {
|
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
function createTest(dir, maybeOptions) {
|
|
93
|
-
const update = isUpdate();
|
|
94
|
-
|
|
95
93
|
dir = join(dir, 'fixture');
|
|
96
94
|
|
|
97
95
|
const options = parseOptions(maybeOptions);
|
|
@@ -113,12 +111,9 @@ function createTest(dir, maybeOptions) {
|
|
|
113
111
|
noReportAfterTransform: noReportAfterTransform(dir, options),
|
|
114
112
|
reportWithOptions: reportWithOptions(dir, options),
|
|
115
113
|
noReportWithOptions: noReportWithOptions(dir, options),
|
|
116
|
-
reportCode: reportCode(options),
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
format: update ? formatSave : format(dir, options),
|
|
120
|
-
formatManySave: formatManySave(dir, options),
|
|
121
|
-
formatMany: update ? formatManySave : formatMany(dir, options),
|
|
114
|
+
reportCode: reportCode(options), //formatSave: formatSave(dir, options),
|
|
115
|
+
format: formatSave(dir, options), //formatManySave: formatManySave(dir, options),
|
|
116
|
+
formatMany: formatManySave(dir, options),
|
|
122
117
|
noFormat: noFormat(dir, options),
|
|
123
118
|
});
|
|
124
119
|
}
|
|
@@ -221,10 +216,15 @@ const formatMany = currify((dir, options, t) => async (formatter, names, formatt
|
|
|
221
216
|
});
|
|
222
217
|
|
|
223
218
|
const formatManySave = currify((dir, options, t) => async (formatter, names, options = {}) => {
|
|
219
|
+
const runFormat = await formatMany(dir, options, t);
|
|
220
|
+
|
|
221
|
+
if (!isUpdate())
|
|
222
|
+
return await runFormat(formatter, names, options);
|
|
223
|
+
|
|
224
224
|
const {existsSync, writeFileSync} = global.__putout_test_fs;
|
|
225
225
|
|
|
226
226
|
if (!isArray(names))
|
|
227
|
-
throw Error(`☝️ Looks like '
|
|
227
|
+
throw Error(`☝️ Looks like 'formatMany()' received 'names' with type: '${typeof names}', expected: 'array'`);
|
|
228
228
|
|
|
229
229
|
const name = `${names.join('-')}-format.js`;
|
|
230
230
|
const outputName = join(dir, name);
|
|
@@ -232,7 +232,6 @@ const formatManySave = currify((dir, options, t) => async (formatter, names, opt
|
|
|
232
232
|
if (!existsSync(outputName))
|
|
233
233
|
writeFileSync(outputName, '');
|
|
234
234
|
|
|
235
|
-
const runFormat = await formatMany(dir, options, t);
|
|
236
235
|
const {result} = await runFormat(formatter, names, options);
|
|
237
236
|
|
|
238
237
|
writeFileSync(outputName, result);
|
|
@@ -241,6 +240,11 @@ const formatManySave = currify((dir, options, t) => async (formatter, names, opt
|
|
|
241
240
|
});
|
|
242
241
|
|
|
243
242
|
const formatSave = currify((dir, options, t) => async (formatter, name, options = {}) => {
|
|
243
|
+
const runFormat = format(dir, options, t);
|
|
244
|
+
|
|
245
|
+
if (!isUpdate())
|
|
246
|
+
return await runFormat(formatter, name, options);
|
|
247
|
+
|
|
244
248
|
const {existsSync, writeFileSync} = global.__putout_test_fs;
|
|
245
249
|
|
|
246
250
|
const full = join(dir, name);
|
|
@@ -249,7 +253,6 @@ const formatSave = currify((dir, options, t) => async (formatter, name, options
|
|
|
249
253
|
if (!existsSync(outputName))
|
|
250
254
|
writeFileSync(outputName, '');
|
|
251
255
|
|
|
252
|
-
const runFormat = format(dir, options, t);
|
|
253
256
|
const {result} = await runFormat(formatter, name, options);
|
|
254
257
|
|
|
255
258
|
writeFileSync(outputName, result);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/test",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.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 ",
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"@putout/plugin-remove-console": "*",
|
|
63
63
|
"@putout/plugin-remove-empty": "*",
|
|
64
64
|
"@putout/plugin-remove-unused-variables": "*",
|
|
65
|
-
"c8": "^
|
|
65
|
+
"c8": "^8.0.0",
|
|
66
66
|
"eslint": "^8.0.1",
|
|
67
67
|
"eslint-plugin-n": "^16.0.0",
|
|
68
|
-
"eslint-plugin-putout": "^
|
|
68
|
+
"eslint-plugin-putout": "^18.0.0",
|
|
69
69
|
"lerna": "^6.0.1",
|
|
70
70
|
"madrun": "^9.0.0",
|
|
71
71
|
"mock-require": "^3.0.3",
|