Unverified Commit a0c40cf6 authored by Josh Gross's avatar Josh Gross
Browse files

Update to latest `@actions/glob` and fix tests

parent acb59e47
Loading
Loading
Loading
Loading
+12 −14
Changes for __tests__/search.test.ts: 12 added lines, 14 removed lines.
Original line number Diff line number Diff line
@@ -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)
  })
})
+9 −9
Changes for package-lock.json: 9 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -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": {
+1 −1
Changes for package.json: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -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"
  },
+2 −2
Changes for src/shared/search.ts: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -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,
  }
}