Skip to content

Commit c6cbd6d

Browse files
committed
refactor: extract GROUP_TAG_PREFIX constant in TestHierarchyBuilder
1 parent 6bb6989 commit c6cbd6d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

packages/phpunit/src/TestCollection/TestHierarchyBuilder.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { TestIdentifierFactory } from '../TestIdentifier/TestIdentifierFactory';
33
import { createDatasetDefinition } from '../TestParser/TestDefinitionBuilder';
44
import { type TestDefinition, TestType } from '../types';
55

6+
const GROUP_TAG_PREFIX = 'group';
7+
68
export interface ItemCollection<T> {
79
get(id: string): T | undefined;
810
add(item: T): void;
@@ -217,7 +219,9 @@ export abstract class TestHierarchyBuilder<T extends TestTreeItem<T>> {
217219
}
218220

219221
private inheritParentTags(testItem: T, parentItem: T) {
220-
const parentTags = (parentItem.tags ?? []).filter((t) => t.id.startsWith('group:'));
222+
const parentTags = (parentItem.tags ?? []).filter((t) =>
223+
t.id.startsWith(`${GROUP_TAG_PREFIX}:`),
224+
);
221225
if (parentTags.length === 0) {
222226
return;
223227
}
@@ -245,7 +249,7 @@ export abstract class TestHierarchyBuilder<T extends TestTreeItem<T>> {
245249

246250
const groups = (testDefinition.annotations?.group as string[]) ?? [];
247251
for (const g of groups) {
248-
tags.push(this.createTag(`group:${g}`));
252+
tags.push(this.createTag(`${GROUP_TAG_PREFIX}:${g}`));
249253
}
250254

251255
if (testDefinition.testsuite) {

0 commit comments

Comments
 (0)