@putout/test 6.0.1 → 6.1.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 (3) hide show
  1. package/README.md +1 -2
  2. package/lib/test.js +24 -6
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -13,7 +13,7 @@ npm i @putout/test -D
13
13
 
14
14
  ## Autofix
15
15
 
16
- Set environment variable `UPDATE=1` to update `transform` and `format` fixtures.
16
+ Set environment variable `UPDATE=1` to update `transform` and `format` fixtures (both `source` and `fixed`).
17
17
 
18
18
  ☝️ *Remember that `-fix.js` fixtures will be removed when used in `noReport`, `noTransform` and `noTransformWithOptions`*
19
19
 
@@ -388,7 +388,6 @@ const test = createTest(import.meta.url, {
388
388
  'eslint',
389
389
  ],
390
390
  });
391
-
392
391
  ```
393
392
 
394
393
  ### `process(filename [, plugins, ])`
package/lib/test.js CHANGED
@@ -43,12 +43,20 @@ const readFixture = (name) => {
43
43
  };
44
44
 
45
45
  const writeFixture = ({full, code, isTS}) => {
46
+ writeAnyFixture({
47
+ full: `${full}-fix`,
48
+ code,
49
+ isTS,
50
+ });
51
+ };
52
+
53
+ const writeAnyFixture = ({full, code, isTS}) => {
46
54
  const {writeFileSync} = global.__putout_test_fs;
47
55
 
48
56
  if (!isTS)
49
- return writeFileSync(`${full}-fix.js`, code);
57
+ return writeFileSync(`${full}.js`, code);
50
58
 
51
- writeFileSync(`${full}-fix.ts`, code);
59
+ writeFileSync(`${full}.ts`, code);
52
60
  };
53
61
 
54
62
  const rmFixture = (name) => {
@@ -200,7 +208,7 @@ const formatManySave = currify(({dir, plugins, rules}, t) => async (formatter, n
200
208
 
201
209
  writeFileSync(outputName, result);
202
210
 
203
- return t.pass('fixture updated');
211
+ return t.pass('fixed fixture updated');
204
212
  });
205
213
 
206
214
  const formatSave = currify(({dir, plugins, rules}, t) => async (formatter, name, options = {}) => {
@@ -225,7 +233,7 @@ const formatSave = currify(({dir, plugins, rules}, t) => async (formatter, name,
225
233
 
226
234
  writeFileSync(outputName, result);
227
235
 
228
- return t.pass('fixture updated');
236
+ return t.pass('fixed fixture updated');
229
237
  });
230
238
 
231
239
  const transform = currify(({dir, plugins, rules}, t, name, transformed = null, addons = {}) => {
@@ -249,6 +257,16 @@ const transform = currify(({dir, plugins, rules}, t, name, transformed = null, a
249
257
  }],
250
258
  });
251
259
 
260
+ if (isUpdate() && isStr) {
261
+ writeFixture({
262
+ full,
263
+ code,
264
+ isTS,
265
+ });
266
+
267
+ return t.pass('source fixture updated');
268
+ }
269
+
252
270
  if (isUpdate() && !isStr) {
253
271
  writeFixture({
254
272
  full,
@@ -256,7 +274,7 @@ const transform = currify(({dir, plugins, rules}, t, name, transformed = null, a
256
274
  isTS,
257
275
  });
258
276
 
259
- return t.pass('fixture updated');
277
+ return t.pass('fixed fixture updated');
260
278
  }
261
279
 
262
280
  return t.equal(code, output);
@@ -279,7 +297,7 @@ const transformWithOptions = currify(({dir, plugins}, t, name, options) => {
279
297
 
280
298
  if (isUpdate()) {
281
299
  writeFileSync(`${full}-fix.js`, code);
282
- return t.pass('fixture updated');
300
+ return t.pass('fixed fixture updated');
283
301
  }
284
302
 
285
303
  return t.equal(code, output);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/test",
3
- "version": "6.0.1",
3
+ "version": "6.1.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 ",