@putout/plugin-tape 9.1.0 → 9.3.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
CHANGED
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-tape.svg?style=flat&longCache=true
|
|
4
4
|
[NPMURL]: https://npmjs.org/package/@putout/plugin-tape"npm"
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
> Tape-inspired TAP-compatible simplest high speed test runner with superpowers.
|
|
7
|
+
>
|
|
8
|
+
> (c) 📼[**Supertape**](https://github.com/coderaiser/supertape)
|
|
9
|
+
|
|
10
|
+
🐊[**Putout**](https://github.com/coderaiser/putout) plugin helps to apply best parctises for tests written with 📼[**Supertape**](https://github.com/coderaiser/supertape).
|
|
7
11
|
|
|
8
12
|
## Install
|
|
9
13
|
|
|
@@ -62,8 +62,12 @@ function checkStub(node, path) {
|
|
|
62
62
|
|
|
63
63
|
const initPath = binding.path.get('init');
|
|
64
64
|
const calleePath = initPath.get('callee');
|
|
65
|
+
const str = initPath.toString();
|
|
65
66
|
|
|
66
|
-
|
|
67
|
+
if (calleePath.isMemberExpression() && str.includes('withName'))
|
|
68
|
+
return false;
|
|
69
|
+
|
|
70
|
+
return true;
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
function applyWithNameToNode(node, path) {
|
|
@@ -76,9 +80,12 @@ function applyWithNameToNode(node, path) {
|
|
|
76
80
|
|
|
77
81
|
const initPath = binding.path.get('init');
|
|
78
82
|
const calleePath = initPath.get('callee');
|
|
83
|
+
const str = initPath.toString();
|
|
79
84
|
|
|
80
|
-
if (calleePath.isMemberExpression())
|
|
85
|
+
if (calleePath.isMemberExpression() && !str.includes('withName')) {
|
|
86
|
+
replaceWith(initPath, template.ast(`${initPath}.withName('${name}')`));
|
|
81
87
|
return;
|
|
88
|
+
}
|
|
82
89
|
|
|
83
90
|
replaceWith(initPath, template.ast(`stub().withName('${name}')`));
|
|
84
91
|
}
|
|
@@ -54,14 +54,16 @@ function match({__body}) {
|
|
|
54
54
|
|
|
55
55
|
return false;
|
|
56
56
|
}
|
|
57
|
+
|
|
57
58
|
function replace({__a}, path) {
|
|
58
59
|
declareOnce(path);
|
|
59
60
|
|
|
60
61
|
const arg = path.get('arguments.1').node;
|
|
61
62
|
arg.async = true;
|
|
62
|
-
const {body} = arg.body;
|
|
63
63
|
|
|
64
|
+
const {body} = arg.body;
|
|
64
65
|
const n = body.length;
|
|
66
|
+
|
|
65
67
|
for (let i = 0; i < n; i++) {
|
|
66
68
|
let nodes = [];
|
|
67
69
|
|
|
@@ -11,12 +11,15 @@ const {
|
|
|
11
11
|
TEST_ASYNC_SKIP,
|
|
12
12
|
} = require('../test-signatures');
|
|
13
13
|
|
|
14
|
-
const {
|
|
14
|
+
const {
|
|
15
|
+
traverse,
|
|
16
|
+
remove,
|
|
17
|
+
} = operator;
|
|
15
18
|
|
|
16
19
|
module.exports.report = () => `Remove 'stopAll()' when you not calling 'reImport()'`;
|
|
17
20
|
|
|
18
21
|
module.exports.fix = (path) => {
|
|
19
|
-
|
|
22
|
+
remove(path);
|
|
20
23
|
};
|
|
21
24
|
|
|
22
25
|
module.exports.traverse = ({push}) => ({
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
const {operator} = require('putout');
|
|
4
4
|
|
|
5
|
-
const {
|
|
5
|
+
const {
|
|
6
|
+
traverse,
|
|
7
|
+
remove,
|
|
8
|
+
} = operator;
|
|
6
9
|
|
|
7
10
|
module.exports.report = () => `Avoid useless 't.end()'`;
|
|
8
11
|
|
|
9
12
|
module.exports.fix = (path) => {
|
|
10
|
-
|
|
13
|
+
remove(path);
|
|
11
14
|
};
|
|
12
15
|
|
|
13
16
|
const TEST = 'test("__a", (t) => __body)';
|