webdriverio/webdriverio

[🐛 Bug]: Jasmine and the JUnit reporter output empty spec files since v8.15.9 due to suite file property not including path

Open

#13,052 opened on 2024年6月19日

GitHub で見る
 (1 comment) (0 reactions) (0 assignees)JavaScript (6,029 stars) (1,793 forks)batch import
Bug 🐛help wanted

説明

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

v8.39.0

Node.js Version

v18.17.1

Mode

WDIO Testrunner

Which capabilities are you using?

No response

What happened?

I recently bumped our WDIO dependencies for latest Chrome compatibility, and noticed that our JUnit reports started coming out empty:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites/>

I pinned this down to the changes in https://github.com/webdriverio/webdriverio/releases/tag/v8.15.9 , and in particular https://github.com/webdriverio/webdriverio/pull/10977 (fixing report test duplication). In order to address the duplicate reports, "same file" detection was added, comparing the spec file name to the suite file path; on main this is done here.

When running with the Jasmine framework, the suite.file is a single filename (eg concurrency.spec.js) while the specFileName is a full file path (eg /Users/rowan/code/.../__test__/tests/specs/headless/concurrency.spec.js). So the duplicate detection rejects the log, and no suite results get output.

Digging through the various pieces involved, I can see that wdio-reporter has some code to try to provide a file if the jasmine reporter doesn't provide it, but this doesn't appear to get invoked. Instead, the jasmine-reporter does appear to supply a file property - but it's using only the filename, not the filepath.

What is your expected behavior?

This is somewhat of a post-and-run - I don't have time to do a full repro case today, so I'm creating this bug as a placeholder so I will remember to update it later. I'm fairly confident that the jasmine-reporter needs to supply a full filepath but I don't yet see how best to do that :grin

How to reproduce the bug.

(Use jasmine framework + junit reporter. Repro project to follow)

Relevant log output

"junit" Reporter:
<?xml version="1.0" encoding="UTF-8"?>
<testsuites/><?xml version="1.0" encoding="UTF-8"?>
<testsuites/>

Spec Files:	 2 passed, 2 total (100% completed) in 00:00:28  


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

### Is there an existing issue for this?

- [X] I have searched the existing issues

コントリビューターガイド