Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
GMartigny committed Mar 24, 2021
1 parent eb5e7d3 commit dbebb22
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"ava": {
"files": [
"!rules",
"test/*js"
"test/*.js"
]
},
"xo": {
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ The rules will only activate in test files.
- [no-async-fn-without-await](docs/rules/no-async-fn-without-await.md) - Ensure that async tests use `await`.
- [no-cb-test](docs/rules/no-cb-test.md) - Ensure no `test.cb()` is used.
- [no-duplicate-modifiers](docs/rules/no-duplicate-modifiers.md) - Ensure tests do not have duplicate modifiers.
- [no-error-ctor-with-notthrows](docs/rules/no-error-ctor-with-notthrows.md) - No specifying error type in `t.notThrows()`.
- [no-error-ctor-with-notthrows](docs/rules/no-error-ctor-with-notthrows.md) - Ensure no error constructor is specified in `t.notThrows()`.
- [no-identical-title](docs/rules/no-identical-title.md) - Ensure no tests have the same title.
- [no-ignored-test-files](docs/rules/no-ignored-test-files.md) - Ensure no tests are written in ignored files.
- [no-import-test-files](docs/rules/no-import-test-files.md) - Ensure no test files are imported anywhere.
Expand Down
41 changes: 20 additions & 21 deletions test/no-error-ctor-with-notthrows.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ const ruleTester = avaRuleTester(test, {

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

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

ruleTester.run('no-error-ctor-with-notthrows', rule, {
valid: [
`${header}
test('some test',t => {
test('some test', t => {
t.notThrows(() => {
t.pass();
});
Expand All @@ -39,32 +39,31 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
});`,

`${header}
test(t => {
t.end(); })`,
test(t => { t.end(); })`,

`${header}
test('some test',t => {
test('some test', t => {
t.notThrows(() => {
t.pass();
}, true);
});`,

`${header}
test('some test',t => {
test('some test', t => {
t.notThrows(() => {
t.pass();
}, 'some string');
});`,

`${header}
test('some test',t => {
test('some test', t => {
t.notThrows(() => {
t.pass();
}, {firstName:'some', lastName: 'object'});
});`,

`${header}
test('some test',t => {
test('some test', t => {
t.notThrowsAsync(() => {
t.pass();
});
Expand All @@ -78,19 +77,19 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
});`,

`${header}
test('some test',t => {
test('some test', t => {
t.notThrowsAsync(() => {
t.pass();
}, {firstName:'some', lastName: 'object'});
});`,

`${header}
test('some test',t => {
test('some test', t => {
notThrows(foo);
});`,

`${header}
test('some test',t => {
test('some test', t => {
myCustomNotThrows.notThrows(foo);
});`,

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

// Shouldn't be triggered since it's not a test file
`test('some test',t => {
`test('some test', t => {
t.notThrowsAsync(() => {
t.pass();
}, TypeError);
Expand All @@ -118,7 +117,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
},
{
code: `${header}
test('some test',t => {
test('some test', t => {
t.notThrows(() => {
t.pass();
}, TypeError);
Expand All @@ -136,7 +135,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
},
{
code: `${header}
test('some test',t => {
test('some test', t => {
t.notThrowsAsync(() => {
t.pass();
}, TypeError);
Expand All @@ -145,7 +144,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
},
{
code: `${header}
test('some test',t => {
test('some test', t => {
t.notThrowsAsync(() => {
t.pass();
}, Error);
Expand All @@ -154,7 +153,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
},
{
code: `${header}
test('some test',t => {
test('some test', t => {
t.notThrowsAsync(() => {
t.pass();
}, SyntaxError);
Expand All @@ -163,7 +162,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
},
{
code: `${header}
test('some test',t => {
test('some test', t => {
t.notThrowsAsync(() => {
t.pass();
}, AssertionError);
Expand All @@ -172,7 +171,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
},
{
code: `${header}
test('some test',t => {
test('some test', t => {
t.notThrowsAsync(() => {
t.pass();
}, ReferenceError);
Expand All @@ -181,7 +180,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
},
{
code: `${header}
test('some test',t => {
test('some test', t => {
t.notThrowsAsync(() => {
t.pass();
}, RangeError);
Expand All @@ -190,7 +189,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
},
{
code: `${header}
test('some test',t => {
test('some test', t => {
t.notThrowsAsync(() => {
t.pass();
}, SystemError);
Expand All @@ -199,7 +198,7 @@ ruleTester.run('no-error-ctor-with-notthrows', rule, {
},
{
code: `${header}
test('some test',t => {
test('some test', t => {
t.notThrowsAsync(() => {
t.pass();
}, $DOMError);
Expand Down

0 comments on commit dbebb22

Please sign in to comment.