@@ -8,27 +8,114 @@ const ruleTester = avaRuleTester(test, {
8
8
}
9
9
} ) ;
10
10
11
- const errors = [ { ruleId : 'no-typerror -with-notthrows' } ] ;
11
+ const errors = [ { ruleId : 'no-typeerror -with-notthrows' } ] ;
12
12
13
13
const header = `const test = require('ava');\n` ; // eslint-disable-line quotes
14
14
15
15
ruleTester . run ( 'no-typeerror-with-notthrows' , rule , {
16
16
valid : [
17
- `${ header } test('some test',t => {t.notThrows(() => {t.pass();});});` ,
18
- `${ header } test(t => {t.notThrows(() => {t.pass();});});` ,
19
- `${ header } test(t => {t.throws(() => {t.pass();}, TypeError);});` ,
20
- `${ header } test(t => {t.end(); })` ,
21
- `${ header } test('some test',t => {t.notThrows(() => {t.pass();}, true);});` ,
22
- `${ header } test('some test',t => {t.notThrows(() => {t.pass();}, 'some string');});` ,
23
- `${ header } test('some test',t => {t.notThrows(() => {t.pass();}, {firstName:'some', lastName: 'object'});});`
17
+ `${ header }
18
+ test('some test',t => {
19
+ t.notThrows(() => {
20
+ t.pass();
21
+ });
22
+ });` ,
23
+
24
+ `${ header }
25
+ test(t => {
26
+ t.notThrows(() => {
27
+ t.pass();
28
+ });
29
+ });` ,
30
+
31
+ `${ header }
32
+ test(t => {
33
+ t.throws(() => {
34
+ t.pass();
35
+ }, TypeError);
36
+ });` ,
37
+
38
+ `${ header }
39
+ test(t => {
40
+ t.end(); })` ,
41
+
42
+ `${ header }
43
+ test('some test',t => {
44
+ t.notThrows(() => {
45
+ t.pass();
46
+ }, true);
47
+ });` ,
48
+
49
+ `${ header }
50
+ test('some test',t => {
51
+ t.notThrows(() => {
52
+ t.pass();
53
+ }, 'some string');
54
+ });` ,
55
+
56
+ `${ header }
57
+ test('some test',t => {
58
+ t.notThrows(() => {
59
+ t.pass();
60
+ }, {firstName:'some', lastName: 'object'});
61
+ });` ,
62
+
63
+ `${ header }
64
+ test('some test',t => {
65
+ t.notThrowsAsync(() => {
66
+ t.pass();
67
+ });
68
+ });` ,
69
+
70
+ `${ header }
71
+ test(t => {
72
+ t.notThrowsAsync(() => {
73
+ t.pass();
74
+ });
75
+ });` ,
76
+
77
+ `${ header }
78
+ test('some test',t => {
79
+ t.notThrowsAsync(() => {
80
+ t.pass();
81
+ }, {firstName:'some', lastName: 'object'});
82
+ });`
24
83
] ,
25
84
invalid : [
26
85
{
27
- code : `${ header } test(t => {t.notThrows(() => {t.pass();}, TypeError);});` ,
86
+ code : `${ header }
87
+ test(t => {
88
+ t.notThrows(() => {
89
+ t.pass();
90
+ }, TypeError);
91
+ });` ,
92
+ errors
93
+ } ,
94
+ {
95
+ code : `${ header }
96
+ test('some test',t => {
97
+ t.notThrows(() => {
98
+ t.pass();
99
+ }, TypeError);
100
+ });` ,
101
+ errors
102
+ } ,
103
+ {
104
+ code : `${ header }
105
+ test(t => {
106
+ t.notThrowsAsync(() => {
107
+ t.pass();
108
+ }, TypeError);
109
+ });` ,
28
110
errors
29
111
} ,
30
112
{
31
- code : `${ header } test('some test',t => {t.notThrows(() => {t.pass();}, TypeError);});` ,
113
+ code : `${ header }
114
+ test('some test',t => {
115
+ t.notThrowsAsync(() => {
116
+ t.pass();
117
+ }, TypeError);
118
+ });` ,
32
119
errors
33
120
}
34
121
]
0 commit comments