Closed rbagriy-nix closed 2 years ago
You still need to use react-app-rewired test
when using the --testNamePattern option. I believe the "test" option would go in the "Jest Options" field in Webstorm (I haven't used that editor, but that's where options would go if running jest directly so it would make sense that it'd be where options for react-app-rewired would go).
i.e. the final command should be react-app-rewired test --testNamePattern="renders learn react link"
. I'm confused why your output doesn't have the test name pattern value in quotes - without quotes or escaping the spaces it may be resulting in the pattern being set to "renders" with the other words being considered additional jest options.
I don't know where the "--colors" is coming from, but my suspicion is that it's caused either by not specifying that you're running the test target or due to the pattern not being quoted.
Yep thank you , you were right. But I runned this test by clicking button on icon run test. Its seems webstorm puts params without ""
very wierd because with react-scripts works.
Thre result for call would be "C:\Program Files\nodejs\node.exe" --require "C:\Program Files\JetBrains\WebStorm 2020.3.2\plugins\JavaScriptLanguage\helpers\jest-intellij\lib\jest-intellij-stdin-fix.js" C:\work\fluke\fpi\node_modules\react-app-rewired\bin\index.js --colors --reporters "C:\Program Files\JetBrains\WebStorm 2020.3.2\plugins\JavaScriptLanguage\helpers\jest-intellij\lib\jest-intellij-reporter.js" --verbose "--testNamePattern=^renders learn react link$" --runTestsByPath C:/work/fluke/fpi/specs/Index/Index.spec.tsx
So adding the "test" parameter in the Jest Options field fixed the issue (I'm not seeing 'test' in your example call)?
Yep, if I add test it works. Thank you. Maybe we also can add extra check to avoid this behaviour? From args check if in Array we have --testNamePattern or --runTestsByPath. It's only advice.
Thank you for quick support.
The test parameter always needs to be present - it's not something special for --testNamePattern, it's required and documented as required in the readme. It tells react-app-rewired (and therefore react-scripts) that you're running tests rather than compiling or running in dev mode.
As such I don't think any extra checks are needed - tests will never work if you don't specify that you're running the 'test' scripts.
Make sense thank got it .
Hello I configured jest for run test
When I try to run single test or test suite it fails because WebStorm run test with extra props --testNamePattern .
Whole my behavior.
I go to file with test and try to run single test or suitcase ...
run command "test" works fine, only while running single tests or etc.