@putout/plugin-tape 3.9.0 → 3.10.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 +20 -0
- package/lib/index.js +1 -0
- package/lib/remove-useless-t-end/index.js +29 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ npm i @putout/plugin-tape -D
|
|
|
21
21
|
"tape/apply-stub-operator": "on",
|
|
22
22
|
"tape/apply-with-name": "on",
|
|
23
23
|
"tape/add-t-end": "on",
|
|
24
|
+
"tape/remove-useless-t-end": "on",
|
|
24
25
|
"tape/sync-with-name": "on",
|
|
25
26
|
"tape/switch-expected-with-result": "on",
|
|
26
27
|
"tape/convert-tape-to-supertape": "on",
|
|
@@ -432,6 +433,25 @@ test('xxx', (t) => {
|
|
|
432
433
|
});
|
|
433
434
|
```
|
|
434
435
|
|
|
436
|
+
## remove-useless-t-end
|
|
437
|
+
|
|
438
|
+
### ❌ Incorrect code example
|
|
439
|
+
|
|
440
|
+
```js
|
|
441
|
+
test('test: remove me', () => {
|
|
442
|
+
t.end();
|
|
443
|
+
t.end();
|
|
444
|
+
});
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
### ✅ Correct code example
|
|
448
|
+
|
|
449
|
+
```js
|
|
450
|
+
test('test: remove me', () => {
|
|
451
|
+
t.end();
|
|
452
|
+
});
|
|
453
|
+
```
|
|
454
|
+
|
|
435
455
|
## convert-ok-to-match
|
|
436
456
|
|
|
437
457
|
### ❌ Incorrect code example
|
package/lib/index.js
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const {operator} = require('putout');
|
|
4
|
+
|
|
5
|
+
const {traverse} = operator;
|
|
6
|
+
|
|
7
|
+
module.exports.report = () => `Avoid useless 't.end()'`;
|
|
8
|
+
|
|
9
|
+
module.exports.fix = (path) => {
|
|
10
|
+
path.remove();
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const TEST = 'test("__a", (t) => __body)';
|
|
14
|
+
|
|
15
|
+
module.exports.traverse = ({push}) => ({
|
|
16
|
+
[TEST]: (path) => {
|
|
17
|
+
const paths = [];
|
|
18
|
+
|
|
19
|
+
traverse(path, {
|
|
20
|
+
't.end()': (path) => {
|
|
21
|
+
paths.push(path);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
if (paths.length > 1)
|
|
26
|
+
push(paths.pop());
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-tape",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0",
|
|
4
4
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
5
5
|
"description": "putout plugin helps with tests",
|
|
6
6
|
"homepage": "http://github.com/coderaiser/putout",
|