-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using with create-react-app typescript? #244
Comments
It should work out of the box @qwerty2k. Let's investigate! |
Hi Sean, thanks for offering to help! Not quite sure what you mean by setting up my workspace in vscode but hopefully the following information may help. Im on Windows 7. In vscode i have uninstalled all extensions apart from Jest. i created my project with create-react-app typescript:
Upon loading the project in the output window of vscode jest says:
Which i can understand as the testMatch is seemingly only looking for js and jsx when mine are tsx. If i run:
If i view my .test.tsx file then i get no IDE indication that my tests have been detected (which i guess is as expected given the output window), if i change the file extension to .js then the little gren and red blobs appear so it would seem my tests are detected, they however still won't run as it doesn't seem to like any jsx in the files. If you need any more information please let me know. |
Thanks for the extra detail. I'll create an app now.
I meant which folder did you open in VS Code? The extension expects to find |
i opened the top level folder which contains the node_modules folder. |
Thanks for the info. I could reproduce that bug. When we decide how to run your tests we look for For now, your workaround would be to add a user setting in {
"jest.pathToJest": "npm.cmd test --"
} |
Sean, that's great thank you! |
I don't think that finding |
I'd like to point out that I'm using react-scripts-ts myself. And it works. On the other hand, I have still to make the 'debug' button to actually do something. |
Is it possible that you are running on Linux or using an old version of npm? |
No, I'm on windows with npm 5.5.1. Shouldn't be a problemn. Especially considering I can debug using a custom launch.json :
(react-rewired app binded to react-scripts-ts) |
|
That's not entirely true. You don't need I don't have react-scripts in my node_modules nor did I specify But I still can't use the 'debug' button. |
You can test it using this repository https://github.com/nfq-eta/react-typescript |
This issue should be fixed by #266. |
I'm closing it since it got resolved with today's update. |
This can be moved to the Done column of the board (you can also set up column automations to move closed issues to Done). |
Thanks Nick. |
@stephtr not sure if it's worth raising a new issue, but I'm getting this problem with the normal CRA which now supports TS builds out of the box. It's not picking up the inbuilt CRA configuration unless I use the Let me know if you want me to raise a new bug on it. |
I just tested it creating a new project using |
Yep no worries, I'll give it a go. FWIW I started off with a normal JS CRA project, then renamed my files to TS, so it's possible I'm missing some project level configuration (though CRA did create a whole bunch of TS stuff for me on my first build after detecting TS). |
@stephtr I worked out the culprit here. I setup my project using the Visual Studio (IDE not Code) React template, which set my The detection you guys are using for If I change the script to just be |
Probably not really, since the automatic detection is just for convenience and not thought to support all possible different scenarios. I'm definitely not happy with the choice made by the VS template, since the idea behind |
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 😄 |
@JoshSchreuder you are amazing X_X thanks for that. |
#244 (comment) |
Maybe we should add the handling of |
Environment
node -v
: 8.9.2npm -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:
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.
The text was updated successfully, but these errors were encountered: