@putout/test 5.4.0 → 5.5.2

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.
@@ -1,6 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const {readFile} = require('fs/promises');
3
+ const {
4
+ readFile,
5
+ writeFile,
6
+ } = require('fs/promises');
4
7
  const {
5
8
  join,
6
9
  extname,
@@ -12,6 +15,12 @@ const processFile = require('putout/process-file');
12
15
  const {runProcessors} = require('@putout/engine-processor');
13
16
 
14
17
  const isStr = (a) => typeof a === 'string';
18
+ const isUpdate = () => Number(global.process.env.UPDATE);
19
+ const update = async (a, b) => {
20
+ const write = global.writeFile || writeFile;
21
+ await write(a, b);
22
+ };
23
+
15
24
  const buildOptions = ({options, plugins, processors}) => ({
16
25
  ...options,
17
26
  plugins: plugins || options.plugins,
@@ -110,6 +119,9 @@ async function process(filename, dir, {processors, plugins, extension, fix = tru
110
119
  rawSource,
111
120
  });
112
121
 
122
+ if (isUpdate() && !noChange)
123
+ await update(outputName, processedSource);
124
+
113
125
  return {
114
126
  processedSource,
115
127
  output,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/test",
3
- "version": "5.4.0",
3
+ "version": "5.5.2",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "test runner for putout plugins ",
@@ -64,7 +64,7 @@
64
64
  "c8": "^7.5.0",
65
65
  "eslint": "^8.0.1",
66
66
  "eslint-plugin-n": "^15.2.4",
67
- "eslint-plugin-putout": "^15.0.0",
67
+ "eslint-plugin-putout": "^16.0.0",
68
68
  "lerna": "^5.0.0",
69
69
  "madrun": "^9.0.0",
70
70
  "mock-require": "^3.0.3",