Skip to content

Commit

Permalink
Rebase + add sort options
Browse files Browse the repository at this point in the history
  • Loading branch information
nekevss committed Apr 23, 2024
1 parent ab71f4a commit ee84166
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { availableSortingOptions } from "../../../utils";
type SelectorProps = {
state: ConformanceState;
suites: SuiteResult[];
esFlag: string | null;
navigateToSuite: (string) => void;
};

Expand All @@ -25,15 +24,16 @@ export default function SuiteSelector(props: SelectorProps): JSX.Element {
{props.suites
.sort(option[0].callback)
.filter((suite) => {
let versionStats: TestStats = suite.versionedStats[props.esFlag];
return versionStats.total !== 0;
let versionStats: TestStats =
suite.versionedStats[props.state.ecmaScriptVersion];
return versionStats?.total !== 0;
})
.map((suite) => {
return (
<SuiteItem
key={suite.name}
suite={suite}
esFlag={props.esFlag}
esFlag={props.state.ecmaScriptVersion}
navigateToSuite={props.navigateToSuite}
/>
);
Expand Down
73 changes: 73 additions & 0 deletions src/components/conformance/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,79 @@ export const availableSortingOptions: SortOption[] = [
name: "Reverse Alpha",
callback: (a, b) => -a.name.localeCompare(b.name),
},
{
id: "most-passed",
name: "Most Passed",
callback: (a, b) => b.stats.passed - a.stats.passed,
},
{
id: "least-passed",
name: "Least Passed",
callback: (a, b) => a.stats.passed - b.stats.passed,
},
{
id: "most-pass-percentage",
name: "Most Passed (%)",
callback: (a, b) =>
b.stats.total -
a.stats.total +
b.stats.passed / b.stats.total -
a.stats.passed / a.stats.total,
},
{
id: "least-pass-percentage",
name: "Least Passed (%)",
callback: (a, b) =>
b.stats.total -
a.stats.total +
a.stats.passed / a.stats.total -
b.stats.passed / b.stats.total,
},
{
id: "most-ignored",
name: "Most Ignored",
callback: (a, b) => b.stats.ignored - a.stats.ignored,
},
{
id: "least-ignored",
name: "Least Ignored",
callback: (a, b) => a.stats.passed - b.stats.passed,
},
{
id: "most-fail",
name: "Most Failed",
callback: (a, b) =>
b.stats.total -
(b.stats.passed + b.stats.ignored) -
(a.stats.total - (a.stats.passed + a.stats.ignored)),
},
{
id: "least-fail",
name: "Least Failed",
callback: (a, b) =>
a.stats.total -
(a.stats.passed + a.stats.ignored) -
(b.stats.total - (b.stats.passed + b.stats.ignored)),
},
{
id: "most-fail-percentage",
name: "Most Failed (%)",
callback: (a, b) =>
b.stats.total -
a.stats.total +
(b.stats.total - (b.stats.passed + b.stats.ignored)) -
(a.stats.total - (a.stats.passed + a.stats.ignored)),
},
{
id: "least-fail-percentage",
name: "Least Failed (%)",
callback: (a, b) =>
b.stats.total -
a.stats.total +
(a.stats.total - b.stats.total) +
a.stats.passed / a.stats.total -
b.stats.passed / b.stats.total,
},
];

// Interface for the http response of boa_tester's `ResultInfo`
Expand Down

0 comments on commit ee84166

Please sign in to comment.