Comments (6)
Hi @goelankit.
I think that condition is to prevent reporting it wrong in some nesting scenarios.
There's a unit test with failing hooks which is passing, but perhaps it's different to your case.
Could you provide more details about your case?
- mocha version
- which kind of hook you are using
If you could attach a minimum reproducible example it would be great.
Thanks.
from mocha-trx-reporter.
Hi @pmoleri ,
I think it might not be working as expected in the mocha parallel mode. I see that if I run the test in sequenced mode the report come up fine.
BTW, the same issue if the test is marked as skipped in parallel mode, the test is marked as "Inconclusive" in the output report, that also breaks our upstream workflows.
Mocha version: 8.0.1
Using "before" hook.
Please find attached the minimal repro for this.
- Run "npm install"
- Run "npm run test" to run test in parallel mode, observe Result.trx doesn't have failure entry (Not OK)
- Run "npm run test-seq" to run test in sequenced mode, observe Result.trx has failure entry (OK)
Similar for Skipped test showing up as "Inconclusive" in parallel mode.
- Uncomment this.skip (line 10) in test1.js.
- Run "npm run test" to run test in parallel mode, observe Result.trx doesn't have test marked as pending (Not OK)
- Run "npm run test-seq" to run test in sequenced mode, observe Result.trx has the test marked as pending (OK)
We have our tests configured to run in parallel mode, and really looking forward to be able to consume mocha-trx-reporter in parallel mode as well.
from mocha-trx-reporter.
@goelankit
I see there are some caveats in parallel mode.
It seems it's giving us a simplified object, i.e. instead of Suite class object we get a plain JS object with only some properties.
That means that hook.parent and suite are different objects and that we don't get suite.eachTest() method, so we don't have any way to get the list of tests that were skipped due to a failed "before all" hook.
Also consider that reporting failed hooks is something that I included in this reporter, but I haven't seen in other reporters.
To sum up:
For "before each" hook, we can set the error in each test.
For "before all" hook, I don't know if there's any way to report them in TRX, because we don't have any information about the tests that did not run.
from mocha-trx-reporter.
@pmoleri , I think the issue is happening due to how the pending information for the test is surfaced between sequenced and parallel execution (which is perhaps a mocha issue). In parallel run, test.isPending() is how the info is available.
If I change line 97 in test-to-trx.js to,
if (test.pending === true || test.isPending() === true) {
I see the output trx report getting generated fine for for parallel runs as well now with this change. The test gets marked correctly as pending now instead of inconclusive.
I was not able to push a branch to the repo, any chance you can take a look at the change and get it in. Thanks in advance!
from mocha-trx-reporter.
Hi @pmoleri , Gentle reminder on this. Can you please check my previous reply and incorporate the change (zip file attached) in the code. Thanks!
from mocha-trx-reporter.
Hi @pmoleri , Gentle reminder on this. Can you please check @goelankit 's previous reply and incorporate the change (zip file attached) in the code. Thanks!
from mocha-trx-reporter.
Related Issues (11)
- Installation problems behind proxy HOT 1
- readme doesn't give usage for most reporter-options HOT 3
- JS Errors are not populating <Message> field in .trx file
- Failing mocha hooks lead to missing unit tests HOT 3
- generating trx with classname and name as none HOT 3
- Vulnerability HOT 1
- "mocha-trx-reporter" throwing error as "TypeError: Cannot read property 'start' of undefined"" HOT 5
- Add support for screenshots HOT 7
- mocha-trx-reporter don't save the TRX file to disk, HOT 5
- Mocha-trx-reporter crashes when used from cypress HOT 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mocha-trx-reporter.