Skip to content

Commit

Permalink
chore: update jest-allure2-reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
noomorph committed May 6, 2024
1 parent 43578ad commit 54121d4
Showing 1 changed file with 16 additions and 30 deletions.
46 changes: 16 additions & 30 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,22 @@ const { findLemmaById, toHTML } = require('./dist/__utils__');

const isId = (value) => Number.isFinite(parseInt(value, 10));

/** @type {import('jest-allure2-reporter').ReporterConfig} */
/** @type {import('jest-allure2-reporter').ReporterOptions} */
const allureConfig = {
executor: {
reportName: '@interslavic/utils',
},
testCase: {
hidden: (context) =>
ignored: (context) =>
context.testCase.status === 'passed' ||
context.testCase.status === 'skipped' ||
context.testCase.status === 'pending',
name: ({ testCase, value }) => {
displayName: ({ testCase, value }) => {
const maybeId = testCase.title;
return isId(maybeId) ? findLemmaById(String(maybeId)) : value;
},
parameters: ({ testCase, value = [] }) => {
const maybeId = testCase.title;
return isId(maybeId)
? [
...value,
{
name: 'ID',
value: String(maybeId),
},
]
: value;
parameters: {
ID: ({ testCase }) => (isId(testCase.title) ? testCase.title : undefined),
},
statusDetails: ({ value }) => {
if (value?.message?.includes(').toMatchSnapshot(')) {
Expand Down Expand Up @@ -83,20 +77,16 @@ const allureConfig = {
},
},
testFile: {
hidden: () => false,
name: ({ filePath }) => {
ignored: false,
displayName: ({ filePath }) => {
return filePath.slice(1).join('/');
},
parameters: ({ testFile, value = [] }) => [
...value,
{
name: 'Total tests',
value:
testFile.numPassingTests +
testFile.numFailingTests +
testFile.numPendingTests,
},
],
parameters: {
'Total tests': ({ testFile }) =>
testFile.numPassingTests +
testFile.numFailingTests +
testFile.numPendingTests,
},
status: ({ testFile, value }) => {
return testFile.numFailingTests > 0 ? 'failed' : value;
},
Expand All @@ -111,10 +101,6 @@ const allureConfig = {
return summary + '\n\n' + value;
},
},
executor: ({ value }) => ({
...value,
reportName: '@interslavic/utils',
}),
};

/** @type {import('jest').Config} */
Expand Down

0 comments on commit 54121d4

Please sign in to comment.