fix: close durable queue and runtime gaps
Quality / quality (ubuntu-latest) (push) Failing after 9m54s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-23 20:47:00 +05:30
parent 1a94179b5f
commit a9670c2a1c
19 changed files with 198 additions and 26 deletions
+14
View File
@@ -0,0 +1,14 @@
import { registerDb, setDb } from "@wrnexus/db";
import { connectFromConfig } from "@wrnexus/db/connect";
import { loadAppConfig, loadEnv } from "@wrnexus/styles";
const root = process.env.WRNEXUS_TEST_ROOT;
if (root) {
const profile = process.env.WRNEXUS_PROFILE || "test";
loadEnv(root, profile);
const config = await loadAppConfig(root, profile);
if (config.db) setDb(connectFromConfig(config.db, root));
for (const [name, database] of Object.entries(config.databases ?? {})) {
registerDb(name, connectFromConfig(database, root));
}
}
+19 -2
View File
@@ -20,6 +20,7 @@ export interface TestCommandPlan {
level?: TestLevel;
files: string[];
setup?: { command: string; args: string[] };
env?: Record<string, string>;
}
function shardFiles(files: string[], value?: string): string[] {
@@ -69,6 +70,9 @@ export function createTestPlan(appRoot: string, args: string[]): TestCommandPlan
const root = resolve(appRoot);
const level = args.find((value): value is TestLevel => TEST_LEVELS.includes(value as TestLevel));
const watch = args.includes("--watch");
const profile = args.find((value) => value.startsWith("--profile="))?.slice(10) || "test";
const setupSource = join(import.meta.dir, "test-setup.ts");
const setupModule = existsSync(setupSource) ? setupSource : join(import.meta.dir, "test-setup.js");
const shard = args.find((value) => value.startsWith("--shard="))?.slice(8);
const browsers = (args.find((value) => value.startsWith("--browsers="))?.slice(11) ?? "chromium")
.split(",")
@@ -120,10 +124,18 @@ export function createTestPlan(appRoot: string, args: string[]): TestCommandPlan
);
return {
command: process.execPath,
args: ["test", ...(watch ? ["--watch"] : []), ...(pattern ? files : []), ...passthrough],
args: [
"test",
"--preload",
setupModule,
...(watch ? ["--watch"] : []),
...(pattern ? files : []),
...passthrough,
],
cwd: root,
level,
files,
env: { WRNEXUS_TEST_ROOT: root, WRNEXUS_PROFILE: profile },
};
}
@@ -136,7 +148,12 @@ export function runTests(appRoot: string, args: string[]): ChildProcess | null {
process.exitCode = 1;
return null;
}
const launch = () => spawn(plan.command, plan.args, { stdio: "inherit", cwd: plan.cwd });
const launch = () =>
spawn(plan.command, plan.args, {
stdio: "inherit",
cwd: plan.cwd,
env: { ...process.env, ...plan.env },
});
if (plan.setup) {
const setup = spawn(plan.setup.command, plan.setup.args, { stdio: "inherit", cwd: plan.cwd });
setup.on("exit", (code, signal) => {