Create-react-app: Update testing-library packages for cra-template

Created on 23 Mar 2020  路  6Comments  路  Source: facebook/create-react-app

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.

proposal

Most helpful comment

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

All 6 comments

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

Jest upgrade is happening in #8362

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

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

Sounds reasonable 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xgqfrms-GitHub picture xgqfrms-GitHub  路  3Comments

jnachtigall picture jnachtigall  路  3Comments

dualcnhq picture dualcnhq  路  3Comments

stopachka picture stopachka  路  3Comments

AlexeyRyashencev picture AlexeyRyashencev  路  3Comments