Describe the bug
Facing problem while running tests.
Seems like react-scripts do not support following statement inside class components
declare context: React.ContextType<typeof FormContext>;
Did you try recovering your dependencies?
No
(paste the output of the command here.)
Steps to reproduce
(Write your steps here:)
- Create an app using command
npx create-react-app my-app --template typescript
- Create a class component :
import React, { Fragment } from "react";
class TestAbc extends React.Component {
declare context: React.ContextType<typeof FormContext>;
render() {
return <Fragment>Hi</Fragment>
}
}
- Create a test case for component created in above step
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';
import TestAbc from './TestAbc';
test('renders learn react link', () => {
render(<TestAbc />);
});
- Run test case using command:
npm run test
Expected behaviour
Test case should pass
Actual behaviour
Giving error while running test.

Reproducible demo
Describe the bug
Facing problem while running tests.
Seems like react-scripts do not support following statement inside class components
declare context: React.ContextType<typeof FormContext>;Did you try recovering your dependencies?
No
(paste the output of the command here.)
Steps to reproduce
(Write your steps here:)
npx create-react-app my-app --template typescriptnpm run testExpected behaviour
Test case should pass
Actual behaviour
Giving error while running test.

Reproducible demo