Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support all variations of describe, it, & test #792

Merged
merged 11 commits into from
Apr 5, 2021
Prev Previous commit
Next Next commit
test(require-top-level-describe): add cases for modifiers and each
  • Loading branch information
G-Rath committed Apr 4, 2021
commit 915e3ff1c485d10db678043ceddbc4f5a985adbd
17 changes: 17 additions & 0 deletions src/rules/__tests__/require-top-level-describe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const ruleTester = new TSESLint.RuleTester({

ruleTester.run('require-top-level-describe', rule, {
valid: [
'it.each()',
'describe("test suite", () => { test("my test") });',
'describe("test suite", () => { it("my test") });',
dedent`
Expand Down Expand Up @@ -89,9 +90,25 @@ ruleTester.run('require-top-level-describe', rule, {
`,
errors: [{ messageId: 'unexpectedHook' }],
},
{
code: "it.skip('test', () => {});",
errors: [{ messageId: 'unexpectedTestCase' }],
},
{
code: "it.each([1, 2, 3])('%n', () => {});",
errors: [{ messageId: 'unexpectedTestCase' }],
},
{
code: "it.skip.each([1, 2, 3])('%n', () => {});",
errors: [{ messageId: 'unexpectedTestCase' }],
},
{
code: "it.skip.each``('%n', () => {});",
errors: [{ messageId: 'unexpectedTestCase' }],
},
{
code: "it.each``('%n', () => {});",
errors: [{ messageId: 'unexpectedTestCase' }],
},
],
});