Skip to content

Skip UpdatePowerShell tests in CI on macOS #2479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/features/UpdatePowerShell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class GitHubReleaseInformation {

if (!response.ok) {
const json = await response.json();
throw json.message || json || "response was not ok.";
throw new Error(json.message || json || "response was not ok.");
}

// For preview, we grab all the releases and then grab the first prerelease.
Expand Down
32 changes: 19 additions & 13 deletions test/features/UpdatePowerShell.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,24 @@
import * as assert from "assert";
import { GitHubReleaseInformation } from "../../src/features/UpdatePowerShell";

suite("UpdatePowerShell tests", () => {
test("Can get the latest version", async () => {
const release: GitHubReleaseInformation = await GitHubReleaseInformation.FetchLatestRelease(false);
assert.strictEqual(release.isPreview, false, "expected to not be preview.");
assert.strictEqual(release.version.prerelease.length === 0, true, "expected to not have preview in version.");
assert.strictEqual(release.assets.length > 0, true, "expected to have assets.");
});
// Due to Azure DevOps using the same macOS instances, the macOS builds hit
// the GitHub API rate limit often. Let's skip these tests on macOS until
// they are hooked up to only run on release.
if (process.env.TF_BUILD && process.platform === "win32") {
suite("UpdatePowerShell tests", () => {
test("Can get the latest version", async () => {
const release: GitHubReleaseInformation = await GitHubReleaseInformation.FetchLatestRelease(false);
assert.strictEqual(release.isPreview, false, "expected to not be preview.");
assert.strictEqual(
release.version.prerelease.length === 0, true, "expected to not have preview in version.");
assert.strictEqual(release.assets.length > 0, true, "expected to have assets.");
});

test("Can get the latest preview version", async () => {
const release: GitHubReleaseInformation = await GitHubReleaseInformation.FetchLatestRelease(true);
assert.strictEqual(release.isPreview, true, "expected to be preview.");
assert.strictEqual(release.version.prerelease.length > 0, true, "expected to have preview in version.");
assert.strictEqual(release.assets.length > 0, true, "expected to have assets.");
test("Can get the latest preview version", async () => {
const release: GitHubReleaseInformation = await GitHubReleaseInformation.FetchLatestRelease(true);
assert.strictEqual(release.isPreview, true, "expected to be preview.");
assert.strictEqual(release.version.prerelease.length > 0, true, "expected to have preview in version.");
assert.strictEqual(release.assets.length > 0, true, "expected to have assets.");
});
});
});
}