Skip to content

Commit 4ca6221

Browse files
Add local repository registration and module installation for 'Module' test type
1 parent ba3bd90 commit 4ca6221

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

scripts/main.ps1

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,21 @@ $settings = $env:PSMODULE_TEST_PSMODULE_INPUT_Settings
99
$testPath = Resolve-Path -Path "$PSScriptRoot/tests/$settings" | Select-Object -ExpandProperty Path
1010

1111
$localTestPath = Resolve-Path -Path 'tests' | Select-Object -ExpandProperty Path
12-
$codePath = switch ($settings) {
12+
switch ($settings) {
1313
'Module' {
14-
Resolve-Path -Path "outputs/module/$moduleName" | Select-Object -ExpandProperty Path
14+
$codePath = Resolve-Path -Path "outputs/module/$moduleName" | Select-Object -ExpandProperty Path
15+
$localRepo = @{
16+
Name = 'Local'
17+
Uri = New-Item -Path $PSScriptRoot -Name '.localpsmodulerepo' -ItemType Directory -PassThru
18+
Trusted = $true
19+
Priority = 1
20+
}
21+
Register-PSResourceRepository @localRepo
22+
Publish-PSResource -Path $codePath -Repository Local
23+
Install-PSResource -Name $moduleName
1524
}
1625
'SourceCode' {
17-
Resolve-Path -Path 'src' | Select-Object -ExpandProperty Path
26+
$codePath = Resolve-Path -Path 'src' | Select-Object -ExpandProperty Path
1827
}
1928
default {
2029
throw "Invalid test type: [$settings]"

0 commit comments

Comments
 (0)