Files
BrowserSkill/packages/dsh-plugin-browserskill/tests/plugin-id.test.ts
T
drakezhangandCursor 2997f495db fix(dsh-plugin): use the published package name as the Cordis id
dsh 0.1.0-rc.8 imports and registers the client bundle by export const name, so a leftover dsh-plugin-browserskill id fails to load the 0.1.1 web UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-28 21:28:06 +08:00

33 lines
1.1 KiB
TypeScript

// dsh 0.1 keys the client graph and Node import by `export const name`.
// That string must stay identical to the published package name (and therefore
// the client.cjs __ModuleLoader__ id, which tsdown reads from package.json).
import { readFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { describe, expect, it } from "vitest";
import { name } from "../src/index";
const pkg = JSON.parse(
readFileSync(join(dirname(fileURLToPath(import.meta.url)), "..", "package.json"), "utf8"),
) as {
name: string;
dsh: { client: { external?: string[] } };
};
describe("plugin identity", () => {
it("uses the published package name as the Cordis plugin id", () => {
expect(name).toBe("@wxg-prc-cpg/browser-skill-dsh-plugin");
expect(name).toBe(pkg.name);
});
it("declares client require()s so dsh arrives them before materialize", () => {
expect(pkg.dsh.client.external).toEqual(
expect.arrayContaining([
"@deepseek-ai/dsh-client-ui-attachment",
"@deepseek-ai/dsh-client-ui-primitives",
]),
);
});
});