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

Update Testing Library #8959

Closed
kentcdodds opened this issue May 5, 2020 · 7 comments · Fixed by #8963
Closed

Update Testing Library #8959

kentcdodds opened this issue May 5, 2020 · 7 comments · Fixed by #8963
Milestone

Comments

@kentcdodds
Copy link
Contributor

Is your proposal related to a problem?

I want to ensure people are set up for success when testing

Describe the solution you'd like

The default template should include the latest version of testing library packages.

Also, the ESLint config should include the testing library ESLint plugins:

With that in mind, how do people typically run linting for files not bundled by webpack? Should we include a lint script?

Describe alternatives you've considered

Leaving things as-is and letting users do this themselves.

Additional context

I've noticed people making some common mistakes and want to help them avoid those.

@iansu
Copy link
Contributor

iansu commented May 5, 2020

We're currently working on upgrading to Jest 26 so we'll definitely be bumping the testing library dependencies before release.

As far as the new ESLint plugins, we should be able to add those pretty easily as well. Someone just needs to make a PR for it. Not sure if we will need to customize any config for them.

@iansu iansu added this to the 4.0 milestone May 5, 2020
@iansu iansu removed the needs triage label May 5, 2020
@kentcdodds
Copy link
Contributor Author

kentcdodds commented May 5, 2020

For anyone who wants to work on adding the eslint plugins, here's a config that I personally recommend: https://github.com/kentcdodds/eslint-config-kentcdodds/blob/c2b55abe30270b105eb7ce8cf65bfd24dc4125cf/jest.js#L76-L104

(Don't forget the plugins entries https://github.com/kentcdodds/eslint-config-kentcdodds/blob/c2b55abe30270b105eb7ce8cf65bfd24dc4125cf/jest.js#L28-L32).

I'm not sure whether the hasJestDom and hasTestingLibrary are necessary. I'm kinda thinking it would be a good idea though in case someone removes those packages.

@kentcdodds
Copy link
Contributor Author

@kentcdodds
Copy link
Contributor Author

Oh, also, any thoughts on this:

With that in mind, how do people typically run linting for files not bundled by webpack? Should we include a lint script?

@ianschmitz
Copy link
Contributor

With that in mind, how do people typically run linting for files not bundled by webpack? Should we include a lint script?

It's been a long standing question (#1217) that we've had. Interested to know if there's significant demand still

I personally generally end up creating my own lint script in my project that might include some other tooling as well in addition to ESLint. The biggest reason for me was the ability to lint test files including running tsc --noEmit to make sure there's no typing issues in my tests.

@ianschmitz
Copy link
Contributor

As far as the testing library packages go, they were updated to latest at the time in #8406.

@iansu
Copy link
Contributor

iansu commented Aug 5, 2020

This is done and will be in the next release so I'm going to close this issue.

@iansu iansu closed this as completed Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants