File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -51,4 +51,20 @@ Describe 'tests for resource discovery' {
5151        $resources.Count   |  Should - Be 1 
5252        $resources.type   |  Should - BeExactly ' DSC/TestYamlResource' 
5353    }
54+ 
55+     It ' does not support discovering a file with an extension that is not json or yaml'   {
56+         param ($extension )
57+ 
58+         $resourceInput  =  @' 
59+         $schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/bundled/resource/manifest.json 
60+         type: DSC/TestYamlResource 
61+         version: 0.1.0 
62+         get: 
63+           executable: dsc 
64+ '@ 
65+ 
66+         Set-Content  - Path " $testdrive /test.dsc.resource.txt"   - Value $resourceInput 
67+         $resources  =  dsc resource list |  ConvertFrom-Json 
68+         $resources.Count   |  Should - Be 0 
69+     }
5470}
Original file line number Diff line number Diff line change @@ -52,9 +52,9 @@ impl CommandDiscovery {
5252                    if  path. is_file ( )  { 
5353                        let  file_name = path. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ; 
5454                        let  file_name_lowercase = file_name. to_lowercase ( ) ; 
55-                         if  file_name_lowercase. ends_with ( ".dsc.resource.json" )  |
56-                         file_name_lowercase. ends_with ( ".dsc.resource.yaml" )  |
57-                         file_name_lowercase. ends_with ( ".dsc.resource.yml" )  { 
55+                         if  file_name_lowercase. ends_with ( ".dsc.resource.json" )  || 
56+                             file_name_lowercase. ends_with ( ".dsc.resource.yaml" )  | |
57+                             file_name_lowercase. ends_with ( ".dsc.resource.yml" )  { 
5858                            let  resource = match  load_manifest ( & path) 
5959                            { 
6060                                Ok ( r)  => r, 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments