Skip to content

Suppress progress bar during testing #569

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
merged 2 commits into from
Dec 9, 2021
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
15 changes: 5 additions & 10 deletions src/code/InstallHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,16 +332,11 @@ private List<PSResourceInfo> InstallPackage(
if (!_quiet)
{
int activityId = 0;
string activity = "";
string statusDescription = "";

// Installing parent package (one whose name was passed in to install)
activityId = 0;
activity = string.Format("Installing {0}...", pkg.Name);
statusDescription = string.Format("{0}% Complete:", Math.Round(((double)totalInstalledPkgCount / totalPkgs) * 100), 2);

var progressRecord = new ProgressRecord(activityId, activity, statusDescription);
_cmdletPassedIn.WriteProgress(progressRecord);
int percentComplete = ((totalInstalledPkgCount * 100) / totalPkgs);
string activity = string.Format("Installing {0}...", pkg.Name);
string statusDescription = string.Format("{0}% Complete", percentComplete);
_cmdletPassedIn.WriteProgress(
new ProgressRecord(activityId, activity, statusDescription));
}

// Create PackageIdentity in order to download
Expand Down
1 change: 1 addition & 0 deletions test/GetInstalledPSResource.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

$ProgressPreference = "SilentlyContinue"
Import-Module "$psscriptroot\PSGetTestUtils.psm1" -Force

Describe 'Test Get-PSResource for Module' {
Expand Down
4 changes: 1 addition & 3 deletions test/InstallPSResource.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

$ProgressPreference = "SilentlyContinue"
Import-Module "$psscriptroot\PSGetTestUtils.psm1" -Force

Describe 'Test Install-PSResource for Module' {

BeforeAll {
$OldProgressPreference = $ProgressPreference
$ProgressPreference = "SilentlyContinue"
$TestGalleryName = Get-PoshTestGalleryName
$PSGalleryName = Get-PSGalleryName
$NuGetGalleryName = Get-NuGetGalleryName
Expand All @@ -23,7 +22,6 @@ Describe 'Test Install-PSResource for Module' {
}

AfterAll {
$ProgressPreference = $OldProgressPreference
Get-RevertPSResourceRepositoryFile
}

Expand Down
Loading