@putout/plugin-tape 21.10.0 → 21.12.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
|
@@ -42,6 +42,7 @@ npm i @putout/plugin-tape -D
|
|
|
42
42
|
- ✅ [convert-throws-to-try-catch](#convert-throws-to-try-catch);
|
|
43
43
|
- ✅ [declare](#declare);
|
|
44
44
|
- ✅ [extract-args-from-called-with](#extract-args-from-called-with);
|
|
45
|
+
- ✅ [extract-result-from-assertion](#extract-result-from-assertion);
|
|
45
46
|
- ✅ [jest](#jest);
|
|
46
47
|
- ✅ [remove-default-messages](#remove-default-messages);
|
|
47
48
|
- ✅ [remove-only](#remove-only);
|
|
@@ -52,7 +53,6 @@ npm i @putout/plugin-tape -D
|
|
|
52
53
|
- ✅ [remove-t-from-async](#remove-t-from-async);
|
|
53
54
|
- ✅ [switch-expected-with-result](#switch-expected-with-result);
|
|
54
55
|
- ✅ [sync-with-name](#sync-with-name);
|
|
55
|
-
- ✅ [move-out-result-from-assertion](#move-out-result-from-assertion);
|
|
56
56
|
|
|
57
57
|
## Config
|
|
58
58
|
|
|
@@ -96,7 +96,7 @@ npm i @putout/plugin-tape -D
|
|
|
96
96
|
"tape/remove-skip": ["on", {
|
|
97
97
|
"allowed": ["test"]
|
|
98
98
|
}],
|
|
99
|
-
"tape/
|
|
99
|
+
"tape/extract-result-from-assertion": "on"
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
```
|
|
@@ -653,6 +653,7 @@ test('sqlite: all returns empty array', async (t) => {
|
|
|
653
653
|
const rows = await db.all('SELECT x FROM t WHERE x = :x', {
|
|
654
654
|
x: 'missing',
|
|
655
655
|
});
|
|
656
|
+
|
|
656
657
|
await t.dbAll(rows, []);
|
|
657
658
|
|
|
658
659
|
t.end();
|
|
@@ -874,7 +875,7 @@ test('some test', (t) => {
|
|
|
874
875
|
});
|
|
875
876
|
```
|
|
876
877
|
|
|
877
|
-
##
|
|
878
|
+
## extract-result-from-assertion
|
|
878
879
|
|
|
879
880
|
Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/264bc87f56eae9aa2b2884ff64fe7a06/94836a115a072a18fd717d5454792c1895ab0476).
|
|
880
881
|
|
|
@@ -7,9 +7,10 @@ const {
|
|
|
7
7
|
isMemberExpression,
|
|
8
8
|
isOptionalMemberExpression,
|
|
9
9
|
isObjectExpression,
|
|
10
|
+
isArrayExpression,
|
|
10
11
|
} = types;
|
|
11
12
|
|
|
12
|
-
export const report = () => `
|
|
13
|
+
export const report = () => `Extract result from assertion`;
|
|
13
14
|
export const match = () => ({
|
|
14
15
|
't.__(__a(__b))': (vars, path) => !getBinding(path, 'result'),
|
|
15
16
|
't.__a(__b, __c)': ({__a, __b, __c}, path) => {
|
|
@@ -37,6 +38,9 @@ export const match = () => ({
|
|
|
37
38
|
if (expectedBinding)
|
|
38
39
|
return false;
|
|
39
40
|
|
|
41
|
+
if (isArrayExpression(__c))
|
|
42
|
+
return true;
|
|
43
|
+
|
|
40
44
|
return isObjectExpression(__c);
|
|
41
45
|
},
|
|
42
46
|
});
|
|
@@ -50,6 +54,10 @@ export const replace = () => ({
|
|
|
50
54
|
const result = __a(__b);
|
|
51
55
|
t.__(result);
|
|
52
56
|
}`,
|
|
57
|
+
'deepEqual(__a, __array)': `{
|
|
58
|
+
const expected = __array;
|
|
59
|
+
deepEqual(__a, expected);
|
|
60
|
+
}`,
|
|
53
61
|
't.__a(__b, __c)': ({__b, __c}, path) => {
|
|
54
62
|
const resultBinding = getBinding(path, 'result');
|
|
55
63
|
const expectedBinding = getBinding(path, 'expected');
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as removeTFromAsync from './remove-t-from-async/index.js';
|
|
2
2
|
import * as applyStringify from './apply-stringify/index.js';
|
|
3
|
-
import * as movOutResultFromAssertion from './move-out-result-from-assertion/index.js';
|
|
4
3
|
import * as applyAssertionsOrder from './apply-assertions-order/index.js';
|
|
5
|
-
import * as removeUselessUndefined from './remove-useless-undefined/index.js';
|
|
6
4
|
import * as extractArgsFromCalledWith from './extract-args-from-called-with/index.js';
|
|
5
|
+
import * as extractResultFromAssertion from './extract-result-from-assertion/index.js';
|
|
6
|
+
import * as removeUselessUndefined from './remove-useless-undefined/index.js';
|
|
7
7
|
import * as applyStub from './apply-stub/index.js';
|
|
8
8
|
import * as applyDestructuring from './apply-destructuring/index.js';
|
|
9
9
|
import * as applyWithName from './apply-with-name/index.js';
|
|
@@ -69,9 +69,9 @@ export const rules = {
|
|
|
69
69
|
'remove-only': removeOnly,
|
|
70
70
|
'remove-skip': removeSkip,
|
|
71
71
|
'extract-args-from-called-with': extractArgsFromCalledWith,
|
|
72
|
+
'extract-result-from-assertion': extractResultFromAssertion,
|
|
72
73
|
'remove-useless-undefined': removeUselessUndefined,
|
|
73
74
|
'apply-assertions-order': applyAssertionsOrder,
|
|
74
|
-
'move-out-result-from-assertion': movOutResultFromAssertion,
|
|
75
75
|
'apply-stringify': applyStringify,
|
|
76
76
|
'remove-t-from-async': removeTFromAsync,
|
|
77
77
|
};
|
package/package.json
CHANGED