Skip to content

Commit

Permalink
Advance with coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
placintaalexandru committed Oct 28, 2023
1 parent 1198704 commit 1346dc9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/installers/rustup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,9 @@ describe("Tests of rustup", () => {

const rustUp = await RustUp.getOrInstall();

jest.spyOn(rustUp, "version").mockReturnValue(
Promise.resolve(semver.parse("invalid") as semver.SemVer),
);

// Save original implementation
const impl = semver.parse;
const mock = jest.spyOn(semver, "parse").mockReturnValue(null);
let threwError = false;

try {
Expand All @@ -117,6 +116,9 @@ describe("Tests of rustup", () => {
}

expect(threwError);

// Restore original implementation as some tests depends on semver.parse
mock.mockImplementation(impl);
});

test("Install toolchain: components", async () => {
Expand Down

0 comments on commit 1346dc9

Please sign in to comment.