@putout/test 7.1.0 → 7.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/test.js +8 -13
- package/package.json +2 -2
package/lib/test.js
CHANGED
|
@@ -38,6 +38,7 @@ const TS = {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const readFixture = (name) => {
|
|
41
|
+
const {readFileSync} = global.__putout_test_fs;
|
|
41
42
|
const [e, data] = tryCatch(readFileSync, `${name}.ts`, 'utf8');
|
|
42
43
|
|
|
43
44
|
if (!e)
|
|
@@ -221,7 +222,7 @@ const formatManySave = currify((dir, options, t) => async (formatter, names, for
|
|
|
221
222
|
if (!isUpdate())
|
|
222
223
|
return await runFormat(formatter, names, formatterOptions);
|
|
223
224
|
|
|
224
|
-
const {
|
|
225
|
+
const {writeFileSync} = global.__putout_test_fs;
|
|
225
226
|
|
|
226
227
|
if (!isArray(names))
|
|
227
228
|
throw Error(`☝️ Looks like 'formatMany()' received 'names' with type: '${typeof names}', expected: 'array'`);
|
|
@@ -229,10 +230,7 @@ const formatManySave = currify((dir, options, t) => async (formatter, names, for
|
|
|
229
230
|
const name = `${names.join('-')}-format.js`;
|
|
230
231
|
const outputName = join(dir, name);
|
|
231
232
|
|
|
232
|
-
|
|
233
|
-
writeFileSync(outputName, '');
|
|
234
|
-
|
|
235
|
-
const {result} = await runFormat(formatter, names, options);
|
|
233
|
+
const {result} = await runFormat(formatter, names, formatterOptions);
|
|
236
234
|
|
|
237
235
|
writeFileSync(outputName, result);
|
|
238
236
|
|
|
@@ -245,15 +243,12 @@ const formatSave = currify((dir, options, t) => async (formatter, name, formatte
|
|
|
245
243
|
if (!isUpdate())
|
|
246
244
|
return await runFormat(formatter, name, formatterOptions);
|
|
247
245
|
|
|
248
|
-
const {
|
|
246
|
+
const {writeFileSync} = global.__putout_test_fs;
|
|
249
247
|
|
|
250
248
|
const full = join(dir, name);
|
|
251
249
|
const outputName = `${full}-format.js`;
|
|
252
250
|
|
|
253
|
-
|
|
254
|
-
writeFileSync(outputName, '');
|
|
255
|
-
|
|
256
|
-
const {result} = await runFormat(formatter, name, options);
|
|
251
|
+
const {result} = await runFormat(formatter, name, formatterOptions);
|
|
257
252
|
|
|
258
253
|
writeFileSync(outputName, result);
|
|
259
254
|
|
|
@@ -278,10 +273,9 @@ const toObject = (array) => {
|
|
|
278
273
|
const transform = currify((dir, options, t, name, transformed = null, addons = {}) => {
|
|
279
274
|
const {plugins} = options;
|
|
280
275
|
const full = join(dir, name);
|
|
281
|
-
const [input, isTS] = readFixture(full);
|
|
282
276
|
const isStr = isString(transformed);
|
|
283
277
|
|
|
284
|
-
const [
|
|
278
|
+
const [input, isTS] = readFixture(full);
|
|
285
279
|
|
|
286
280
|
if (!isStr)
|
|
287
281
|
addons = transformed;
|
|
@@ -304,10 +298,11 @@ const transform = currify((dir, options, t, name, transformed = null, addons = {
|
|
|
304
298
|
code,
|
|
305
299
|
isTS,
|
|
306
300
|
});
|
|
307
|
-
|
|
308
301
|
return t.pass('fixed fixture updated');
|
|
309
302
|
}
|
|
310
303
|
|
|
304
|
+
const [output] = isStr ? [transformed] : readFixture(`${full}-fix`);
|
|
305
|
+
|
|
311
306
|
return t.equal(code, output);
|
|
312
307
|
});
|
|
313
308
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/test",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.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 ",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
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": "^20.0.0",
|
|
69
69
|
"lerna": "^6.0.1",
|
|
70
70
|
"madrun": "^9.0.0",
|
|
71
71
|
"mock-require": "^3.0.3",
|