-
Notifications
You must be signed in to change notification settings - Fork 108
/
Copy pathRunUnitTestsForAllResources.ps1
57 lines (48 loc) · 1.34 KB
/
RunUnitTestsForAllResources.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#Requires -RunAsAdministrator
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[ValidateSet("2013", "2016", "2019", "Subscription")]
[System.String]
$SharePointVersion,
[Parameter()]
[Switch]
$DoNotBuildModule
)
$modulePath = Split-Path -Path $PSScriptRoot
if ($DoNotBuildModule -eq $false)
{
& $modulePath\build.ps1 -Tasks Build
}
$testPath = Join-Path -Path $modulePath -ChildPath "\Tests\Unit\SharePointDsc"
$params = @{
Tasks = 'Test'
}
switch ($SharePointVersion)
{
"2013"
{
$stubPath = Join-Path -Path $modulePath -ChildPath '\Tests\Unit\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1'
}
"2016"
{
$stubPath = Join-Path -Path $modulePath -ChildPath '\Tests\Unit\Stubs\SharePoint\16.0.4456.1000\Microsoft.SharePoint.PowerShell.psm1'
}
"2019"
{
$stubPath = Join-Path -Path $modulePath -ChildPath '\Tests\Unit\Stubs\SharePoint\16.0.10337.12109\Microsoft.SharePoint.PowerShell.psm1'
}
"Subscription"
{
$stubPath = Join-Path -Path $modulePath -ChildPath '\Tests\Unit\Stubs\SharePoint\16.0.14326.20450/SharePointServer.psm1'
}
}
$params.PesterScript = @(
@{
Path = $testPath
Parameters = @{
SharePointCmdletModule = $stubPath
}
}
)
& $modulePath\build.ps1 @params