microsoft/typespec
Publicmirrored from https://github.com/microsoft/typespecAvailable
eng/common/scripts/Analyze-Changes.Tests.ps1
60lines · modecode
| 1 | BeforeAll { |
| 2 | . $PSScriptRoot/Analyze-Changes.ps1 *>&1 | Out-Null |
| 3 | } |
| 4 | |
| 5 | Describe 'Analyze-Changes' { |
| 6 | AfterEach { |
| 7 | foreach($package in $isolatedPackages.Values) { |
| 8 | $package.RunValue = $false; |
| 9 | } |
| 10 | } |
| 11 | |
| 12 | It 'Should return package variables if package specific changes are detected' { |
| 13 | $actual = Get-ActiveVariables @( |
| 14 | "packages/http-client-csharp/src/constants.ts" |
| 15 | ) |
| 16 | |
| 17 | $expected = @('RunCSharp') |
| 18 | |
| 19 | $actual | ForEach-Object { |
| 20 | $_ | Should -BeIn $expected |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | It 'Should return RunCore if common files are changed' { |
| 25 | $actual = Get-ActiveVariables @( |
| 26 | "packages/compiler/package.json" |
| 27 | ) |
| 28 | |
| 29 | $expected = @('RunCore') |
| 30 | |
| 31 | $actual | ForEach-Object { |
| 32 | $_ | Should -BeIn $expected |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | It 'Should return a combination of core and isolated packages' { |
| 37 | $actual = Get-ActiveVariables @( |
| 38 | "packages/http-client-csharp/src/constants.ts", |
| 39 | "packages/compiler/package.json" |
| 40 | ) |
| 41 | |
| 42 | $expected = @('RunCore', 'RunCSharp') |
| 43 | |
| 44 | $actual | ForEach-Object { |
| 45 | $_ | Should -BeIn $expected |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | It 'Should return RunCSharp and RunCore if .editorconfig is changed' { |
| 50 | $actual = Get-ActiveVariables @( |
| 51 | ".editorconfig" |
| 52 | ) |
| 53 | |
| 54 | $expected = @('RunCore', 'RunCSharp') |
| 55 | |
| 56 | $actual | ForEach-Object { |
| 57 | $_ | Should -BeIn $expected |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | |