@putout/plugin-tape 18.0.0 → 19.0.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/lib/add-args/index.js +2 -7
- package/lib/add-t-end/index.js +20 -19
- package/package.json +2 -2
package/lib/add-args/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {operator} from 'putout';
|
|
2
2
|
|
|
3
3
|
const {addArgs} = operator;
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
export const {
|
|
5
6
|
report,
|
|
6
7
|
fix,
|
|
7
8
|
traverse,
|
|
@@ -15,9 +16,3 @@ const {
|
|
|
15
16
|
'test.skip("__a", async (__args) => __body)',
|
|
16
17
|
]],
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
export {
|
|
20
|
-
report,
|
|
21
|
-
fix,
|
|
22
|
-
traverse,
|
|
23
|
-
};
|
package/lib/add-t-end/index.js
CHANGED
|
@@ -4,8 +4,12 @@ import {
|
|
|
4
4
|
operator,
|
|
5
5
|
} from 'putout';
|
|
6
6
|
|
|
7
|
-
const {compare
|
|
8
|
-
const {
|
|
7
|
+
const {compare} = operator;
|
|
8
|
+
const {
|
|
9
|
+
expressionStatement,
|
|
10
|
+
isCallExpression,
|
|
11
|
+
isFunction,
|
|
12
|
+
} = types;
|
|
9
13
|
|
|
10
14
|
export const report = () => `'t.end()' is missing at the end of the test`;
|
|
11
15
|
|
|
@@ -19,32 +23,29 @@ export const replace = () => ({
|
|
|
19
23
|
'test(__a, async (t) => __body)': transform,
|
|
20
24
|
});
|
|
21
25
|
|
|
22
|
-
function check({__body}
|
|
26
|
+
function check({__body}) {
|
|
23
27
|
const {body} = __body;
|
|
24
28
|
const {length} = body;
|
|
25
29
|
|
|
26
30
|
if (!length)
|
|
27
31
|
return true;
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
const last = body.at(-1);
|
|
34
|
+
|
|
35
|
+
if (compare(last, 't.end()'))
|
|
36
|
+
return false;
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
if (compare(last, 'await t.__(__args)'))
|
|
39
|
+
return false;
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
found = true;
|
|
43
|
-
path.stop();
|
|
44
|
-
},
|
|
45
|
-
});
|
|
41
|
+
const {expression} = last;
|
|
42
|
+
|
|
43
|
+
if (isCallExpression(expression)) {
|
|
44
|
+
const lastArg = expression.arguments.at(-1);
|
|
45
|
+
return !isFunction(lastArg);
|
|
46
|
+
}
|
|
46
47
|
|
|
47
|
-
return
|
|
48
|
+
return true;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
function transform({__body}, path) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-tape",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout plugin helps with tests",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"nodemon": "^3.0.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"putout": ">=
|
|
44
|
+
"putout": ">=40"
|
|
45
45
|
},
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"engines": {
|