mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-06 14:38:21 +00:00
Fix OIDC login callback handling on Element Desktop (#33332)
* Fix OIDC login callback handling on Element Desktop * Add unit tests * Iterate * Fix lcov reporter * Fix coverage paths * Fix coverage upload * Ensure `.test.ts` files don't get included in the desktop package * Fix coverage artifact name * Delint * Tidy coverage name * Improve coverage
This commit is contained in:
committed by
GitHub
parent
5ff302539e
commit
6aee85aef5
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright 2026 Element Creations Ltd.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { defineConfig } from "vitest/config";
|
||||
import { type UserConfig } from "vite";
|
||||
import { type Reporter } from "vitest/reporters";
|
||||
import { env } from "node:process";
|
||||
|
||||
const reporters: NonNullable<UserConfig["test"]>["reporters"] = [["default"]];
|
||||
|
||||
const slowTestReporter: Reporter = {
|
||||
onTestRunEnd(testModules, unhandledErrors, reason) {
|
||||
const tests = testModules
|
||||
.flatMap((m) => Array.from(m.children.allTests()))
|
||||
.filter((test) => test.diagnostic()?.slow);
|
||||
tests.sort((x, y) => x.diagnostic()!.duration! - y.diagnostic()!.duration!);
|
||||
tests.reverse();
|
||||
|
||||
if (tests.length > 0) {
|
||||
console.warn("Slowest 10 tests:");
|
||||
}
|
||||
for (const t of tests.slice(0, 10)) {
|
||||
console.warn(`${t.module.moduleId} > ${t.fullName}: ${t.diagnostic()?.duration.toFixed(0)}ms`);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
// if we're running under GHA, enable the GHA & Sonar reporters
|
||||
if (env["GITHUB_ACTIONS"] !== undefined) {
|
||||
reporters.push(["github-actions", { silent: false }]);
|
||||
reporters.push([
|
||||
"vitest-sonar-reporter",
|
||||
{
|
||||
outputFile: "coverage/sonar-report.xml",
|
||||
onWritePath: (path): string => `apps/desktop/${path}`,
|
||||
},
|
||||
]);
|
||||
|
||||
// if we're running against the develop branch, also enable the slow test reporter
|
||||
if (env["GITHUB_REF"] == "refs/heads/develop") {
|
||||
reporters.push(slowTestReporter);
|
||||
}
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
coverage: {
|
||||
provider: "v8",
|
||||
include: ["src/**/*"],
|
||||
// The coverage report currently chokes on this file as it doesn't process it as TypeScript
|
||||
exclude: ["src/preload.cts"],
|
||||
reporter: [["lcov", { projectRoot: "../../" }]],
|
||||
},
|
||||
environment: "node",
|
||||
reporters,
|
||||
globals: true,
|
||||
pool: "threads",
|
||||
include: ["src/**/*.test.ts"],
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user