Skip to content

Commit a0c40cf

Browse files
committed
Update to latest @actions/glob and fix tests
1 parent acb59e4 commit a0c40cf

File tree

4 files changed

+24
-26
lines changed

4 files changed

+24
-26
lines changed

__tests__/search.test.ts

+12-14
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ const lonelyFilePath = path.join(
6161
'lonely-file.txt'
6262
)
6363

64+
const hiddenFile = path.join(root, '.hidden-file.txt')
6465
const fileInHiddenFolderPath = path.join(
6566
root,
6667
'.hidden-folder',
6768
'folder-in-hidden-folder',
6869
'file.txt'
6970
)
70-
const hiddenFile = path.join(root, '.hidden-file.txt')
7171
const fileInHiddenFolderInFolderA = path.join(
7272
root,
7373
'folder-a',
@@ -132,6 +132,10 @@ describe('Search', () => {
132132
await fs.writeFile(amazingFileInFolderHPath, 'amazing file')
133133

134134
await fs.writeFile(lonelyFilePath, 'all by itself')
135+
136+
await fs.writeFile(hiddenFile, 'hidden file')
137+
await fs.writeFile(fileInHiddenFolderPath, 'file in hidden directory')
138+
await fs.writeFile(fileInHiddenFolderInFolderA, 'file in hidden directory')
135139
/*
136140
Directory structure of files that get created:
137141
root/
@@ -385,25 +389,19 @@ describe('Search', () => {
385389
const searchPath = path.join(root, '**/*')
386390
const searchResult = await findFilesToUpload(searchPath)
387391

388-
expect(searchResult.filesToUpload.includes(hiddenFile)).toEqual(false)
389-
expect(searchResult.filesToUpload.includes(fileInHiddenFolderPath)).toEqual(
390-
false
392+
expect(searchResult.filesToUpload).not.toContain(hiddenFile)
393+
expect(searchResult.filesToUpload).not.toContain(fileInHiddenFolderPath)
394+
expect(searchResult.filesToUpload).not.toContain(
395+
fileInHiddenFolderInFolderA
391396
)
392-
expect(
393-
searchResult.filesToUpload.includes(fileInHiddenFolderInFolderA)
394-
).toEqual(false)
395397
})
396398

397399
it('Hidden files included', async () => {
398400
const searchPath = path.join(root, '**/*')
399401
const searchResult = await findFilesToUpload(searchPath, true)
400402

401-
expect(searchResult.filesToUpload.includes(hiddenFile)).toEqual(false)
402-
expect(searchResult.filesToUpload.includes(fileInHiddenFolderPath)).toEqual(
403-
false
404-
)
405-
expect(
406-
searchResult.filesToUpload.includes(fileInHiddenFolderInFolderA)
407-
).toEqual(false)
403+
expect(searchResult.filesToUpload).toContain(hiddenFile)
404+
expect(searchResult.filesToUpload).toContain(fileInHiddenFolderPath)
405+
expect(searchResult.filesToUpload).toContain(fileInHiddenFolderInFolderA)
408406
})
409407
})

package-lock.json

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"@actions/artifact": "2.1.8",
3333
"@actions/core": "^1.10.1",
3434
"@actions/github": "^6.0.0",
35-
"@actions/glob": "^0.3.0",
35+
"@actions/glob": "^0.5.0",
3636
"@actions/io": "^1.1.2",
3737
"minimatch": "^9.0.3"
3838
},

src/shared/search.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ export interface SearchResult {
1111
rootDirectory: string
1212
}
1313

14-
function getDefaultGlobOptions(_includeHiddenFiles: boolean): glob.GlobOptions {
14+
function getDefaultGlobOptions(includeHiddenFiles: boolean): glob.GlobOptions {
1515
return {
1616
followSymbolicLinks: true,
1717
implicitDescendants: true,
1818
omitBrokenSymbolicLinks: true,
19-
// excludeHiddenFiles: !includeHiddenFiles,
19+
excludeHiddenFiles: !includeHiddenFiles,
2020
}
2121
}
2222

0 commit comments

Comments
 (0)