Skip to content

Commit f987981

Browse files
authored
fix: prevent Cypress from crashing when getting machine-id fails (#22119)
1 parent 64ea96b commit f987981

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/data-context/src/sources/VersionsDataSource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export class VersionsDataSource {
182182

183183
private static async machineId (): Promise<string | undefined> {
184184
try {
185-
return nmi.machineId()
185+
return await nmi.machineId()
186186
} catch (error) {
187187
return undefined
188188
}

packages/data-context/test/unit/sources/VersionsDataSource.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ describe('VersionsDataSource', () => {
9090
it('resets telemetry data triggering a new call to get the latest version', async () => {
9191
const currentCypressVersion = pkg.version
9292

93-
nmiStub.throws()
93+
nmiStub.rejects('Error while obtaining machine id')
9494
ctx.coreData.currentTestingType = 'component'
9595

9696
fetchStub

0 commit comments

Comments
 (0)