Skip to content

Commit dbebb22

Browse files
committed
Review
1 parent eb5e7d3 commit dbebb22

File tree

3 files changed

+22
-23
lines changed

3 files changed

+22
-23
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"ava": {
6363
"files": [
6464
"!rules",
65-
"test/*js"
65+
"test/*.js"
6666
]
6767
},
6868
"xo": {

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ The rules will only activate in test files.
8585
- [no-async-fn-without-await](docs/rules/no-async-fn-without-await.md) - Ensure that async tests use `await`.
8686
- [no-cb-test](docs/rules/no-cb-test.md) - Ensure no `test.cb()` is used.
8787
- [no-duplicate-modifiers](docs/rules/no-duplicate-modifiers.md) - Ensure tests do not have duplicate modifiers.
88-
- [no-error-ctor-with-notthrows](docs/rules/no-error-ctor-with-notthrows.md) - No specifying error type in `t.notThrows()`.
88+
- [no-error-ctor-with-notthrows](docs/rules/no-error-ctor-with-notthrows.md) - Ensure no error constructor is specified in `t.notThrows()`.
8989
- [no-identical-title](docs/rules/no-identical-title.md) - Ensure no tests have the same title.
9090
- [no-ignored-test-files](docs/rules/no-ignored-test-files.md) - Ensure no tests are written in ignored files.
9191
- [no-import-test-files](docs/rules/no-import-test-files.md) - Ensure no test files are imported anywhere.

test/no-error-ctor-with-notthrows.js

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ const ruleTester = avaRuleTester(test, {
1313

1414
const errors = [{ruleId: 'no-error-ctor-with-notthrows'}];
1515

16-
const header = `const test = require('ava');\n`; // eslint-disable-line quotes
16+
const header = 'const test = require(\'ava\');\n';
1717

1818
ruleTester.run('no-error-ctor-with-notthrows', rule, {
1919
valid: [
2020
`${header}
21-
test('some test',t => {
21+
test('some test', t => {
2222
t.notThrows(() => {
2323
t.pass();
2424
});
@@ -39,32 +39,31 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
3939
});`,
4040

4141
`${header}
42-
test(t => {
43-
t.end(); })`,
42+
test(t => { t.end(); })`,
4443

4544
`${header}
46-
test('some test',t => {
45+
test('some test', t => {
4746
t.notThrows(() => {
4847
t.pass();
4948
}, true);
5049
});`,
5150

5251
`${header}
53-
test('some test',t => {
52+
test('some test', t => {
5453
t.notThrows(() => {
5554
t.pass();
5655
}, 'some string');
5756
});`,
5857

5958
`${header}
60-
test('some test',t => {
59+
test('some test', t => {
6160
t.notThrows(() => {
6261
t.pass();
6362
}, {firstName:'some', lastName: 'object'});
6463
});`,
6564

6665
`${header}
67-
test('some test',t => {
66+
test('some test', t => {
6867
t.notThrowsAsync(() => {
6968
t.pass();
7069
});
@@ -78,19 +77,19 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
7877
});`,
7978

8079
`${header}
81-
test('some test',t => {
80+
test('some test', t => {
8281
t.notThrowsAsync(() => {
8382
t.pass();
8483
}, {firstName:'some', lastName: 'object'});
8584
});`,
8685

8786
`${header}
88-
test('some test',t => {
87+
test('some test', t => {
8988
notThrows(foo);
9089
});`,
9190

9291
`${header}
93-
test('some test',t => {
92+
test('some test', t => {
9493
myCustomNotThrows.notThrows(foo);
9594
});`,
9695

@@ -100,7 +99,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
10099
}, void 0);`,
101100

102101
// Shouldn't be triggered since it's not a test file
103-
`test('some test',t => {
102+
`test('some test', t => {
104103
t.notThrowsAsync(() => {
105104
t.pass();
106105
}, TypeError);
@@ -118,7 +117,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
118117
},
119118
{
120119
code: `${header}
121-
test('some test',t => {
120+
test('some test', t => {
122121
t.notThrows(() => {
123122
t.pass();
124123
}, TypeError);
@@ -136,7 +135,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
136135
},
137136
{
138137
code: `${header}
139-
test('some test',t => {
138+
test('some test', t => {
140139
t.notThrowsAsync(() => {
141140
t.pass();
142141
}, TypeError);
@@ -145,7 +144,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
145144
},
146145
{
147146
code: `${header}
148-
test('some test',t => {
147+
test('some test', t => {
149148
t.notThrowsAsync(() => {
150149
t.pass();
151150
}, Error);
@@ -154,7 +153,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
154153
},
155154
{
156155
code: `${header}
157-
test('some test',t => {
156+
test('some test', t => {
158157
t.notThrowsAsync(() => {
159158
t.pass();
160159
}, SyntaxError);
@@ -163,7 +162,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
163162
},
164163
{
165164
code: `${header}
166-
test('some test',t => {
165+
test('some test', t => {
167166
t.notThrowsAsync(() => {
168167
t.pass();
169168
}, AssertionError);
@@ -172,7 +171,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
172171
},
173172
{
174173
code: `${header}
175-
test('some test',t => {
174+
test('some test', t => {
176175
t.notThrowsAsync(() => {
177176
t.pass();
178177
}, ReferenceError);
@@ -181,7 +180,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
181180
},
182181
{
183182
code: `${header}
184-
test('some test',t => {
183+
test('some test', t => {
185184
t.notThrowsAsync(() => {
186185
t.pass();
187186
}, RangeError);
@@ -190,7 +189,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
190189
},
191190
{
192191
code: `${header}
193-
test('some test',t => {
192+
test('some test', t => {
194193
t.notThrowsAsync(() => {
195194
t.pass();
196195
}, SystemError);
@@ -199,7 +198,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
199198
},
200199
{
201200
code: `${header}
202-
test('some test',t => {
201+
test('some test', t => {
203202
t.notThrowsAsync(() => {
204203
t.pass();
205204
}, $DOMError);

0 commit comments

Comments
 (0)