@putout/plugin-tape 9.8.0 → 9.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.
|
@@ -26,12 +26,14 @@ function checkStubs({__a, __b}, path) {
|
|
|
26
26
|
const __array = {
|
|
27
27
|
elements,
|
|
28
28
|
};
|
|
29
|
+
|
|
29
30
|
return checkStubsArray({__array}, path);
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
function applyWithName({__a, __b}, path) {
|
|
33
34
|
applyWithNameToNode(__a, path);
|
|
34
35
|
applyWithNameToNode(__b, path);
|
|
36
|
+
|
|
35
37
|
return path;
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -6,7 +6,7 @@ const {
|
|
|
6
6
|
isArrayExpression,
|
|
7
7
|
} = types;
|
|
8
8
|
|
|
9
|
-
module.exports.report = () => `Use
|
|
9
|
+
module.exports.report = () => `Use an array as args to 'calledWith()'`;
|
|
10
10
|
|
|
11
11
|
module.exports.match = () => ({
|
|
12
12
|
't.calledWith(__a, __b)': ({__b}) => {
|
|
@@ -23,3 +23,4 @@ module.exports.match = () => ({
|
|
|
23
23
|
module.exports.replace = () => ({
|
|
24
24
|
't.calledWith(__a, __b)': 't.calledWith(__a, [__b])',
|
|
25
25
|
});
|
|
26
|
+
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const {
|
|
4
|
+
types,
|
|
5
|
+
operator,
|
|
6
|
+
} = require('putout');
|
|
7
|
+
|
|
8
|
+
const isString = (a) => typeof a === 'string';
|
|
9
|
+
|
|
10
|
+
const {compute} = operator;
|
|
4
11
|
|
|
5
12
|
const {
|
|
6
13
|
isLiteral,
|
|
@@ -16,11 +23,23 @@ module.exports.report = (path) => {
|
|
|
16
23
|
return `Use 't.equal(${args[0]}, ${args[1]}, ${args[2]})' instead of '${path} when comparin with primitive'`;
|
|
17
24
|
};
|
|
18
25
|
|
|
19
|
-
const check = ({__b}) => {
|
|
26
|
+
const check = ({__b}, path) => {
|
|
20
27
|
if (isRegExpLiteral(__b))
|
|
21
28
|
return false;
|
|
22
29
|
|
|
23
|
-
|
|
30
|
+
if (isLiteral(__b))
|
|
31
|
+
return true;
|
|
32
|
+
|
|
33
|
+
const expectedPath = path.get('arguments.1');
|
|
34
|
+
const [, value] = compute(expectedPath);
|
|
35
|
+
|
|
36
|
+
if (isString(value))
|
|
37
|
+
return true;
|
|
38
|
+
|
|
39
|
+
if (checkExpected(expectedPath))
|
|
40
|
+
return true;
|
|
41
|
+
|
|
42
|
+
return false;
|
|
24
43
|
};
|
|
25
44
|
|
|
26
45
|
module.exports.match = () => ({
|
|
@@ -33,3 +52,23 @@ module.exports.replace = () => ({
|
|
|
33
52
|
't.deepEqual(__a, __b, __c)': 't.equal(__a, __b, __c)',
|
|
34
53
|
});
|
|
35
54
|
|
|
55
|
+
function checkExpected(path) {
|
|
56
|
+
if (!path.isIdentifier())
|
|
57
|
+
return false;
|
|
58
|
+
|
|
59
|
+
const {name} = path.node;
|
|
60
|
+
const binding = path.scope.bindings[name];
|
|
61
|
+
|
|
62
|
+
if (!binding)
|
|
63
|
+
return false;
|
|
64
|
+
|
|
65
|
+
if (!binding.path.isVariableDeclarator())
|
|
66
|
+
return false;
|
|
67
|
+
|
|
68
|
+
const initPath = binding.path.get('init');
|
|
69
|
+
|
|
70
|
+
if (initPath.isTaggedTemplateExpression())
|
|
71
|
+
return true;
|
|
72
|
+
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
@@ -10,6 +10,7 @@ module.exports.replace = () => ({
|
|
|
10
10
|
't.equal(__a, __b, "should equal")': 't.equal(__a, __b)',
|
|
11
11
|
't.notEqual(__a, __b, "should not equal")': 't.notEqual(__a, __b)',
|
|
12
12
|
't.deepEqual(__a, __b, "should deep equal")': 't.deepEqual(__a, __b)',
|
|
13
|
+
't.deepEqual(__a, __b, "should equal")': 't.deepEqual(__a, __b)',
|
|
13
14
|
't.notDeepEqual(__a, __b, "should not deep equal")': 't.notDeepEqual(__a, __b)',
|
|
14
15
|
});
|
|
15
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-tape",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.10.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout plugin helps with tests",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"eslint": "^8.0.1",
|
|
37
37
|
"eslint-plugin-node": "^11.0.0",
|
|
38
38
|
"eslint-plugin-putout": "^15.0.0",
|
|
39
|
-
"lerna": "^
|
|
39
|
+
"lerna": "^5.0.0",
|
|
40
40
|
"madrun": "^9.0.0",
|
|
41
41
|
"montag": "^1.2.1",
|
|
42
42
|
"nodemon": "^2.0.1"
|