@putout/plugin-tape 21.0.0 → 21.1.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 +6 -2
- package/lib/remove-only/index.js +18 -2
- package/lib/remove-skip/index.js +19 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -79,8 +79,12 @@ npm i @putout/plugin-tape -D
|
|
|
79
79
|
"tape/declare": "on",
|
|
80
80
|
"tape/remove-default-messages": "on",
|
|
81
81
|
"tape/remove-useless-not-called-args": "on",
|
|
82
|
-
"tape/remove-only": "on",
|
|
83
|
-
|
|
82
|
+
"tape/remove-only": ["on", {
|
|
83
|
+
"allowed": ["test"]
|
|
84
|
+
}],
|
|
85
|
+
"tape/remove-skip": ["on", {
|
|
86
|
+
"allowed": ["test"]
|
|
87
|
+
}]
|
|
84
88
|
}
|
|
85
89
|
}
|
|
86
90
|
```
|
package/lib/remove-only/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
const {isArray} = Array;
|
|
2
|
+
const maybeArray = (a) => isArray(a) ? a : [a];
|
|
3
|
+
|
|
1
4
|
export const report = () => `Remove 'test.only'`;
|
|
2
5
|
|
|
3
6
|
export const replace = () => ({
|
|
@@ -5,11 +8,24 @@ export const replace = () => ({
|
|
|
5
8
|
'__a.only(__b, __c, __d)': '__a(__b, __c, __d)',
|
|
6
9
|
});
|
|
7
10
|
|
|
8
|
-
export const filter = (path) => {
|
|
11
|
+
export const filter = (path, {options}) => {
|
|
12
|
+
const {allowed = []} = options;
|
|
9
13
|
const objectPath = path.get('callee.object');
|
|
10
14
|
|
|
11
15
|
if (!objectPath.isIdentifier())
|
|
12
16
|
return false;
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
const {name} = objectPath.node;
|
|
19
|
+
|
|
20
|
+
const all = [
|
|
21
|
+
'test',
|
|
22
|
+
...maybeArray(allowed),
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
for (const allowedName of all) {
|
|
26
|
+
if (name.startsWith(allowedName))
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return false;
|
|
15
31
|
};
|
package/lib/remove-skip/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {types} from 'putout';
|
|
2
2
|
|
|
3
|
+
const {isArray} = Array;
|
|
4
|
+
const maybeArray = (a) => isArray(a) ? a : [a];
|
|
3
5
|
const {isIdentifier} = types;
|
|
4
6
|
|
|
5
7
|
export const report = () => 'Remove "test.skip"';
|
|
@@ -9,8 +11,21 @@ export const replace = () => ({
|
|
|
9
11
|
'__a.skip(__b, __c, __d)': '__a(__b, __c, __d)',
|
|
10
12
|
});
|
|
11
13
|
|
|
12
|
-
export const filter = (path) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
export const filter = (path, {options}) => {
|
|
15
|
+
const {allowed = []} = options;
|
|
16
|
+
const all = [
|
|
17
|
+
'test',
|
|
18
|
+
...maybeArray(allowed),
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
for (const name of all) {
|
|
22
|
+
const is = isIdentifier(path.node.callee.object, {
|
|
23
|
+
name,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
if (is)
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return false;
|
|
16
31
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-tape",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.1.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",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@putout/plugin-putout": "*",
|
|
34
34
|
"@putout/test": "^15.0.0",
|
|
35
|
-
"c8": "^10.0.0",
|
|
36
35
|
"eslint": "^10.0.0",
|
|
37
36
|
"eslint-plugin-n": "^17.0.0",
|
|
38
37
|
"eslint-plugin-putout": "^31.0.0",
|
|
39
38
|
"madrun": "^13.0.0",
|
|
40
39
|
"montag": "^1.2.1",
|
|
41
|
-
"nodemon": "^3.0.1"
|
|
40
|
+
"nodemon": "^3.0.1",
|
|
41
|
+
"superc8": "^12.0.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"putout": ">=42"
|