add a test file to auto check the fresh_version, based on deno.json --version. Close #3024 --------- Co-authored-by: 李嘉图·M·路 <146103794+Ricardo-M-Zheng@users.noreply.github.com> Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
20 lines
701 B
TypeScript
20 lines
701 B
TypeScript
import { expect } from "@std/expect";
|
|
import { satisfies, tryParseRange } from "@std/semver";
|
|
import { parse } from "@std/semver/parse";
|
|
import rootConfig from "../../../deno.json" with { type: "json" };
|
|
import freshConfig from "../deno.json" with { type: "json" };
|
|
|
|
Deno.test("Fresh version consistency", () => {
|
|
const freshImport: string = rootConfig.imports.fresh;
|
|
const rangeStr = freshImport.split("@").pop()!;
|
|
const importRange = tryParseRange(rangeStr);
|
|
|
|
if (importRange === undefined) {
|
|
throw new Error(`Could not parse semver range from: ${freshImport}`);
|
|
}
|
|
|
|
const packageVersion = parse(freshConfig.version);
|
|
|
|
expect(satisfies(packageVersion, importRange)).toBe(true);
|
|
});
|