File tree Expand file tree Collapse file tree
test/PublishPSResourceTests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -344,6 +344,33 @@ function Test-PublishedFunction {
344344
345345 $expectedPath = Join-Path - Path $script :repositoryPath2 - ChildPath " $script :PublishModuleName .$version .nupkg"
346346 (Get-ChildItem $script :repositoryPath2 ).FullName | Should - Be $expectedPath
347+
348+ Add-Type - AssemblyName System.IO.Compression.FileSystem
349+ $package = [System.IO.Compression.ZipFile ]::OpenRead($expectedPath )
350+ try {
351+ $nuspecEntry = $package.Entries | Where-Object FullName -like ' *.nuspec' | Select-Object - First 1
352+ $nuspecEntry | Should -Not - BeNullOrEmpty
353+
354+ $reader = [System.IO.StreamReader ]::new($nuspecEntry.Open ())
355+ try {
356+ $nuspecXml = [xml ]$reader.ReadToEnd ()
357+ }
358+ finally {
359+ $reader.Dispose ()
360+ }
361+ }
362+ finally {
363+ $package.Dispose ()
364+ }
365+
366+ $namespaceManager = [System.Xml.XmlNamespaceManager ]::new($nuspecXml.NameTable )
367+ $namespaceManager.AddNamespace (' ns' , ' http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd' )
368+ $dependencyIds = @ (
369+ $nuspecXml.SelectNodes (' //ns:package/ns:metadata/ns:dependencies/ns:dependency' , $namespaceManager ) |
370+ ForEach-Object { $_.Attributes [' id' ].Value }
371+ )
372+
373+ $dependencyIds | Should -Not - Contain $externalModuleName
347374 }
348375
349376 It " Publish a module with -SkipDependenciesCheck" {
You can’t perform that action at this time.
0 commit comments