Skip to content

Commit

Permalink
Revert "[dep] Bump glob to 11.0.0 (#1381)" (#1398)
Browse files Browse the repository at this point in the history
This reverts commit 2fed00d.
  • Loading branch information
Drarig29 authored Aug 1, 2024
1 parent 92b9893 commit e86fb45
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 53 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"fast-xml-parser": "^4.4.1",
"form-data": "4.0.0",
"fuzzy": "^0.1.3",
"glob": "^11.0.0",
"glob": "^7.1.4",
"google-auth-library": "^9.12.0",
"inquirer": "^8.2.5",
"inquirer-checkbox-plus-prompt": "^1.4.2",
Expand Down
20 changes: 10 additions & 10 deletions src/commands/dsyms/__tests__/upload.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {EOL, platform} from 'os'
import path from 'path'

import {Cli} from 'clipanion/lib/advanced'
import {glob} from 'glob'
import glob from 'glob'

import * as APIKeyHelpers from '../../../helpers/apikey'
import {buildPath} from '../../../helpers/utils'
Expand Down Expand Up @@ -308,13 +308,13 @@ describe('execute', () => {
expect(output[4]).toContain('Will use temporary intermediate directory: ')
expect(output[5]).toContain('Will use temporary upload directory: ')
expect(output[6]).toContain(
'Uploading 3BC12422-63CC-30E8-B916-E5006CE3286C.zip (DDTest, arch: arm64, UUID: 3BC12422-63CC-30E8-B916-E5006CE3286C)'
'Uploading C8469F85-B060-3085-B69D-E46C645560EA.zip (DDTest, arch: armv7, UUID: C8469F85-B060-3085-B69D-E46C645560EA)'
)
expect(output[7]).toContain(
'Uploading C8469F85-B060-3085-B69D-E46C645560EA.zip (DDTest, arch: armv7, UUID: C8469F85-B060-3085-B69D-E46C645560EA)'
'Uploading 06EE3D68-D605-3E92-B92D-2F48C02A505E.zip (DDTest, arch: arm64, UUID: 06EE3D68-D605-3E92-B92D-2F48C02A505E)'
)
expect(output[8]).toContain(
'Uploading 06EE3D68-D605-3E92-B92D-2F48C02A505E.zip (DDTest, arch: arm64, UUID: 06EE3D68-D605-3E92-B92D-2F48C02A505E)'
'Uploading 3BC12422-63CC-30E8-B916-E5006CE3286C.zip (DDTest, arch: arm64, UUID: 3BC12422-63CC-30E8-B916-E5006CE3286C)'
)
expect(output[11]).toContain('Handled 3 dSYMs with success')
})
Expand All @@ -334,13 +334,13 @@ describe('execute', () => {
expect(output[4]).toContain('Will use temporary intermediate directory: ')
expect(output[5]).toContain('Will use temporary upload directory: ')
expect(output[6]).toContain(
'Uploading 3BC12422-63CC-30E8-B916-E5006CE3286C.zip (DDTest, arch: arm64, UUID: 3BC12422-63CC-30E8-B916-E5006CE3286C)'
'Uploading C8469F85-B060-3085-B69D-E46C645560EA.zip (DDTest, arch: armv7, UUID: C8469F85-B060-3085-B69D-E46C645560EA)'
)
expect(output[7]).toContain(
'Uploading C8469F85-B060-3085-B69D-E46C645560EA.zip (DDTest, arch: armv7, UUID: C8469F85-B060-3085-B69D-E46C645560EA)'
'Uploading 06EE3D68-D605-3E92-B92D-2F48C02A505E.zip (DDTest, arch: arm64, UUID: 06EE3D68-D605-3E92-B92D-2F48C02A505E)'
)
expect(output[8]).toContain(
'Uploading 06EE3D68-D605-3E92-B92D-2F48C02A505E.zip (DDTest, arch: arm64, UUID: 06EE3D68-D605-3E92-B92D-2F48C02A505E)'
'Uploading 3BC12422-63CC-30E8-B916-E5006CE3286C.zip (DDTest, arch: arm64, UUID: 3BC12422-63CC-30E8-B916-E5006CE3286C)'
)
expect(output[11]).toContain('Handled 3 dSYMs with success')
})
Expand All @@ -362,13 +362,13 @@ describe('execute', () => {
expect(output[4]).toContain('Will use temporary intermediate directory: ')
expect(output[5]).toContain('Will use temporary upload directory: ')
expect(output[6]).toContain(
'Uploading 3BC12422-63CC-30E8-B916-E5006CE3286C.zip (DDTest, arch: arm64, UUID: 3BC12422-63CC-30E8-B916-E5006CE3286C)'
'Uploading C8469F85-B060-3085-B69D-E46C645560EA.zip (DDTest, arch: armv7, UUID: C8469F85-B060-3085-B69D-E46C645560EA)'
)
expect(output[7]).toContain(
'Uploading C8469F85-B060-3085-B69D-E46C645560EA.zip (DDTest, arch: armv7, UUID: C8469F85-B060-3085-B69D-E46C645560EA)'
'Uploading 06EE3D68-D605-3E92-B92D-2F48C02A505E.zip (DDTest, arch: arm64, UUID: 06EE3D68-D605-3E92-B92D-2F48C02A505E)'
)
expect(output[8]).toContain(
'Uploading 06EE3D68-D605-3E92-B92D-2F48C02A505E.zip (DDTest, arch: arm64, UUID: 06EE3D68-D605-3E92-B92D-2F48C02A505E)'
'Uploading 3BC12422-63CC-30E8-B916-E5006CE3286C.zip (DDTest, arch: arm64, UUID: 3BC12422-63CC-30E8-B916-E5006CE3286C)'
)
expect(output[11]).toContain('Handled 3 dSYMs with success')
})
Expand Down
2 changes: 1 addition & 1 deletion src/commands/dsyms/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs, {promises} from 'fs'

import {glob} from 'glob'
import glob from 'glob'

import {buildPath} from '../../../helpers/utils'

Expand Down
2 changes: 1 addition & 1 deletion src/commands/dsyms/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'path'

import chalk from 'chalk'
import {Command, Option} from 'clipanion'
import {glob} from 'glob'
import glob from 'glob'

import {ApiKeyValidator, newApiKeyValidator} from '../../helpers/apikey'
import {doWithMaxConcurrency} from '../../helpers/concurrency'
Expand Down
5 changes: 3 additions & 2 deletions src/commands/elf-symbols/upload.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs'

import {Command, Option} from 'clipanion'
import {glob} from 'glob'
import glob from 'glob'

import {newApiKeyValidator} from '../../helpers/apikey'
import {doWithMaxConcurrency} from '../../helpers/concurrency'
Expand Down Expand Up @@ -178,7 +178,8 @@ export class UploadCommand extends Command {

const stat = await fs.promises.stat(symbolsLocation)
if (stat.isDirectory()) {
paths = await glob(buildPath(symbolsLocation, '**'), {dot: true, dotRelative: true})
// strict: false is needed to avoid throwing an error if a directory is not readable
paths = glob.sync(buildPath(symbolsLocation, '**'), {dot: true, strict: false, silent: true})
reportFailure = (message: string) => this.context.stdout.write(renderWarning(message))

// throw an error if top-level directory is not readable
Expand Down
6 changes: 3 additions & 3 deletions src/commands/flutter-symbols/__tests__/upload.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ describe('flutter-symbol upload', () => {
const files = command['getFlutterSymbolFiles'](searchDir)

expect(files).toEqual([
`${searchDir}/app.ios-arm64.symbols`,
`${searchDir}/app.android-x64.symbols`,
`${searchDir}/app.android-arm64.symbols`,
`${searchDir}/app.android-arm.symbols`,
`${searchDir}/app.android-arm64.symbols`,
`${searchDir}/app.android-x64.symbols`,
`${searchDir}/app.ios-arm64.symbols`,
])
})
})
Expand Down
4 changes: 2 additions & 2 deletions src/commands/flutter-symbols/upload.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs'

import {Command, Option} from 'clipanion'
import {glob} from 'glob'
import glob from 'glob'
import yaml from 'js-yaml'
import semver from 'semver'

Expand Down Expand Up @@ -199,7 +199,7 @@ export class UploadCommand extends Command {
}

private getFlutterSymbolFiles(dartSymbolLocation: string): string[] {
const symbolPaths = glob.sync(buildPath(dartSymbolLocation, '*.symbols'), {dotRelative: true})
const symbolPaths = glob.sync(buildPath(dartSymbolLocation, '*.symbols'))

return symbolPaths
}
Expand Down
32 changes: 16 additions & 16 deletions src/commands/junit/__tests__/upload.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ describe('upload', () => {
)

expect(firstFile).toMatchObject({
xmlPath: './src/commands/junit/__tests__/fixtures/java-report.xml',
xmlPath: './src/commands/junit/__tests__/fixtures/go-report.xml',
})
expect(secondFile).toMatchObject({
xmlPath: './src/commands/junit/__tests__/fixtures/go-report.xml',
xmlPath: './src/commands/junit/__tests__/fixtures/java-report.xml',
})

const output = context.stdout.toString()
Expand Down Expand Up @@ -128,10 +128,10 @@ describe('upload', () => {
{}
)
expect(firstFile).toMatchObject({
xmlPath: './src/commands/junit/__tests__/fixtures/java-report.xml',
xmlPath: './src/commands/junit/__tests__/fixtures/go-report.xml',
})
expect(secondFile).toMatchObject({
xmlPath: './src/commands/junit/__tests__/fixtures/go-report.xml',
xmlPath: './src/commands/junit/__tests__/fixtures/java-report.xml',
})
expect(thirdFile).toMatchObject({
xmlPath: './src/commands/junit/__tests__/fixtures/subfolder/js-report.xml',
Expand All @@ -154,10 +154,10 @@ describe('upload', () => {
{}
)
expect(firstFile).toMatchObject({
xmlPath: './src/commands/junit/__tests__/fixtures/junit.xml/valid-report.xml',
xmlPath: './src/commands/junit/__tests__/fixtures/junit.xml/valid-report-2.xml',
})
expect(secondFile).toMatchObject({
xmlPath: './src/commands/junit/__tests__/fixtures/junit.xml/valid-report-2.xml',
xmlPath: './src/commands/junit/__tests__/fixtures/junit.xml/valid-report.xml',
})
})
test('should not have repeated files', async () => {
Expand Down Expand Up @@ -268,11 +268,11 @@ describe('upload', () => {
const fileNames = files.map((file) => file.xmlPath)

expect(fileNames).toEqual([
'./src/commands/junit/__tests__/fixtures/java-report.xml',
'./src/commands/junit/__tests__/fixtures/go-report.xml',
'./src/commands/junit/__tests__/fixtures/subfolder/js-report.xml',
'./src/commands/junit/__tests__/fixtures/junit.xml/valid-report.xml',
'./src/commands/junit/__tests__/fixtures/junit.xml/valid-report-2.xml',
'src/commands/junit/__tests__/fixtures/go-report.xml',
'src/commands/junit/__tests__/fixtures/java-report.xml',
'src/commands/junit/__tests__/fixtures/junit.xml/valid-report-2.xml',
'src/commands/junit/__tests__/fixtures/junit.xml/valid-report.xml',
'src/commands/junit/__tests__/fixtures/subfolder/js-report.xml',
])
})
test('should fetch nested folders and ignore non xml files', async () => {
Expand All @@ -294,11 +294,11 @@ describe('upload', () => {
const fileNames = files.map((file) => file.xmlPath)

expect(fileNames).toEqual([
'./src/commands/junit/__tests__/fixtures/java-report.xml',
'./src/commands/junit/__tests__/fixtures/go-report.xml',
'./src/commands/junit/__tests__/fixtures/subfolder/js-report.xml',
'./src/commands/junit/__tests__/fixtures/junit.xml/valid-report.xml',
'./src/commands/junit/__tests__/fixtures/junit.xml/valid-report-2.xml',
'src/commands/junit/__tests__/fixtures/go-report.xml',
'src/commands/junit/__tests__/fixtures/java-report.xml',
'src/commands/junit/__tests__/fixtures/junit.xml/valid-report-2.xml',
'src/commands/junit/__tests__/fixtures/junit.xml/valid-report.xml',
'src/commands/junit/__tests__/fixtures/subfolder/js-report.xml',
])
})
})
Expand Down
6 changes: 2 additions & 4 deletions src/commands/junit/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import path from 'path'
import chalk from 'chalk'
import {Command, Option} from 'clipanion'
import {XMLParser, XMLValidator} from 'fast-xml-parser'
import {glob} from 'glob'
import glob from 'glob'
import * as t from 'typanion'

import {getCISpanTags} from '../../helpers/ci'
Expand Down Expand Up @@ -286,9 +286,7 @@ export class UploadJUnitXMLCommand extends Command {
globPattern = buildPath(basePath, '*.xml')
}

const filesToUpload = glob
.sync(globPattern, {dotRelative: true})
.filter((file) => path.extname(file) === '.xml')
const filesToUpload = glob.sync(globPattern).filter((file) => path.extname(file) === '.xml')

return acc.concat(filesToUpload)
}, [])
Expand Down
8 changes: 4 additions & 4 deletions src/commands/sarif/__tests__/upload.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ describe('upload', () => {

expect(firstFile).toMatchObject({
service: 'service',
reportPath: './src/commands/sarif/__tests__/fixtures/valid-results.sarif',
reportPath: './src/commands/sarif/__tests__/fixtures/valid-no-results.sarif',
})
expect(secondFile).toMatchObject({
service: 'service',
reportPath: './src/commands/sarif/__tests__/fixtures/valid-no-results.sarif',
reportPath: './src/commands/sarif/__tests__/fixtures/valid-results.sarif',
})

const getInvalidJsonUnexpectedTokenErrorMessage = () => {
Expand Down Expand Up @@ -146,11 +146,11 @@ describe('upload', () => {
)
expect(firstFile).toMatchObject({
service: 'service',
reportPath: './src/commands/sarif/__tests__/fixtures/valid-results.sarif',
reportPath: './src/commands/sarif/__tests__/fixtures/valid-no-results.sarif',
})
expect(secondFile).toMatchObject({
service: 'service',
reportPath: './src/commands/sarif/__tests__/fixtures/valid-no-results.sarif',
reportPath: './src/commands/sarif/__tests__/fixtures/valid-results.sarif',
})
expect(thirdFile).toMatchObject({
service: 'service',
Expand Down
4 changes: 2 additions & 2 deletions src/commands/sarif/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Ajv from 'ajv'
import addFormats from 'ajv-formats'
import chalk from 'chalk'
import {Command, Option} from 'clipanion'
import {glob} from 'glob'
import glob from 'glob'

import {doWithMaxConcurrency} from '../../helpers/concurrency'
import {DatadogCiConfig} from '../../helpers/config'
Expand Down Expand Up @@ -195,7 +195,7 @@ export class UploadSarifReportCommand extends Command {
return acc.concat(fs.existsSync(basePath) ? [basePath] : [])
}

return acc.concat(glob.sync(buildPath(basePath, '*.sarif'), {dotRelative: true}))
return acc.concat(glob.sync(buildPath(basePath, '*.sarif')))
}, [])

const validUniqueFiles = [...new Set(sarifReports)].filter((sarifReport) => {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/sourcemaps/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {URL} from 'url'

import chalk from 'chalk'
import {Command, Option} from 'clipanion'
import {glob} from 'glob'
import glob from 'glob'

import {ApiKeyValidator, newApiKeyValidator} from '../../helpers/apikey'
import {getBaseSourcemapIntakeUrl} from '../../helpers/base-intake-url'
Expand Down
4 changes: 2 additions & 2 deletions src/commands/synthetics/__tests__/utils/public.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import type * as path from 'path'

import {default as axios} from 'axios'
import deepExtend from 'deep-extend'
import {glob} from 'glob'
import glob from 'glob'

process.env.DATADOG_SYNTHETICS_CI_TRIGGER_APP = 'env_default'

Expand Down Expand Up @@ -112,10 +112,10 @@ describe('utils', () => {
file2: '{"tests":"file2"}',
}

jest.spyOn(glob, 'glob').mockResolvedValue(FILES)
;(fs.readFile as any).mockImplementation((path: 'file1' | 'file2', opts: any, callback: any) =>
callback(undefined, FILES_CONTENT[path])
)
;(glob as any).mockImplementation((query: string, callback: (e: any, v: any) => void) => callback(undefined, FILES))
;(child_process.exec as any).mockImplementation(
(command: string, callback: (error: any, stdout: string, stderr: string) => void) => callback(undefined, '.', '')
)
Expand Down
4 changes: 2 additions & 2 deletions src/commands/synthetics/utils/public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import process from 'process'
import {promisify} from 'util'

import chalk from 'chalk'
import {glob} from 'glob'
import glob from 'glob'

import {getCommonAppBaseURL} from '../../../helpers/app'
import {getCIMetadata} from '../../../helpers/ci'
Expand Down Expand Up @@ -238,7 +238,7 @@ export const getResultOutcome = (result: Result): ResultOutcome => {
export const getSuites = async (GLOB: string, reporter: MainReporter): Promise<Suite[]> => {
reporter.log(`Finding files matching ${path.resolve(process.cwd(), GLOB)}\n`)

const files: string[] = await glob(GLOB)
const files: string[] = await promisify(glob)(GLOB)
if (files.length) {
reporter.log(`\nGot test files:\n${files.map((file) => ` - ${file}\n`).join('')}\n`)
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/unity-symbols/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs'
import path, {basename} from 'path'

import {Command, Option} from 'clipanion'
import {glob} from 'glob'
import glob from 'glob'

import {newApiKeyValidator} from '../../helpers/apikey'
import {doWithMaxConcurrency} from '../../helpers/concurrency'
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1943,7 +1943,7 @@ __metadata:
fast-xml-parser: ^4.4.1
form-data: 4.0.0
fuzzy: ^0.1.3
glob: ^11.0.0
glob: ^7.1.4
google-auth-library: ^9.12.0
inquirer: ^8.2.5
inquirer-checkbox-plus-prompt: ^1.4.2
Expand Down

0 comments on commit e86fb45

Please sign in to comment.