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 packages for cra-template #8699

Closed
kentcdodds opened this issue Mar 23, 2020 · 6 comments · Fixed by #8705
Closed

Update testing-library packages for cra-template #8699

kentcdodds opened this issue Mar 23, 2020 · 6 comments · Fixed by #8705

Comments

@kentcdodds
Copy link
Contributor

Describe the bug

The following package.json files need dependencies updated:

And the template code should be changed to use screen:

https://github.com/facebook/create-react-app/blob/8a1ee2f7a531d83cb76cc882d1e346c5cdd55f56/packages/cra-template-typescript/template/src/App.test.tsx

  import React from 'react';
- import { render } from '@testing-library/react';
+ import { render, screen } from '@testing-library/react';
  import App from './App';

  test('renders learn react link', () => {
-   const { getByText } = render(<App />);
-   const linkElement = getByText(/learn react/i);
+   render(<App />);
+   const linkElement = screen.getByText(/learn react/i);
    expect(linkElement).toBeInTheDocument();
  });

And the same treatment for this one:

https://github.com/facebook/create-react-app/blob/2de57fe15a69a84fadb08ce549599c7de5a9d3b2/packages/cra-template/template/src/App.test.js

I think the rest of the template is irrelevant.

@MichaelDeBoey
Copy link
Contributor

In order to update the dependencies, the templates needs Node 10+.
Right now they're supporting Node 8 (cra-template) & Node 8.10 (cra-template-typescript).

"engines": {
"node": ">=8"
},

"engines": {
"node": ">=8.10"
},

@kentcdodds
Copy link
Contributor Author

Ah yeah, it would be great if we drop node 8 so we can upgrade jest as well :)

@MichaelDeBoey
Copy link
Contributor

Jest upgrade is happening in #8362

@MichaelDeBoey
Copy link
Contributor

@ianschmitz Not all of this is done, so this one should be re-opened I think 🙂

@ianschmitz
Copy link
Contributor

We won't drop Node 8 until v4, and will review/update all packages at that time.

@kentcdodds
Copy link
Contributor Author

Sounds reasonable 👍

@lock lock bot locked and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants