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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test files to ignore list #2

Closed
alexandermukhin opened this issue Dec 14, 2022 · 3 comments
Closed

Test files to ignore list #2

alexandermukhin opened this issue Dec 14, 2022 · 3 comments

Comments

@alexandermukhin
Copy link

Hello!
Could you add test files (*.test.*, *.spec.*) to ignore list?

@ArnaudBarre
Copy link
Owner

Yes that would be possible but I'm curious about what pattern is reported by the rule in your test files? Maybe this could be an issue with the rule

@alexandermukhin
Copy link
Author

Something like this

import { render } from '@testing-library/react';
import MyComponent from './MyComponent';

// here I got an error
// ESLint: Fast refresh only works when a file has exports. Move your component(s) to a separate file.(react-refresh/only-export-components)
const TestChildComponent = ({ children }) => {
  return <div>{children}</div>;
};

describe('...', () => {
  it('...', async () => {
    const { getByText } = render(
      <MyComponent>
        <TestChildComponent>Demo component</TestChildComponent>
      </MyComponent>
    );

    expect(getByText('Demo component')).toBeInTheDocument();
  });
});

@ArnaudBarre
Copy link
Owner

Oh yeah I see. Yeah this warning makes sense for App entrypoints, but not for test entrypoints. I will skip the linter for those files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants