A way to turn off creation of default labels, or to remove them.
allure-jest and allure-playwright in v3 by default adds labels, such as package, in my use case i already setting custom label Package for my tests, which causes problems in Allure Testops, doubling entries for my tree.
Is there a way to disable creation of default labels?
Or is there some way to easily extend allure-jest and allure-playwright to remove those labels?
For Allure Testops users, the recommended way is to use any other custom label (e.g., prefix all the default labels with your company ID, such as company_package) instead of overriding the default ones.
By the way, your issue is valid, and we plan to support default label overriding. However, I'm not sure when we will push such a change.
From the Allure Framework perspective, the missing package label was a bug.
Thanks for your reply.
Some thoughts on solution:
It's would be nice to have some generic way to add default labels, or even more like tags and etc.
Config could specify some option like eachTest, markTest or whatever, which contains list of modules that exports
function which receives info about test as arguments and have access to labels, tag from allure-js-commons.
For sure integrations would need to implement that change, but on a bright side logic which actually sets current default labels will be moved out of integrations into single place. Current default behavior could looks like simple default setting: eachTest: ['allure-js-commons/default-labels'].
Also as a plus, right now if you want to add some global custom default labels to your jest test you would reach to use beforeEach, but that solution fall apart when you start marking test fro skip. Hook isn't triggered, labels not added.
You can provide default labels for all the tests using environment variables. See https://allurereport.org/docs/jest/#set-labels-globally. Is that what you want?
Sadly it's not enough for us, we populate labels with data extracted from test name, path to it and etc.
We added an additional configuration option to provide global labels for each reporter (see https://github.com/allure-framework/allure-js/pull/1217 and https://github.com/allure-framework/allure-js/pull/1221)
For conditional labels (e.g. when you add a label based on a test name or package), you can try to create a custom LifecycleListener which can be added via listeners reporter option. It's a beta API, so feel free to provide feedback!