@putout/test 5.12.0 → 5.14.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 +4 -1
- package/lib/test.js +9 -7
- package/package.json +1 -1
package/lib/processor/index.js
CHANGED
|
@@ -55,6 +55,9 @@ const createProcess = (dir, options) => (operator) => async (filename, plugins,
|
|
|
55
55
|
}),
|
|
56
56
|
);
|
|
57
57
|
|
|
58
|
+
if (isUpdate())
|
|
59
|
+
return operator.pass('fixtures updated');
|
|
60
|
+
|
|
58
61
|
return operator.equal(processedSource, output, 'fixtures should equal');
|
|
59
62
|
};
|
|
60
63
|
|
|
@@ -120,7 +123,7 @@ async function process(filename, dir, {processors, plugins, extension, fix = tru
|
|
|
120
123
|
processorRunners,
|
|
121
124
|
});
|
|
122
125
|
|
|
123
|
-
if (isUpdate() && !noChange)
|
|
126
|
+
if (isUpdate() && !noChange && fix)
|
|
124
127
|
await update(outputName, processedSource);
|
|
125
128
|
|
|
126
129
|
return {
|
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
|
|
203
|
+
return t.pass('fixture updated');
|
|
202
204
|
});
|
|
203
205
|
|
|
204
206
|
const formatSave = currify(({dir, plugins, rules}, t) => async (formatter, name, options = {}) => {
|