You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
We need to have a way to highlight tests that are failing because of known bugs. Right now these tests are just failing and marked with red color.
However, the more tests we get - the harder it becomes to sort out unexpected failures in report.
On Jest level the perfect way to mark expected failures is test.failing('This test is failing and it's kind of ok now', ...) chainer.
But when we use it - such test has “passed“ status in Allure report - it's green. It's impossible to differentiate real passed tests from those that passed because we marked them with test.failing().
We would like to use it to mark test.failing() tests as BROKEN so they become in yellow color in Allure report. This way it's clear and immediately visible what tests are really passing, what tests are marked as test.failing(), thus "broken".
Describe alternatives you've considered
Only prepend test case name with "FAILING: " or something like this prefix, but they still will be in green color. Not convenient.
Additional context
Currently, for Allure v2.15.1, we overwritten allure-jest/node jest environment, changing the handleTestPass() method to do the following:
but it requires a lot of code and not developer-friendly solution, because we also need to copy getTestId and other functions, because they are not exported from allure-jest package
The full code:
// src/custom-allure-jest-node-environment.tsimporttype{Circus}from"@jest/types";// @ts-expect-error - module is availableimportAllureJestEnvironmentfrom"allure-jest/node";import{Stage,Status}from"allure-js-commons";exportconstgetTestPath=(testEntry: Circus.TestEntry|Circus.DescribeBlock): string[]=>{constpath=[];letcurrentUnit: Circus.DescribeBlock|Circus.TestEntry|undefined=testEntry;while(currentUnit){if(currentUnit.name){path.unshift(currentUnit.name);}currentUnit=currentUnit.parent;}// first element is always ROOT_DESCRIBE_BLOCK, which shouldn't be reportedreturnpath.slice(1);};exportconstgetTestId=(path: string[]): string=>path.join(" ");classCustomAllureEnvironmentextendsAllureJestEnvironment{handleTestPass(testEntry: Circus.TestEntry): void{constcurrentTestId=getTestId(getTestPath(testEntry));// @ts-expect-error - runningTests is private, but it's ok hereconstcurrentTest=this.runningTests.get(currentTestId)!;if(!currentTest){// eslint-disable-next-line no-consoleconsole.error(`Can't find "${currentTestId}" test while tried to mark it as passed!`);return;}currentTest.stage=Stage.FINISHED;currentTest.status=testEntry.failing ? Status.BROKEN : Status.PASSED;}}exportdefaultCustomAllureEnvironment;
Is your feature request related to a problem? Please describe.
We need to have a way to highlight tests that are failing because of known bugs. Right now these tests are just failing and marked with red color.
However, the more tests we get - the harder it becomes to sort out unexpected failures in report.
On Jest level the perfect way to mark expected failures is
test.failing('This test is failing and it's kind of ok now', ...)
chainer.But when we use it - such test has “passed“ status in Allure report - it's green. It's impossible to differentiate real
passed
tests from those that passed because we marked them withtest.failing()
.Describe the solution you'd like
Allure provides a static non-extendable set of statuses, and one of them is
BROKEN
: https://allurereport.org/docs/test-statuses/#brokenWe would like to use it to mark
test.failing()
tests asBROKEN
so they become in yellow color in Allure report. This way it's clear and immediately visible what tests are really passing, what tests are marked astest.failing()
, thus "broken".Describe alternatives you've considered
Only prepend test case name with "FAILING: " or something like this prefix, but they still will be in green color. Not convenient.
Additional context
Currently, for Allure
v2.15.1
, we overwrittenallure-jest/node
jest environment, changing thehandleTestPass()
method to do the following:but it requires a lot of code and not developer-friendly solution, because we also need to copy
getTestId
and other functions, because they are not exported fromallure-jest
packageThe full code:
and then we changed jest env in
jest.config.ts
:So can we
test.failing
withStatus.BROKEN
status by default?The text was updated successfully, but these errors were encountered: