@putout/plugin-tape 14.0.1 → 14.2.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 +0 -21
- package/lib/convert-ok-to-called-with/index.js +16 -1
- package/lib/index.js +0 -2
- package/package.json +1 -1
- package/lib/apply-stub-operator/index.js +0 -14
package/README.md
CHANGED
|
@@ -24,7 +24,6 @@ npm i @putout/plugin-tape -D
|
|
|
24
24
|
"tape/jest": "on",
|
|
25
25
|
"tape/apply-stub": "on",
|
|
26
26
|
"tape/apply-destructuring": "on",
|
|
27
|
-
"tape/apply-stub-operator": "on",
|
|
28
27
|
"tape/apply-with-name": "on",
|
|
29
28
|
"tape/add-t-end": "on",
|
|
30
29
|
"tape/add-stop-all": "on",
|
|
@@ -403,26 +402,6 @@ const c = stub().rejects(Error('hello'));
|
|
|
403
402
|
const d = stub().rejects(Error('hello'));
|
|
404
403
|
```
|
|
405
404
|
|
|
406
|
-
## apply-stub-operator
|
|
407
|
-
|
|
408
|
-
### ❌ Example of incorrect code
|
|
409
|
-
|
|
410
|
-
```js
|
|
411
|
-
test('some message', (t) => {
|
|
412
|
-
t.ok(fn.calledWith(a));
|
|
413
|
-
t.end();
|
|
414
|
-
});
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
### ✅ Example of correct code
|
|
418
|
-
|
|
419
|
-
```js
|
|
420
|
-
test('some message', (t) => {
|
|
421
|
-
t.calledWith(fn, [a]);
|
|
422
|
-
t.end();
|
|
423
|
-
});
|
|
424
|
-
```
|
|
425
|
-
|
|
426
405
|
## apply-with-name
|
|
427
406
|
|
|
428
407
|
### ❌ Example of incorrect code
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const {operator} = require('putout');
|
|
4
|
+
const {compare} = operator;
|
|
5
|
+
|
|
6
|
+
module.exports.report = (path) => {
|
|
7
|
+
if (compare(path, 't.ok(__args)'))
|
|
8
|
+
return `Use 't.calledWith()' instead of 't.ok()'`;
|
|
9
|
+
|
|
10
|
+
return `Use 't.notCalledWith()' instead of 't.notOk()'`;
|
|
11
|
+
};
|
|
4
12
|
|
|
5
13
|
module.exports.replace = () => ({
|
|
6
14
|
't.ok(__a.calledWith(__args))': 't.calledWith(__a, [__args])',
|
|
15
|
+
't.ok(__a.calledWith(__args), __b)': 't.calledWith(__a, [__args], __b)',
|
|
16
|
+
|
|
17
|
+
't.ok(__a.calledWith(...__b))': 't.calledWith(__a, __b)',
|
|
18
|
+
't.ok(__a.calledWith(...__b), __c)': 't.calledWith(__a, __b, __c)',
|
|
19
|
+
|
|
20
|
+
't.notOk(__a.called, __b)': 't.notCalled(__a, __b)',
|
|
21
|
+
't.ok(__a.calledWith(), __b)': 't.calledWithNoArgs(__a, __b)',
|
|
7
22
|
});
|
package/lib/index.js
CHANGED
|
@@ -27,7 +27,6 @@ const declare = require('./declare');
|
|
|
27
27
|
const removeDefaultMessages = require('./remove-default-messages');
|
|
28
28
|
const removeUselessNotCalledArgs = require('./remove-useless-not-called-args');
|
|
29
29
|
const switchExpectedWithResult = require('./switch-expected-with-result');
|
|
30
|
-
const applyStubOperator = require('./apply-stub-operator');
|
|
31
30
|
const addTEnd = require('./add-t-end');
|
|
32
31
|
const addStopAll = require('./add-stop-all');
|
|
33
32
|
const removeStopAll = require('./remove-stop-all');
|
|
@@ -66,7 +65,6 @@ module.exports.rules = {
|
|
|
66
65
|
'remove-default-messages': removeDefaultMessages,
|
|
67
66
|
'remove-useless-not-called-args': removeUselessNotCalledArgs,
|
|
68
67
|
'switch-expected-with-result': switchExpectedWithResult,
|
|
69
|
-
'apply-stub-operator': applyStubOperator,
|
|
70
68
|
'add-t-end': addTEnd,
|
|
71
69
|
'add-stop-all': addStopAll,
|
|
72
70
|
'remove-stop-all': removeStopAll,
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
module.exports.report = () => 'Use Stub operator';
|
|
4
|
-
|
|
5
|
-
module.exports.replace = () => ({
|
|
6
|
-
't.ok(__a.calledWith(__b))': 't.calledWith(__a, [__b])',
|
|
7
|
-
't.ok(__a.calledWith(__b, __c))': 't.calledWith(__a, [__b, __c])',
|
|
8
|
-
't.ok(__a.calledWith(...__b))': 't.calledWith(__a, __b)',
|
|
9
|
-
't.ok(__a.calledWith(__b), __c)': 't.calledWith(__a, [__b], __c)',
|
|
10
|
-
't.ok(__a.calledWith(__b, __c), __d)': 't.calledWith(__a, [__b, __c], __d)',
|
|
11
|
-
't.ok(__a.calledWith(...__b), __c)': 't.calledWith(__a, __b, __c)',
|
|
12
|
-
't.notOk(__a.called, __b)': 't.notCalled(__a, __b)',
|
|
13
|
-
't.ok(__a.calledWith(), __b)': 't.calledWithNoArgs(__a, __b)',
|
|
14
|
-
});
|