test: add fresh_version_check test (#3029)
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>
This commit is contained in:
co-authored by
李嘉图·M·路
Asher Gomez
Bartek Iwańczuk
parent
2fce869971
commit
3822b4a21b
@@ -0,0 +1,19 @@
|
||||
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);
|
||||
});
|
||||
Reference in New Issue
Block a user