@putout/plugin-putout 29.22.0 → 29.24.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.
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import {operator} from 'putout';
|
|
2
2
|
import regexpEscapePolifyll from 'regexp.escape';
|
|
3
|
+
import {
|
|
4
|
+
isTest,
|
|
5
|
+
isTestAsync,
|
|
6
|
+
isTestDestructuring,
|
|
7
|
+
isTestOnly,
|
|
8
|
+
} from './test-checker.js';
|
|
3
9
|
|
|
4
10
|
const {
|
|
5
11
|
escape = regexpEscapePolifyll,
|
|
6
12
|
} = RegExp;
|
|
7
13
|
|
|
8
|
-
const {
|
|
9
|
-
setLiteralValue,
|
|
10
|
-
compare,
|
|
11
|
-
} = operator;
|
|
14
|
+
const {setLiteralValue} = operator;
|
|
12
15
|
|
|
13
16
|
const FIXTURE = [
|
|
14
17
|
'report',
|
|
15
18
|
'transform',
|
|
19
|
+
'comparePlaces',
|
|
16
20
|
];
|
|
17
21
|
|
|
18
22
|
const NAMES = [
|
|
@@ -41,6 +45,7 @@ export const match = () => ({
|
|
|
41
45
|
't.noTransform(__a)': check,
|
|
42
46
|
't.noReportWithOptions(__a, __b)': check,
|
|
43
47
|
'transform(__a)': check,
|
|
48
|
+
'comparePlaces(__a, __b)': check,
|
|
44
49
|
'noReportAfterTransform(__a)': check,
|
|
45
50
|
});
|
|
46
51
|
|
|
@@ -58,18 +63,7 @@ export const replace = () => ({
|
|
|
58
63
|
't.noReportWithOptions(__a, __b)': transform,
|
|
59
64
|
'transform(__a)': transform,
|
|
60
65
|
'noReportAfterTransform(__a)': transform,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const isTest = (path) => compare(path, 'test(__a, (t) => __body)', {
|
|
64
|
-
findUp: false,
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
const isTestDestructuring = (path) => compare(path, 'test(__a, ({__b}) => __body)', {
|
|
68
|
-
findUp: false,
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
const isTestOnly = (path) => compare(path, 'test.only(__a, (t) => __body)', {
|
|
72
|
-
findUp: false,
|
|
66
|
+
'comparePlaces(__a, __b)': transform,
|
|
73
67
|
});
|
|
74
68
|
|
|
75
69
|
const check = ({__a}, path) => {
|
|
@@ -123,6 +117,9 @@ const getTestNodeArgument = (path) => {
|
|
|
123
117
|
if (!testPath)
|
|
124
118
|
testPath = path.find(isTestDestructuring);
|
|
125
119
|
|
|
120
|
+
if (!testPath)
|
|
121
|
+
testPath = path.find(isTestAsync);
|
|
122
|
+
|
|
126
123
|
if (!testPath)
|
|
127
124
|
return {
|
|
128
125
|
value: '',
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {operator} from 'putout';
|
|
2
|
+
|
|
3
|
+
const {compare} = operator;
|
|
4
|
+
|
|
5
|
+
const buildTestChecker = (a) => (b) => compare(b, a, {
|
|
6
|
+
findUp: false,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const isTest = buildTestChecker('test(__a, (t) => __body)');
|
|
10
|
+
export const isTestAsync = buildTestChecker('test(__a, async (__b) => __body)');
|
|
11
|
+
export const isTestDestructuring = buildTestChecker('test(__a, ({__b}) => __body)');
|
|
12
|
+
export const isTestOnly = buildTestChecker('test.only(__a, (t) => __body)');
|
package/package.json
CHANGED