jest-report-action icon indicating copy to clipboard operation
jest-report-action copied to clipboard

Following tests failed, but could not be found in the source files:

Open franz-see opened this issue 3 years ago • 3 comments

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

franz-see avatar Dec 19 '20 13:12 franz-see

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

IgnusG avatar Jan 06 '21 11:01 IgnusG

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.

ClydeDz avatar Mar 16 '21 09:03 ClydeDz

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.

Khartir avatar Jul 02 '21 07:07 Khartir