Skip to content
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

Parser doesn't support absolute path to report files #29

Closed
salatamartin opened this issue Aug 29, 2023 · 0 comments
Closed

Parser doesn't support absolute path to report files #29

salatamartin opened this issue Aug 29, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@salatamartin
Copy link

When I try to run the reporter with an absolute path to the reports, e.g.

{
  "reports": [
    {
      "targets": [
        {
          "name": "influx",
          "inputs": {
            ...
          }
        }
      ],
      "results": [
        {
          "type": "junit",
          "files": ["/tmp/reports/*.xml"]
        }
      ]
    }
  ]
}

the parser doesn't find the report files, because it tries to prepend the path with the current working directory, failing on an error (if I were to run this from /tmp/test-runner folder): Error: ENOENT: no such file or directory, open '/tmp/test-runner/tmp/reports/results-2023-08-29T07:35:39.xml'.

I suspect it has to do with this portion of the code: https://github.com/test-results-reporter/parser/blob/main/src/helpers/helper.js#L8

Is there any reason the working directory is always prepended to the configured file path? If we are using a relative path, we shouldn't really need it and on the other hand, when we are using absolute path, it stops working completely. Moreover, before we get to this part of the code, we run the file matcher to expand the glob patterns here: https://github.com/test-results-reporter/parser/blob/main/src/parsers/index.js#L56 which works on the paths without adding cwd, so it already needs to work there correctly.

Can the affected part of the code just be removed, or do you have a use case where it is required?

@ASaiAnudeep ASaiAnudeep added the bug Something isn't working label Oct 22, 2023
bryanbcook added a commit to bryanbcook/test-results-parser that referenced this issue Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants