Skip to content

Commit

Permalink
refactor: replace array check by allure1 reader from jPath to tag name
Browse files Browse the repository at this point in the history
  • Loading branch information
delatrie committed Jan 9, 2025
1 parent 4537d8a commit c3bbf2d
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions packages/reader/src/allure1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,15 @@ const RESERVER_LABEL_NAMES = new Set<string>([
STATUS_DETAILS_LABEL_NAME,
]);

const arrayTags: Set<string> = new Set([
"test-suite.labels.label",
"test-suite.test-cases.test-case",
"test-suite.test-cases.test-case.labels.label",
"test-suite.test-cases.test-case.parameters.parameter",
]);
const arrayTagPatterns = [
/^test-suite\.test-cases\.test-case(?:\.steps\.step)+$/,
/^test-suite\.test-cases\.test-case(?:\.steps\.step)*\.attachments\.attachment$/,
];
const arrayTags: Set<string> = new Set(["attachment", "label", "parameter", "step", "test-case"]);

const xmlParser = new XMLParser({
parseTagValue: false,
ignoreAttributes: false,
attributeNamePrefix: "",
removeNSPrefix: true,
allowBooleanAttributes: true,
isArray: (tagName, jPath) => arrayTags.has(jPath) || arrayTagPatterns.some((p) => p.test(jPath)),
isArray: arrayTags.has.bind(arrayTags),
});

const readerId = "allure1";
Expand Down

0 comments on commit c3bbf2d

Please sign in to comment.