question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update testing-library packages for cra-template

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
ianschmitzcommented, Mar 24, 2020

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

1reaction
kentcdoddscommented, Mar 24, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Testing Library
The React Testing Library is a very light-weight solution for testing React components. It provides light utility functions on top of react-dom ...
Read more >
cra-template-npm-library
Create React App template to build and publish NPM libraries with rollup, eslint and stylelint. Latest version: 1.2.1, last published: 2 ...
Read more >
cra-template-npm-library - npm package - Snyk
Create React App template to build and publish NPM libraries with rollup, eslint and stylelint For more information about how to use this...
Read more >
create-react-app dependency version issues with React 18
Go to the installed cra-template package folder and in file "template.json" change the line '"@testing-library/react": "^12.0.0"' to ...
Read more >
cra-template-communication-react - NPM Package Overview
Boilerplate set up to use Azure Communication Services UI Library. Version: 0.3.0 was published by ddematheu. Start using Socket to analyze ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found