Pre Release New Changes
This commit is contained in:
@@ -80,11 +80,25 @@ test("component reference contains only explicitly declared public events", () =
|
||||
) as { components: Array<{ name: string; events: string[] }> };
|
||||
|
||||
for (const component of reference.components) {
|
||||
const source = readFileSync(uiComponentPath(component.name), "utf8");
|
||||
const componentPath = uiComponentPath(component.name);
|
||||
const source = readFileSync(componentPath, "utf8");
|
||||
|
||||
const declaredEvents = [
|
||||
...source.matchAll(/@event\s+([A-Za-z][A-Za-z0-9_]*)\s*=\s*function/g),
|
||||
].map((match) => match[1]);
|
||||
expect(component.events).toEqual([...new Set(declaredEvents)]);
|
||||
|
||||
const expectedEvents = [...new Set(declaredEvents)];
|
||||
|
||||
if (JSON.stringify(component.events) !== JSON.stringify(expectedEvents)) {
|
||||
console.error("UI EVENT REFERENCE MISMATCH", {
|
||||
component: component.name,
|
||||
componentPath,
|
||||
referenceEvents: component.events,
|
||||
declaredEvents: expectedEvents,
|
||||
});
|
||||
}
|
||||
|
||||
expect(component.events).toEqual(expectedEvents);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user