From 6ab1dd6caf5162cd82a0ec1d8828ba30df4dabb3 Mon Sep 17 00:00:00 2001 From: John Grimes Date: Tue, 27 Aug 2024 11:21:52 +1000 Subject: [PATCH] Modify test report to group by tag --- test_report/src/Impls.svelte | 79 ++++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 21 deletions(-) diff --git a/test_report/src/Impls.svelte b/test_report/src/Impls.svelte index 35a2305..d5208a1 100644 --- a/test_report/src/Impls.svelte +++ b/test_report/src/Impls.svelte @@ -2,6 +2,30 @@ import { onMount } from "svelte"; import implementations from '../public/implementations.json'; import tests from '../public/tests.json'; + + // Get all the unique tags in the test suite. + const tags = new Set(); + tests.forEach(test => { + test.tests.forEach(t => { + t.tags.forEach(tag => tags.add(tag)); + }); + }); + console.log("tests", tests); + console.log("tags", tags); + // Construct a mapping of tag to display name, with the reserved tags first. + const reservedTags = { + shareable: "Profile: Shareable View Definition", + tabular: "Profile: Tabular View Definition", + experimental: "Experimental" + } + const otherTags = Array.from(tags) + .filter(tag => !Object.keys(reservedTags).includes(tag)) + .reduce((acc, tag) => { + acc[tag] = tag; + return acc; + }, {}); + const sections = { ...reservedTags, ...otherTags } + console.log("sections", sections); async function load(file){ try { @@ -31,7 +55,7 @@ - + {#each impls as impl} - {#each tests as test} - - + {#each Object.keys(sections) as section} + {#if tags.has(section)} + + - {#each test?.tests || [] as t, i} + {#each tests as test} + {#if (test?.tests || []).find(t => t.tags.includes(section))} - - {#each impls as impl} - {@const res = ((((impl.results || {})[test.file] || {}).tests || [])[i]?.result?.passed)} - - {/each} + {#each test?.tests || [] as t, i} + {#if t.tags.includes(section)} + + + {#each impls as impl} + {@const res = ((((impl.results || {})[test.file] || {}).tests || [])[i]?.result?.passed)} + + {/each} + + {/if} + {/each} + {/if} {/each} + {/if} {/each}
TestTest {impl.name} @@ -41,31 +65,44 @@
- {test.title} -
+ {sections[section]} +
- {t.title} + + {test.title} - {#if res === true} - - {:else if res === false } - - {:else} - - - {/if} -
+ {t.title} + + {#if res === true} + + {:else if res === false } + + {:else} + - + {/if} +