jest-report-action
jest-report-action copied to clipboard
Following tests failed, but could not be found in the source files:
How to debug "Following tests failed, but could not be found in the source files:"
I see something like this
These are all the test results I was able to find from your jest-junit reporter
55 tests were completed in 22.371s with 55 passed heavy_check_mark and 0 failed heavy_multiplication_x tests.
Following tests failed, but could not be found in the source files:
ComponentBeta ComponentBeta - renders without error
ComponentBeta ComponentBeta - should render post load
ComponentBeta ComponentBeta - making a successful action
TipAmount > matches snapshot
AmountBeta > matches snapshot
...
And not the same as the screenshot shown in the readme
I presume either the test file or the test name could not be found. You should check if the junit file has the right paths to the test files relative to the working directory option and if the test name matches a test within the test file itself.
Sorry for the delayed response
I was getting the same issue. Here's what I did to resolve the issue:
Add this block into the package.json file. My test file App.test.jsx
is located in the src folder (I'm using the default demo create react app).
"jest-junit": {
"suiteNameTemplate": "src/{filename}"
},
Execute your npm command to run the test. This produces a junit.xml file in the root directory. The test suite name now contains the test file name along with the path from the root directory where the junit file is located to the test file.
<testsuite name="./src/App.test.jsx">
I'm not 100% sure and convinced why this approach is preferred. Without the setting above, it is still able to run the test, but not able to locate the file, which is weird because it must have had to find the file to run the test? Anyway, hope this helps.
Just as an FYI for anyone who, like me stumbles upon this issue: The error may also be displayed, if the test fails without a stacktrace. This happend to me in an integration test when the database was not set up correctly.