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
This commit is contained in:
Matt Travi 2023-06-09 16:08:25 -05:00
parent d259350c3e
commit 4bf763f264
No known key found for this signature in database
GPG Key ID: 8C173646C24FED70

View File

@ -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/);
});