Skip to content

Commit 3822b4a

Browse files
SisyphusZhengiuioiuabartlomieju
authored
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>
1 parent 2fce869 commit 3822b4a

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { expect } from "@std/expect";
2+
import { satisfies, tryParseRange } from "@std/semver";
3+
import { parse } from "@std/semver/parse";
4+
import rootConfig from "../../../deno.json" with { type: "json" };
5+
import freshConfig from "../deno.json" with { type: "json" };
6+
7+
Deno.test("Fresh version consistency", () => {
8+
const freshImport: string = rootConfig.imports.fresh;
9+
const rangeStr = freshImport.split("@").pop()!;
10+
const importRange = tryParseRange(rangeStr);
11+
12+
if (importRange === undefined) {
13+
throw new Error(`Could not parse semver range from: ${freshImport}`);
14+
}
15+
16+
const packageVersion = parse(freshConfig.version);
17+
18+
expect(satisfies(packageVersion, importRange)).toBe(true);
19+
});

0 commit comments

Comments
 (0)