Skip to content

Commit

Permalink
fix: make sort order of test result asc
Browse files Browse the repository at this point in the history
  • Loading branch information
tasshi-me committed Aug 16, 2022
1 parent 051e9e2 commit c1a8c33
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
46 changes: 23 additions & 23 deletions src/dashboard/__tests__/fixtures/converter/expected-dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,6 @@ import type { Dashboard, TestFile } from "../../../types.js";
import { testDuration, testStartTime } from "../../helpers/datetime.js";

const testFiles: TestFile[] = [
{
filePath: "src/__tests__/sample-2.test.ts",
permalink:
"https://github.com/mshrtsr/jest-md-dashboard/blob/main/src/__tests__/sample-2.test.ts",
numPassingTests: 4,
numFailingTests: 0,
numTodoTests: 0,
duration: 3.869,
children: [
{
type: "describe",
describe: "describe depth 1",
status: "passed",
children: [
{ type: "test", title: "test 1", status: "passed" },
{ type: "test", title: "test 2", status: "passed" },
{ type: "test", title: "test 3", status: "passed" },
{ type: "test", title: "test 4", status: "passed" },
],
},
],
},
{
filePath: "src/__tests__/sample-1.test.ts",
permalink:
Expand Down Expand Up @@ -83,7 +61,29 @@ const testFiles: TestFile[] = [
],
},
],
}
},
{
filePath: "src/__tests__/sample-2.test.ts",
permalink:
"https://github.com/mshrtsr/jest-md-dashboard/blob/main/src/__tests__/sample-2.test.ts",
numPassingTests: 4,
numFailingTests: 0,
numTodoTests: 0,
duration: 3.869,
children: [
{
type: "describe",
describe: "describe depth 1",
status: "passed",
children: [
{ type: "test", title: "test 1", status: "passed" },
{ type: "test", title: "test 2", status: "passed" },
{ type: "test", title: "test 3", status: "passed" },
{ type: "test", title: "test 4", status: "passed" },
],
},
],
},
];

export const dashboard: Dashboard = {
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const convertResultsToDashboard = (
): Dashboard => {
const summary = convertSummary(results);
results.testResults.sort((a, b) =>
b.testFilePath.localeCompare(a.testFilePath)
a.testFilePath.localeCompare(b.testFilePath)
);
const testFiles: TestFile[] = results.testResults.map((resultByFile) =>
convertTestFile(resultByFile, {
Expand Down

0 comments on commit c1a8c33

Please sign in to comment.