@putout/test 6.1.1 → 6.2.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/README.md +8 -0
- package/lib/test.js +8 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,6 +21,14 @@ Set environment variable `UPDATE=1` to update `transform` and `format` fixtures
|
|
|
21
21
|
UPDATE=1 tape test/*.js
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
## Printer
|
|
25
|
+
|
|
26
|
+
You can override default printer (`recast`) with [`putout`](https://github.com/putoutjs/printer) or `babel` using:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
PUTOUT_PRINTER=putout tape test/*.js
|
|
30
|
+
```
|
|
31
|
+
|
|
24
32
|
## Plugins API
|
|
25
33
|
|
|
26
34
|
All 🐊**Putout** plugins written in `CommonJS`, since `ESLint` written on `CommonJS` and we have a huge `ESLint`-based ecosystem which is good to reuse.
|
package/lib/test.js
CHANGED
|
@@ -27,6 +27,7 @@ global.__putout_test_fs = {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
const isUpdate = () => Boolean(Number(process.env.UPDATE));
|
|
30
|
+
const getPrinter = () => process.env.PUTOUT_PRINTER;
|
|
30
31
|
|
|
31
32
|
const TS = {
|
|
32
33
|
ENABLED: true,
|
|
@@ -249,6 +250,7 @@ const transform = currify(({dir, plugins, rules}, t, name, transformed = null, a
|
|
|
249
250
|
addons = addons || {};
|
|
250
251
|
|
|
251
252
|
const {code} = putout(input, {
|
|
253
|
+
printer: getPrinter(),
|
|
252
254
|
isTS,
|
|
253
255
|
rules,
|
|
254
256
|
plugins: [{
|
|
@@ -293,7 +295,12 @@ const transformWithOptions = currify(({dir, plugins}, t, name, options) => {
|
|
|
293
295
|
[rule]: ['on', options],
|
|
294
296
|
};
|
|
295
297
|
|
|
296
|
-
const {code} = putout(input, {
|
|
298
|
+
const {code} = putout(input, {
|
|
299
|
+
printer: getPrinter(),
|
|
300
|
+
isTS,
|
|
301
|
+
plugins,
|
|
302
|
+
rules,
|
|
303
|
+
});
|
|
297
304
|
|
|
298
305
|
if (isUpdate()) {
|
|
299
306
|
writeFileSync(`${full}-fix.js`, code);
|