@putout/test 14.0.0 → 14.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.
- package/README.md +14 -0
- package/lib/pre-test.js +2 -0
- package/lib/test.js +4 -3
- package/lib/test.mjs +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -70,6 +70,20 @@ const test = createTest(import.meta.url, {
|
|
|
70
70
|
});
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
+
And apply new [operators](https://github.com/coderaiser/supertape?tab=readme-ov-file#operators):
|
|
74
|
+
|
|
75
|
+
```js
|
|
76
|
+
const test = createTest(import.meta.url, {
|
|
77
|
+
extension: 'wast',
|
|
78
|
+
lint: putout,
|
|
79
|
+
plugins: [
|
|
80
|
+
['remove-unused-variables', rmVars],
|
|
81
|
+
],
|
|
82
|
+
}, {
|
|
83
|
+
render: (operator) => (name) => operator.transform,
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
73
87
|
### `report(filename, message: string | string[], plugins?: PutoutPlugin[])`
|
|
74
88
|
|
|
75
89
|
Check error message (or messages) of a plugin:
|
package/lib/pre-test.js
CHANGED
package/lib/test.js
CHANGED
|
@@ -18,6 +18,7 @@ const {createProgress} = require('@putout/engine-runner/progress');
|
|
|
18
18
|
|
|
19
19
|
const {createError} = require('./create-error');
|
|
20
20
|
const {preTest} = require('./pre-test');
|
|
21
|
+
|
|
21
22
|
const {
|
|
22
23
|
format,
|
|
23
24
|
noFormat,
|
|
@@ -64,11 +65,11 @@ const parsePlugin = (plugins) => {
|
|
|
64
65
|
return plugins;
|
|
65
66
|
};
|
|
66
67
|
|
|
67
|
-
function createTest(dir, maybeOptions) {
|
|
68
|
+
function createTest(dir, maybeOptions, maybeExtends = {}) {
|
|
68
69
|
dir = join(dir, 'fixture');
|
|
69
70
|
|
|
70
71
|
const {
|
|
71
|
-
extension =
|
|
72
|
+
extension = '',
|
|
72
73
|
lint = putout,
|
|
73
74
|
...options
|
|
74
75
|
} = parseOptions(maybeOptions);
|
|
@@ -105,6 +106,7 @@ function createTest(dir, maybeOptions) {
|
|
|
105
106
|
format: format(dir, options),
|
|
106
107
|
formatMany: formatMany(dir, options),
|
|
107
108
|
noFormat: noFormat(dir, options),
|
|
109
|
+
...maybeExtends,
|
|
108
110
|
});
|
|
109
111
|
}
|
|
110
112
|
|
|
@@ -210,7 +212,6 @@ const transformWithOptions = currify((dir, linterOptions, options, t, name, plug
|
|
|
210
212
|
const [input, isTS, currentExtension] = readFixture(full, extension);
|
|
211
213
|
|
|
212
214
|
const rule = parseRule(options);
|
|
213
|
-
|
|
214
215
|
const rules = {
|
|
215
216
|
[rule]: ['on', pluginOptions],
|
|
216
217
|
};
|
package/lib/test.mjs
CHANGED
|
@@ -4,9 +4,9 @@ import create from './test.js';
|
|
|
4
4
|
|
|
5
5
|
export default create;
|
|
6
6
|
|
|
7
|
-
export const createTest = (url, plugins) => {
|
|
7
|
+
export const createTest = (url, plugins, maybeExtends) => {
|
|
8
8
|
const __filename = fileURLToPath(url);
|
|
9
9
|
const __dirname = dirname(__filename);
|
|
10
10
|
|
|
11
|
-
return create(__dirname, plugins);
|
|
11
|
+
return create(__dirname, plugins, maybeExtends);
|
|
12
12
|
};
|