Using with create-react-app typescript?
See original GitHub issueEnvironment
-
node -v
: 8.9.2 -
npm -v
: -
npm ls react-scripts
(if you haven’t ejected): Yes (TypeScript) -
Operating system: Windows
Steps to Reproduce
Create brand new project with cra: create-react-app my-app --scripts-version=react-scripts-ts . Apptest.tsx is:
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
expect(1).toBe(2);
});
Expected Behavior
Tests are detected and auto run with highlighting within vscode showing green or red if they pass or not.
Actual Behavior
I was under the impression (maybe wrongly) that the plugin should just auto work even with CRA typescript? instead the extension fails to find any tests in the output window and going into my tests i don’t get any highlighting (as it hasn’t found my tests).
Any help appreciated.
Issue Analytics
- State:
- Created 6 years ago
- Comments:26 (12 by maintainers)
Top Results From Across the Web
Create React App and TypeScript: A Quick How-To | Built In
If you're building a new app and using create-react-app , the docs are great: You can start a new TypeScript app using templates....
Read more >Create React App with TypeScript - Complete Guide
To create a React App with Typescript, run the npx create-react-app command with the --template flag set to typescript , e.g. npx create-react-app...
Read more >TypeScript and React using create-react-app - Level Up Coding
create -react-app is a command line tool that allows developers to easily create new React apps with sensible defaults and zero configuration. ......
Read more >How to Use Create React App With TypeScript
To view Create React App, open your terminal, navigate to your workspace directory and run the below command. ... This is going to...
Read more >Building a React App with TypeScript - Section.io
As you might have guessed, to set up a react typescript application, we'd still use create-react-app just with some extra flags.
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
Thanks for the info. I could reproduce that bug. When we decide how to run your tests we look for
jest
andreact_scripts
innode_modules
. Since we findjest
beforereact-scripts(-ts)
we incorrectly start running tests withjest
instead of thenpm test
script.For now, your workaround would be to add a user setting in
.vscode/settings.json
:No worries. Well it’s documented here so if someone else runs into the problem at least they know how I managed to fix it 😄