mirror of
				https://gitee.com/actions-mirror/upload-artifact.git
				synced 2025-11-04 04:01:20 +08:00 
			
		
		
		
	Update to latest @actions/glob and fix tests
				
					
				
			This commit is contained in:
		
							parent
							
								
									acb59e4776
								
							
						
					
					
						commit
						a0c40cf602
					
				@ -61,13 +61,13 @@ const lonelyFilePath = path.join(
 | 
			
		||||
  'lonely-file.txt'
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const hiddenFile = path.join(root, '.hidden-file.txt')
 | 
			
		||||
const fileInHiddenFolderPath = path.join(
 | 
			
		||||
  root,
 | 
			
		||||
  '.hidden-folder',
 | 
			
		||||
  'folder-in-hidden-folder',
 | 
			
		||||
  'file.txt'
 | 
			
		||||
)
 | 
			
		||||
const hiddenFile = path.join(root, '.hidden-file.txt')
 | 
			
		||||
const fileInHiddenFolderInFolderA = path.join(
 | 
			
		||||
  root,
 | 
			
		||||
  'folder-a',
 | 
			
		||||
@ -132,6 +132,10 @@ describe('Search', () => {
 | 
			
		||||
    await fs.writeFile(amazingFileInFolderHPath, 'amazing file')
 | 
			
		||||
 | 
			
		||||
    await fs.writeFile(lonelyFilePath, 'all by itself')
 | 
			
		||||
 | 
			
		||||
    await fs.writeFile(hiddenFile, 'hidden file')
 | 
			
		||||
    await fs.writeFile(fileInHiddenFolderPath, 'file in hidden directory')
 | 
			
		||||
    await fs.writeFile(fileInHiddenFolderInFolderA, 'file in hidden directory')
 | 
			
		||||
    /*
 | 
			
		||||
      Directory structure of files that get created:
 | 
			
		||||
      root/
 | 
			
		||||
@ -385,25 +389,19 @@ describe('Search', () => {
 | 
			
		||||
    const searchPath = path.join(root, '**/*')
 | 
			
		||||
    const searchResult = await findFilesToUpload(searchPath)
 | 
			
		||||
 | 
			
		||||
    expect(searchResult.filesToUpload.includes(hiddenFile)).toEqual(false)
 | 
			
		||||
    expect(searchResult.filesToUpload.includes(fileInHiddenFolderPath)).toEqual(
 | 
			
		||||
      false
 | 
			
		||||
    expect(searchResult.filesToUpload).not.toContain(hiddenFile)
 | 
			
		||||
    expect(searchResult.filesToUpload).not.toContain(fileInHiddenFolderPath)
 | 
			
		||||
    expect(searchResult.filesToUpload).not.toContain(
 | 
			
		||||
      fileInHiddenFolderInFolderA
 | 
			
		||||
    )
 | 
			
		||||
    expect(
 | 
			
		||||
      searchResult.filesToUpload.includes(fileInHiddenFolderInFolderA)
 | 
			
		||||
    ).toEqual(false)
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('Hidden files included', async () => {
 | 
			
		||||
    const searchPath = path.join(root, '**/*')
 | 
			
		||||
    const searchResult = await findFilesToUpload(searchPath, true)
 | 
			
		||||
 | 
			
		||||
    expect(searchResult.filesToUpload.includes(hiddenFile)).toEqual(false)
 | 
			
		||||
    expect(searchResult.filesToUpload.includes(fileInHiddenFolderPath)).toEqual(
 | 
			
		||||
      false
 | 
			
		||||
    )
 | 
			
		||||
    expect(
 | 
			
		||||
      searchResult.filesToUpload.includes(fileInHiddenFolderInFolderA)
 | 
			
		||||
    ).toEqual(false)
 | 
			
		||||
    expect(searchResult.filesToUpload).toContain(hiddenFile)
 | 
			
		||||
    expect(searchResult.filesToUpload).toContain(fileInHiddenFolderPath)
 | 
			
		||||
    expect(searchResult.filesToUpload).toContain(fileInHiddenFolderInFolderA)
 | 
			
		||||
  })
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										18
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -12,7 +12,7 @@
 | 
			
		||||
        "@actions/artifact": "2.1.8",
 | 
			
		||||
        "@actions/core": "^1.10.1",
 | 
			
		||||
        "@actions/github": "^6.0.0",
 | 
			
		||||
        "@actions/glob": "^0.3.0",
 | 
			
		||||
        "@actions/glob": "^0.5.0",
 | 
			
		||||
        "@actions/io": "^1.1.2",
 | 
			
		||||
        "minimatch": "^9.0.3"
 | 
			
		||||
      },
 | 
			
		||||
@ -191,11 +191,11 @@
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/@actions/glob": {
 | 
			
		||||
      "version": "0.3.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.3.0.tgz",
 | 
			
		||||
      "integrity": "sha512-tJP1ZhF87fd6LBnaXWlahkyvdgvsLl7WnreW1EZaC8JWjpMXmzqWzQVe/IEYslrkT9ymibVrKyJN4UMD7uQM2w==",
 | 
			
		||||
      "version": "0.5.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.5.0.tgz",
 | 
			
		||||
      "integrity": "sha512-tST2rjPvJLRZLuT9NMUtyBjvj9Yo0MiJS3ow004slMvm8GFM+Zv9HvMJ7HWzfUyJnGrJvDsYkWBaaG3YKXRtCw==",
 | 
			
		||||
      "dependencies": {
 | 
			
		||||
        "@actions/core": "^1.2.6",
 | 
			
		||||
        "@actions/core": "^1.9.1",
 | 
			
		||||
        "minimatch": "^3.0.4"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@ -8036,11 +8036,11 @@
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "@actions/glob": {
 | 
			
		||||
      "version": "0.3.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.3.0.tgz",
 | 
			
		||||
      "integrity": "sha512-tJP1ZhF87fd6LBnaXWlahkyvdgvsLl7WnreW1EZaC8JWjpMXmzqWzQVe/IEYslrkT9ymibVrKyJN4UMD7uQM2w==",
 | 
			
		||||
      "version": "0.5.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.5.0.tgz",
 | 
			
		||||
      "integrity": "sha512-tST2rjPvJLRZLuT9NMUtyBjvj9Yo0MiJS3ow004slMvm8GFM+Zv9HvMJ7HWzfUyJnGrJvDsYkWBaaG3YKXRtCw==",
 | 
			
		||||
      "requires": {
 | 
			
		||||
        "@actions/core": "^1.2.6",
 | 
			
		||||
        "@actions/core": "^1.9.1",
 | 
			
		||||
        "minimatch": "^3.0.4"
 | 
			
		||||
      },
 | 
			
		||||
      "dependencies": {
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,7 @@
 | 
			
		||||
    "@actions/artifact": "2.1.8",
 | 
			
		||||
    "@actions/core": "^1.10.1",
 | 
			
		||||
    "@actions/github": "^6.0.0",
 | 
			
		||||
    "@actions/glob": "^0.3.0",
 | 
			
		||||
    "@actions/glob": "^0.5.0",
 | 
			
		||||
    "@actions/io": "^1.1.2",
 | 
			
		||||
    "minimatch": "^9.0.3"
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
@ -11,12 +11,12 @@ export interface SearchResult {
 | 
			
		||||
  rootDirectory: string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getDefaultGlobOptions(_includeHiddenFiles: boolean): glob.GlobOptions {
 | 
			
		||||
function getDefaultGlobOptions(includeHiddenFiles: boolean): glob.GlobOptions {
 | 
			
		||||
  return {
 | 
			
		||||
    followSymbolicLinks: true,
 | 
			
		||||
    implicitDescendants: true,
 | 
			
		||||
    omitBrokenSymbolicLinks: true,
 | 
			
		||||
    // excludeHiddenFiles: !includeHiddenFiles,
 | 
			
		||||
    excludeHiddenFiles: !includeHiddenFiles,
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user