Update testing-library packages for cra-template
See original GitHub issueDescribe the bug
The following package.json files need dependencies updated:
- https://github.com/facebook/create-react-app/blob/94932bedc09976aeac43615d95906aa2dcfefa1f/packages/cra-template/template.json
- https://github.com/facebook/create-react-app/blob/94932bedc09976aeac43615d95906aa2dcfefa1f/packages/cra-template-typescript/template.json
And the template code should be changed to use screen
:
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:
I think the rest of the template is irrelevant.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We won’t drop Node 8 until v4, and will review/update all packages at that time.
Ah yeah, it would be great if we drop node 8 so we can upgrade jest as well 😃