From f5429fe3ac8bb9b083aeca8863ae707673ff6853 Mon Sep 17 00:00:00 2001 From: Ethan Zimbelman Date: Thu, 21 Mar 2024 12:21:10 -0700 Subject: [PATCH] feat: compare upstream runtime version in the hook --- src/doctor.ts | 9 +++++++++ src/tests/doctor_test.ts | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/doctor.ts b/src/doctor.ts index 5bfc7fd..7c5ae46 100644 --- a/src/doctor.ts +++ b/src/doctor.ts @@ -1,9 +1,11 @@ import { getProtocolInterface } from "./deps.ts"; +import { isNewSemverRelease } from "./utilities.ts"; type RuntimeVersion = { name: string; current: string; minimum?: string; + message?: string; error?: { message: string; }; @@ -28,6 +30,13 @@ const getHostedDenoRuntimeVersion = async (): Promise<{ const message = Deno.version.deno !== version ? `Applications deployed to Slack use Deno version ${version}` : undefined; + if (isNewSemverRelease(Deno.version.deno, version)) { + return { + minimum: version, + message, + error: { message: "The installed runtime version is not supported" }, + }; + } return { minimum: version, message }; } catch (err) { if (err instanceof Error) { diff --git a/src/tests/doctor_test.ts b/src/tests/doctor_test.ts index 7dc079c..08f618f 100644 --- a/src/tests/doctor_test.ts +++ b/src/tests/doctor_test.ts @@ -96,7 +96,7 @@ Deno.test("doctor hook tests", async (t) => { assertEquals(actual, expected); }); - await t.step("mismatched upstream requirements note difference", async () => { + await t.step("unsupported upstream runtimes note differences", async () => { mockFetch.mock("GET@/slackcli/metadata.json", (_req: Request) => { return new Response(JSON.stringify(MOCK_SLACK_CLI_MANIFEST)); }); @@ -110,6 +110,9 @@ Deno.test("doctor hook tests", async (t) => { current: "1.2.3", minimum: "1.101.1", message: "Applications deployed to Slack use Deno version 1.101.1", + error: { + message: "The installed runtime version is not supported", + }, }, { name: "typescript",