@putout/plugin-putout 22.6.0 → 22.8.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.
|
@@ -37,20 +37,30 @@ const isTest = (path) => compare(path, 'test(__a, (t) => __body)', {
|
|
|
37
37
|
findUp: false,
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
+
const isTestOnly = (path) => compare(path, 'test.only(__a, (t) => __body)', {
|
|
41
|
+
findUp: false,
|
|
42
|
+
});
|
|
43
|
+
|
|
40
44
|
const check = ({__a}, path) => {
|
|
41
45
|
const name = __a.value;
|
|
42
46
|
|
|
43
47
|
if (FIXTURE.includes(name))
|
|
44
48
|
return false;
|
|
45
49
|
|
|
46
|
-
const
|
|
50
|
+
const {value} = getTestNodeArgument(path);
|
|
51
|
+
|
|
52
|
+
if (!value)
|
|
53
|
+
return false;
|
|
54
|
+
|
|
55
|
+
const regEnd = RegExp(`: ${name}$`);
|
|
56
|
+
const regMiddle = RegExp(`: ${name}: .*`);
|
|
47
57
|
|
|
48
|
-
return !
|
|
58
|
+
return !(regEnd.test(value) || regMiddle.test(value));
|
|
49
59
|
};
|
|
50
60
|
|
|
51
61
|
const transform = ({__a}, path) => {
|
|
52
62
|
const name = __a.value;
|
|
53
|
-
const str = getTestNodeArgument(
|
|
63
|
+
const str = getTestNodeArgument(path);
|
|
54
64
|
|
|
55
65
|
const values = str.value.split(':');
|
|
56
66
|
const last = values
|
|
@@ -65,12 +75,15 @@ const transform = ({__a}, path) => {
|
|
|
65
75
|
return path;
|
|
66
76
|
};
|
|
67
77
|
|
|
68
|
-
const getTestNodeArgument = (
|
|
78
|
+
const getTestNodeArgument = (path) => {
|
|
69
79
|
let testPath = path.find(isTest);
|
|
70
80
|
|
|
81
|
+
if (!testPath)
|
|
82
|
+
testPath = path.find(isTestOnly);
|
|
83
|
+
|
|
71
84
|
if (!testPath)
|
|
72
85
|
return {
|
|
73
|
-
value,
|
|
86
|
+
value: '',
|
|
74
87
|
};
|
|
75
88
|
|
|
76
89
|
if (testPath.isExpressionStatement())
|
package/package.json
CHANGED