@putout/test 6.6.0 → 7.0.1

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.
Files changed (2) hide show
  1. package/lib/test.js +15 -12
  2. package/package.json +2 -2
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);
@@ -114,11 +112,8 @@ function createTest(dir, maybeOptions) {
114
112
  reportWithOptions: reportWithOptions(dir, options),
115
113
  noReportWithOptions: noReportWithOptions(dir, options),
116
114
  reportCode: reportCode(options),
117
-
118
- formatSave: formatSave(dir, options),
119
- format: update ? formatSave : format(dir, options),
120
- formatManySave: formatManySave(dir, options),
121
- formatMany: update ? formatManySave : formatMany(dir, options),
115
+ format: formatSave(dir, options),
116
+ formatMany: formatManySave(dir, options),
122
117
  noFormat: noFormat(dir, options),
123
118
  });
124
119
  }
@@ -220,11 +215,16 @@ const formatMany = currify((dir, options, t) => async (formatter, names, formatt
220
215
  };
221
216
  });
222
217
 
223
- const formatManySave = currify((dir, options, t) => async (formatter, names, options = {}) => {
218
+ const formatManySave = currify((dir, options, t) => async (formatter, names, formatterOptions = {}) => {
219
+ const runFormat = await formatMany(dir, options, t);
220
+
221
+ if (!isUpdate())
222
+ return await runFormat(formatter, names, formatterOptions);
223
+
224
224
  const {existsSync, writeFileSync} = global.__putout_test_fs;
225
225
 
226
226
  if (!isArray(names))
227
- throw Error(`☝️ Looks like 'formatManySave()' received 'names' with type: '${typeof names}', expected: 'array'`);
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);
@@ -240,7 +239,12 @@ const formatManySave = currify((dir, options, t) => async (formatter, names, opt
240
239
  return t.pass('fixed fixture updated');
241
240
  });
242
241
 
243
- const formatSave = currify((dir, options, t) => async (formatter, name, options = {}) => {
242
+ const formatSave = currify((dir, options, t) => async (formatter, name, formatterOptions = {}) => {
243
+ const runFormat = format(dir, options, t);
244
+
245
+ if (!isUpdate())
246
+ return await runFormat(formatter, name, formatterOptions);
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": "6.6.0",
3
+ "version": "7.0.1",
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": "^17.0.0",
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",