You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Pester test files contained _a lot_ of duplicated test
setup/configuration. This update factors all of that out
to Test/Common.ps1 so that _just about_ the entire content
of a Pester test file can be unique to the code being tested.
# Copyright (c) Microsoft Corporation. All rights reserved.
2
+
# Licensed under the MIT License.
3
+
4
+
# Caches if the tests are actively configured with an access token.
5
+
$script:accessTokenConfigured=$false
6
+
7
+
# The path to a file storing the contents of the user's config file before tests got underway
8
+
$script:originalConfigFile=$null
9
+
10
+
functionInitialize-CommonTestSetup
11
+
{
12
+
<#
13
+
.SYNOPSIS
14
+
Configures the tests to run with the authentication information stored in the project's
15
+
Azure DevOps pipeline (if that information exists in the environment).
16
+
17
+
.DESCRIPTION
18
+
Configures the tests to run with the authentication information stored in the project's
19
+
Azure DevOps pipeline (if that information exists in the environment).
20
+
21
+
The Git repo for this module can be found here: http://aka.ms/PowerShellForGitHub
22
+
23
+
.NOTES
24
+
Internal-only helper method.
25
+
26
+
The only reason this exists is so that we can leverage CodeAnalysis.SuppressMessageAttribute,
27
+
which can only be applied to functions.
28
+
29
+
This method is invoked immediately after the declaration.
30
+
#>
31
+
[CmdletBinding()]
32
+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText","", Justification="Needed to configure with the stored, encrypted string value in AppVeyor.")]
Configures the tests to run with the authentication information stored in AppVeyor
18
-
(if that information exists in the environment).
19
-
20
-
.DESCRIPTION
21
-
Configures the tests to run with the authentication information stored in AppVeyor
22
-
(if that information exists in the environment).
23
-
24
-
The Git repo for this module can be found here: http://aka.ms/PowerShellForGitHub
25
-
26
-
.NOTES
27
-
Internal-only helper method.
28
-
29
-
The only reason this exists is so that we can leverage CodeAnalysis.SuppressMessageAttribute,
30
-
which can only be applied to functions.
31
-
32
-
We call this immediately after the declaration so that AppVeyor initialization can heppen
33
-
(if applicable).
34
-
35
-
#>
36
-
[CmdletBinding()]
37
-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText","", Justification="Needed to configure with the stored, encrypted string value in AppVeyor.")]
Configures the tests to run with the authentication information stored in AppVeyor
18
-
(if that information exists in the environment).
19
-
20
-
.DESCRIPTION
21
-
Configures the tests to run with the authentication information stored in AppVeyor
22
-
(if that information exists in the environment).
23
-
24
-
The Git repo for this module can be found here: http://aka.ms/PowerShellForGitHub
25
-
26
-
.NOTES
27
-
Internal-only helper method.
28
-
29
-
The only reason this exists is so that we can leverage CodeAnalysis.SuppressMessageAttribute,
30
-
which can only be applied to functions.
31
-
32
-
We call this immediately after the declaration so that AppVeyor initialization can happen
33
-
(if applicable).
34
-
35
-
#>
36
-
[CmdletBinding()]
37
-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText","", Justification="Needed to configure with the stored, encrypted string value in AppVeyor.")]
Configures the tests to run with the authentication information stored in AppVeyor
18
-
(if that information exists in the environment).
19
-
20
-
.DESCRIPTION
21
-
Configures the tests to run with the authentication information stored in AppVeyor
22
-
(if that information exists in the environment).
23
-
24
-
The Git repo for this module can be found here: http://aka.ms/PowerShellForGitHub
25
-
26
-
.NOTES
27
-
Internal-only helper method.
28
-
29
-
The only reason this exists is so that we can leverage CodeAnalysis.SuppressMessageAttribute,
30
-
which can only be applied to functions.
31
-
32
-
We call this immediately after the declaration so that AppVeyor initialization can heppen
33
-
(if applicable).
34
-
35
-
#>
36
-
[CmdletBinding()]
37
-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText","", Justification="Needed to configure with the stored, encrypted string value in AppVeyor.")]
0 commit comments