Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -632,4 +632,10 @@ describe('PathLookup', () => {
expect(await lookup.lookupPath('node')).toBeDefined()
expect(await lookup.lookupPath('checkly-no-such-executable-xyz')).toBeUndefined()
})

it('detects the presence of an executable on PATH and throws for one that is missing', async () => {
const lookup = new PathLookup()
await expect(lookup.detectPresence('node')).resolves.toBeUndefined()
await expect(lookup.detectPresence('checkly-no-such-executable-xyz')).rejects.toThrow()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -819,15 +819,8 @@ export class PathLookup {
}
}

// FIXME(RED-887): the missing `await` below means `foundPath` is a
// Promise — always defined — so this never throws and executable
// detection always "succeeds". Fixing it changes package-manager
// detection outcomes on machines that lack the executable, so it is
// tracked as a follow-up rather than fixed in passing; use lookupPath()
// for a working check.
// eslint-disable-next-line require-await
async detectPresence (executable: string): Promise<void> {
const foundPath = this.lookupPath(executable)
const foundPath = await this.lookupPath(executable)
if (foundPath === undefined) {
throw new NotDetectedError()
}
Expand Down
Loading