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 1ec54fe commit 8e4133a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,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 8e4133a

Please sign in to comment.