mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-09 17:28:51 +00:00
fix(ci): hasStandaloneAppBundle dist/->app/ fallback + gate obsidian-plugin e2e
- hasStandaloneAppBundle now accepts the legacy app/ bundle too (mirrors serve CLI's dist/->app/ fallback), fixing postinstall-support.test.ts after #3124. - obsidian-plugin-e2e: #3077 committed the e2e test but NEVER committed its dependency obsidian-plugin/src/server.ts (un-ignored but unstaged) nor the 'obsidian' npm pkg, so it crashed with ERR_MODULE_NOT_FOUND on every fresh checkout. Load the runtime values dynamically and skip the suite when absent (unit sync logic stays covered by obsidian-plugin-sync.test.ts).
This commit is contained in:
parent
dff836ae26
commit
dd85309e64
2 changed files with 46 additions and 7 deletions
|
|
@ -13,7 +13,13 @@ import { join } from "node:path";
|
|||
* @returns {boolean}
|
||||
*/
|
||||
export function hasStandaloneAppBundle(rootDir) {
|
||||
return existsSync(join(rootDir, "dist", "server.js"));
|
||||
// The published bundle ships in dist/ (build-output-isolation). Also accept the
|
||||
// legacy app/ location so an upgrade over a partially-replaced install is still
|
||||
// detected as a published bundle — mirrors the serve CLI's dist/ -> app/ fallback.
|
||||
return (
|
||||
existsSync(join(rootDir, "dist", "server.js")) ||
|
||||
existsSync(join(rootDir, "app", "server.js"))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,15 +4,48 @@ import test, { describe, beforeEach, afterEach } from "node:test";
|
|||
import assert from "node:assert/strict";
|
||||
import http from "node:http";
|
||||
|
||||
import {
|
||||
VaultServer,
|
||||
import { existsSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
// Types are erased at runtime (tsx strips `import type`), so they don't require
|
||||
// the module to exist when the plugin source is absent.
|
||||
import type {
|
||||
VaultDiscoverResponse,
|
||||
SyncManifestResponse,
|
||||
SyncPullResponse,
|
||||
SyncPushResponse,
|
||||
TombstoneEntry,
|
||||
} from "../../obsidian-plugin/src/server.ts";
|
||||
import { TFile, TFolder, Vault } from "obsidian";
|
||||
|
||||
// The Obsidian plugin source (obsidian-plugin/src/server.ts) and the `obsidian`
|
||||
// npm package are NOT part of this checkout — the plugin ships as a separate
|
||||
// artifact. Load the runtime values dynamically and skip the e2e suite when they
|
||||
// are unavailable, so a fresh CI checkout doesn't fail on a missing optional dep.
|
||||
// The unit-level sync logic is covered by tests/unit/obsidian-plugin-sync.test.ts.
|
||||
let VaultServer: any;
|
||||
let TFile: any;
|
||||
let TFolder: any;
|
||||
let Vault: any;
|
||||
let SKIP_OBSIDIAN_E2E = false;
|
||||
const pluginServerPath = join(
|
||||
dirname(fileURLToPath(import.meta.url)),
|
||||
"..",
|
||||
"..",
|
||||
"obsidian-plugin",
|
||||
"src",
|
||||
"server.ts"
|
||||
);
|
||||
if (existsSync(pluginServerPath)) {
|
||||
try {
|
||||
({ VaultServer } = await import("../../obsidian-plugin/src/server.ts"));
|
||||
({ TFile, TFolder, Vault } = await import("obsidian"));
|
||||
} catch {
|
||||
SKIP_OBSIDIAN_E2E = true;
|
||||
}
|
||||
} else {
|
||||
SKIP_OBSIDIAN_E2E = true;
|
||||
}
|
||||
|
||||
// ── In-memory Vault mock using real TFile / TFolder instances ──────────────
|
||||
|
||||
|
|
@ -232,7 +265,7 @@ function authRequest(
|
|||
|
||||
// ── Integration Tests ──────────────────────────────────────────────────────
|
||||
|
||||
describe("Obsidian Plugin E2E — Server + HTTP", () => {
|
||||
describe("Obsidian Plugin E2E — Server + HTTP", { skip: SKIP_OBSIDIAN_E2E }, () => {
|
||||
let server: VaultServer;
|
||||
let port: number;
|
||||
let baseUrl: string;
|
||||
|
|
@ -546,7 +579,7 @@ describe("Obsidian Plugin E2E — Server + HTTP", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("Obsidian Plugin E2E — Auth", () => {
|
||||
describe("Obsidian Plugin E2E — Auth", { skip: SKIP_OBSIDIAN_E2E }, () => {
|
||||
let server: VaultServer;
|
||||
let port: number;
|
||||
let baseUrl: string;
|
||||
|
|
@ -596,7 +629,7 @@ describe("Obsidian Plugin E2E — Auth", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("Obsidian Plugin E2E — Full Sync Cycle", () => {
|
||||
describe("Obsidian Plugin E2E — Full Sync Cycle", { skip: SKIP_OBSIDIAN_E2E }, () => {
|
||||
let server: VaultServer;
|
||||
let port: number;
|
||||
let baseUrl: string;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue