@putout/test 4.4.0 → 5.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 +2 -0
  2. package/lib/test.js +20 -0
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -15,6 +15,8 @@ npm i @putout/test -D
15
15
 
16
16
  Set environment variable `UPDATE=1` to update `transform` and `format` fixtures.
17
17
 
18
+ ☝️ *Remember that `-fix.js` fixtures will be removed when used in noReport, noTransform, noTransformWithOptions*
19
+
18
20
  ```sh
19
21
  UPDATE=1 tape test/*.js
20
22
  ```
package/lib/test.js CHANGED
@@ -5,6 +5,7 @@ const {
5
5
  readFileSync,
6
6
  writeFileSync,
7
7
  existsSync,
8
+ unlinkSync,
8
9
  } = require('fs');
9
10
 
10
11
  const tryCatch = require('try-catch');
@@ -22,6 +23,7 @@ global.__putout_test_fs = {
22
23
  readFileSync,
23
24
  writeFileSync,
24
25
  existsSync,
26
+ unlinkSync,
25
27
  };
26
28
 
27
29
  const isUpdate = () => Boolean(Number(process.env.UPDATE));
@@ -40,6 +42,16 @@ const readFixture = (name) => {
40
42
  return [readFileSync(`${name}.js`, 'utf8'), TS.DISABLED];
41
43
  };
42
44
 
45
+ const rmFixture = (name) => {
46
+ const {unlinkSync} = global.__putout_test_fs;
47
+
48
+ if (!isUpdate())
49
+ return;
50
+
51
+ tryCatch(unlinkSync, `${name}.js`);
52
+ tryCatch(unlinkSync, `${name}.ts`);
53
+ };
54
+
43
55
  module.exports = createTest;
44
56
  module.exports.createTest = createTest;
45
57
 
@@ -266,6 +278,8 @@ const noTransformWithOptions = currify(({dir, plugins}, t, name, options) => {
266
278
  const full = join(dir, name);
267
279
  const [input, isTS] = readFixture(full);
268
280
 
281
+ rmFixture(`${full}-fix`);
282
+
269
283
  const [plugin] = plugins;
270
284
  const [rule] = keys(plugin);
271
285
 
@@ -282,6 +296,8 @@ const noTransform = currify(({dir, plugins, rules}, t, name, addons = {}) => {
282
296
  const full = join(dir, name);
283
297
  const [fixture] = readFixture(full);
284
298
 
299
+ rmFixture(`${full}-fix`);
300
+
285
301
  return transform({dir, plugins, rules}, t, name, fixture, addons);
286
302
  });
287
303
 
@@ -308,6 +324,8 @@ const noReport = currify(({dir, plugins, rules}, t, name) => {
308
324
  const full = join(dir, name);
309
325
  const [source, isTS] = readFixture(full);
310
326
 
327
+ rmFixture(`${full}-fix`);
328
+
311
329
  return noReportCode({plugins, rules, isTS}, t, source);
312
330
  });
313
331
  module.exports._createNoReport = noReport;
@@ -338,6 +356,8 @@ const noReportWithOptions = currify(({dir, plugins}, t, name, options) => {
338
356
  const full = join(dir, name);
339
357
  const [source, isTS] = readFixture(full);
340
358
 
359
+ rmFixture(`${full}-fix`);
360
+
341
361
  const [plugin] = plugins;
342
362
  const [rule] = keys(plugin);
343
363
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/test",
3
- "version": "4.4.0",
3
+ "version": "5.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 ",
@@ -39,7 +39,7 @@
39
39
  "@putout/engine-processor": "*",
40
40
  "currify": "^4.0.0",
41
41
  "putout": "*",
42
- "supertape": "^6.0.0",
42
+ "supertape": "^7.0.0",
43
43
  "try-catch": "^3.0.0",
44
44
  "try-to-catch": "^3.0.0"
45
45
  },
@@ -63,13 +63,13 @@
63
63
  "eslint-plugin-node": "^11.0.0",
64
64
  "eslint-plugin-putout": "^13.0.0",
65
65
  "lerna": "^4.0.0",
66
- "madrun": "^8.0.1",
66
+ "madrun": "^9.0.0",
67
67
  "mock-require": "^3.0.3",
68
68
  "nodemon": "^2.0.1"
69
69
  },
70
70
  "license": "MIT",
71
71
  "engines": {
72
- "node": ">=14"
72
+ "node": ">=16"
73
73
  },
74
74
  "publishConfig": {
75
75
  "access": "public"