-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat: introduce __mocha_worker_id__
property
#4922
Conversation
@juergba could someone check this? How it could be merged? |
@juergba we really need this 👻 |
@outsideris could you please leave a review here? :) |
@epszaw I want to understand this issue before taking any decision. Adding some properties by reasoning it wouldn't break anything, doesn't convince at the moment. There are also a few custom reporters working in parallel mode. Some additional information by your side could help.
Could you read this issue #4403, please? Is it the same kind of issue? |
the main idea is that Allure reporter inits state and then users may modify the state within a test: it('simple test', function () {
allure.step('check A', function () {
//...
})
allure.step('check B', function () {
//...
})
}); Allure provides multiple features that allows users to enrich their tests reports with additional metadata such as steps, attachments, tags, labels and so on. All that is usually implemented by custom methods that interact with reporter's state. Besides that Allure offer Timeline feature -- that shows the distribution of the tests between hosts and workers: |
@juergba any news here? |
@juergba could you please provide any news here? |
Any news about this issue? Using allure methods inside a global fixtures there is no error:
The problem occurs here at the test spec:
|
If you have a problem with allure reporter, please, open an issue in the repo |
Requirements
Description of the Change
The PR brings
__mocha_worker_id__
property to tests, suites and hooks, just to understand on reporter level, which worker has been used and categorize multiple parallel tests on reporter level.At this moment, many solutions are compatible only with the serial mode and when we try to run parallel one current test/suite/hook will be overwritten.
This solution doesn't bring something, which can break the runner or any solution based on it because it adds
__mocha_worker_id__
field what hasMOCHA_WORKER_ID
value (or it equals toundefined
, e.g. in serial mode).Alternate Designs
I've tried to get
MOCHA_WORKER_ID
duringallure-mocha
reporter development, but it's not possible to get it due the reporter receives only IPC message.Why should this be in core?
Many people run
mocha
in parallel mode and they want to use their own or third-party reporters which are compatible only with serial mode, so we can't store any concurrent data inside. If we have worker ID, we would store running tests by it without any collision.Benefits
We can adapt any reporter to work in parallel mode. The main motivation – make
allure-mocha
work.Possible Drawbacks
__mocha_worker_id__
can beundefined
in the serial mode. Maybe it worth to omit the field, but from my vision, better to keep it all the time.Applicable issues
#4768