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(no-export): add cases for .each
  • Loading branch information
G-Rath committed Apr 4, 2021
commit 3444b5b274fcd4e1854691327aad1b4809b83ada
36 changes: 35 additions & 1 deletion src/rules/__tests__/no-export.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import dedent from 'dedent';
import resolveFrom from 'resolve-from';
import rule from '../no-export';

Expand All @@ -23,7 +24,40 @@ ruleTester.run('no-export', rule, {
invalid: [
{
code:
'export const myThing = "invalid"; test("a test", () => { expect(1).toBe(1);});',
'export const myThing = "invalid"; test("a test", () => { expect(1).toBe(1);});',
parserOptions: { sourceType: 'module' },
errors: [{ endColumn: 34, column: 1, messageId: 'unexpectedExport' }],
},
{
code: dedent`
export const myThing = 'invalid';

test.each()('my code', () => {
expect(1).toBe(1);
});
`,
parserOptions: { sourceType: 'module' },
errors: [{ endColumn: 34, column: 1, messageId: 'unexpectedExport' }],
},
{
code: dedent`
export const myThing = 'invalid';

test.each\`\`('my code', () => {
expect(1).toBe(1);
});
`,
parserOptions: { sourceType: 'module' },
errors: [{ endColumn: 34, column: 1, messageId: 'unexpectedExport' }],
},
{
code: dedent`
export const myThing = 'invalid';

test.only.each\`\`('my code', () => {
expect(1).toBe(1);
});
`,
parserOptions: { sourceType: 'module' },
errors: [{ endColumn: 34, column: 1, messageId: 'unexpectedExport' }],
},
Expand Down