From 4bf763f2644bbe1d178cd0d409cd445e6b7e6bd3 Mon Sep 17 00:00:00 2001 From: Matt Travi Date: Fri, 9 Jun 2023 16:08:25 -0500 Subject: [PATCH] test(semantic-release-error): switched instanceof check to the native version since the check provided by the ava assertion seems to fail beyond the context of the test --- test/index.test.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/test/index.test.js b/test/index.test.js index a06caf57..4d0e00e8 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -1853,10 +1853,19 @@ test.serial("Throw an Error if plugin returns an unexpected value", async (t) => await td.replaceEsm("../lib/get-logger.js", null, () => t.context.logger); await td.replaceEsm("env-ci", null, () => ({ isCi: true, branch: "master", isPr: false })); const semanticRelease = (await import("../index.js")).default; - const error = await t.throwsAsync( - semanticRelease(options, { cwd, env: {}, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer() }), - { instanceOf: SemanticReleaseError } - ); + + let error; + try { + await semanticRelease(options, { + cwd, + env: {}, + stdout: new WritableStreamBuffer(), + stderr: new WritableStreamBuffer(), + }); + } catch (e) { + error = e; + } + t.is(error.code, "EANALYZECOMMITSOUTPUT"); t.regex(error.details, /string/); });