@putout/test 5.11.0 → 5.13.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.
Files changed (2) hide show
  1. package/lib/test.js +11 -16
  2. package/package.json +1 -1
package/lib/test.js CHANGED
@@ -140,6 +140,10 @@ const noFormat = currify(({dir, plugins, rules}, t) => async (formatter, name, f
140
140
 
141
141
  const formatMany = currify(({dir, plugins, rules}, t) => async (formatter, names, formatterOptions = {}) => {
142
142
  const joinTwo = (a) => (b) => join(a, b);
143
+
144
+ if (!isArray(names))
145
+ throw Error(`☝️ Looks like 'formatMany()' received 'names' with type: '${typeof names}', expected: 'array'`);
146
+
143
147
  const fullNames = names.map(joinTwo(dir));
144
148
 
145
149
  let result = '';
@@ -182,6 +186,9 @@ const formatManySave = currify(({dir, plugins, rules}, t) => async (formatter, n
182
186
  writeFileSync,
183
187
  } = global.__putout_test_fs;
184
188
 
189
+ if (!isArray(names))
190
+ throw Error(`☝️ Looks like 'formatManySave()' received 'names' with type: '${typeof names}', expected: 'array'`);
191
+
185
192
  const name = `${names.join('-')}-format.js`;
186
193
  const outputName = join(dir, name);
187
194
 
@@ -189,16 +196,11 @@ const formatManySave = currify(({dir, plugins, rules}, t) => async (formatter, n
189
196
  writeFileSync(outputName, '');
190
197
 
191
198
  const runFormat = await formatMany({dir, plugins, rules}, t);
192
-
193
- const {
194
- is,
195
- output,
196
- result,
197
- } = await runFormat(formatter, names, options);
199
+ const {result} = await runFormat(formatter, names, options);
198
200
 
199
201
  writeFileSync(outputName, result);
200
202
 
201
- return {is, output, result};
203
+ return t.pass('fixture updated');
202
204
  });
203
205
 
204
206
  const formatSave = currify(({dir, plugins, rules}, t) => async (formatter, name, options = {}) => {
@@ -219,18 +221,11 @@ const formatSave = currify(({dir, plugins, rules}, t) => async (formatter, name,
219
221
  rules,
220
222
  }, t);
221
223
 
222
- const {
223
- is,
224
- output,
225
- result,
226
- } = await runFormat(formatter, name, options);
224
+ const {result} = await runFormat(formatter, name, options);
227
225
 
228
226
  writeFileSync(outputName, result);
229
227
 
230
- return {
231
- is,
232
- output,
233
- };
228
+ return t.pass('fixture updated');
234
229
  });
235
230
 
236
231
  const transform = currify(({dir, plugins, rules}, t, name, transformed = null, addons = {}) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/test",
3
- "version": "5.11.0",
3
+ "version": "5.13.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 ",