From 2d3b6d4530fabb641b307704f8761d043ef08645 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Fri, 23 Oct 2026 12:11:00 +0100 Subject: [PATCH] Check that a `ConfigurationError` is thrown --- src/languages/swift.test.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/languages/swift.test.ts b/src/languages/swift.test.ts index e2655ff67..2f3182fea 100644 --- a/src/languages/swift.test.ts +++ b/src/languages/swift.test.ts @@ -10,7 +10,7 @@ import { makeVersionInfo, RecordingLogger, } from "../testing-utils"; -import { withTmpDir } from "../util"; +import { ConfigurationError, withTmpDir } from "../util"; import { checkSwiftCompatibility } from "./swift"; @@ -54,11 +54,17 @@ test("checkSwiftCompatibility doesn't throw for Swift on darwin", async (t) => const nonDarwinPlatforms: NodeJS.Platform[] = ["linux", "win32"]; for (const nonDarwinPlatform of nonDarwinPlatforms) { test(`checkSwiftCompatibility throws for Swift on ${nonDarwinPlatform}`, (t) => { - t.throws(() => { - checkSwiftCompatibility( - initAllState({ platform: nonDarwinPlatform }), - createTestConfig({ languages: [BuiltInLanguage.swift] }), - ); - }); + t.throws( + () => { + checkSwiftCompatibility( + initAllState({ platform: nonDarwinPlatform }), + createTestConfig({ languages: [BuiltInLanguage.swift] }), + ); + }, + { + instanceOf: ConfigurationError, + message: /^Swift analysis is only supported on macOS runner images/, + }, + ); }); }