Files
paseo/packages/protocol/src/plugin-requirements.test.ts
T
Mohamed Boudra 047f40e623 Install npm plugins and review source updates (#4975)
* feat(plugins): unify source installation and simplify plugin settings

* feat(plugins): install npm sources and review CLI updates

Treat install selectors as one-time choices. Keep source identity separate from the installed revision, and resolve ordinary updates from the current upstream default. npm only acquires directories; plugin loading remains independent of npm.

* fix(plugins): preserve CLI diagnostics and exercise reviewed updates

Move new source capability coverage to real browser journeys. Update the requirements regression to exercise preview and apply, and preserve the existing duplicate-selector diagnostic across positional option scopes.

* test(plugins): remove unused pending helper

* test(plugins): pack registry fixtures with the Windows command runner

* test(plugins): assert failed client contribution setup

* docs(plugins): consolidate guides and document npm publishing

* docs(plugins): introduce publishing choices before npm instructions

* test(plugins): own browser journey cleanup in a fixture

* feat(plugins): prepare scaffolded packages for publishing
2026-09-17 10:22:20 +02:00

57 lines
1.9 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { assertPluginCompatibility, validatePluginRequirements } from "./plugin-requirements.js";
describe.each(["daemon", "app"] as const)("plugin requirements on %s", (runtime) => {
it("rejects legacy manifests on the first breaking release with migration instructions", () => {
expect(() => assertPluginCompatibility({ id: "legacy", version: "0.8.0", runtime })).toThrow(
/legacy.*<0\.8\.0.*0\.8\.0.*https:\/\/paseo.sh\/docs\/plugins\/migration/,
);
});
it.each([
[undefined, "0.7.2"],
[">=0.8.0", "0.8.0"],
[">=0.8.0", "0.8.0-beta.1"],
[">=0.8.0", "1.0.0"],
["^0.8.0", "0.8.4"],
[">=0.8.0-beta.1", "0.8.0-beta.2"],
[">=0.8.0-beta.1", "0.8.0-beta.1"],
[">=0.8.0-beta.1", "0.8.0"],
["^0.8.0 || ^0.9.0", "0.9.2+build.42"],
])("accepts %s on %s", (paseo, version) => {
expect(() =>
assertPluginCompatibility({ id: "test", requirements: { paseo }, version, runtime }),
).not.toThrow();
});
it.each([
[undefined, "0.8.0-beta.1"],
[undefined, "0.9.0"],
[">=0.8.0", "0.7.2"],
["^0.8.0", "0.9.0"],
["<0.8.0", "0.8.0-beta.1"],
])("rejects %s on %s", (paseo, version) => {
expect(() =>
assertPluginCompatibility({ id: "test", requirements: { paseo }, version, runtime }),
).toThrow(`Your ${runtime} is ${version}`);
});
it.each(["", " ", "latest", ">=potato", "0.8.0 nonsense"])(
"rejects malformed range %s",
(paseo) => {
expect(() => validatePluginRequirements({ paseo })).toThrow("Invalid requirements.paseo");
},
);
it.each([null, "unknown"])("fails closed when the runtime version is %s", (version) => {
expect(() =>
assertPluginCompatibility({
id: "test",
requirements: { paseo: "*" },
version,
runtime,
}),
).toThrow(`Paseo ${runtime} version is unknown`);
});
});