Skip to content

Commit d57db87

Browse files
chore: Replace Bluebird.resolve/reject with native Promise.resolve/reject (#33035)
* chore: Update Bluebird resolve to Promise.resolve * Fix parallel calls to getHttpsOptions (used in tests) * revert Promise.resolve and add note * update columns for stack traces
1 parent a738f01 commit d57db87

File tree

20 files changed

+55
-36
lines changed

20 files changed

+55
-36
lines changed

cli/lib/tasks/download.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ const verifyDownloadedFile = async (filename: string, expectedSize?: number, exp
202202
// {filename: ..., downloaded: true}
203203
const downloadFromUrl = ({ url, downloadDestination, progress, ca, version, redirectTTL = defaultMaxRedirects }: any): any => {
204204
if (redirectTTL <= 0) {
205-
return Bluebird.reject(new Error(
205+
return Promise.reject(new Error(
206206
stripIndent`
207207
Failed downloading the Cypress binary.
208208
There were too many redirects. The default allowance is ${defaultMaxRedirects}.

cli/lib/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ const util = {
409409
},
410410

411411
isExecutableAsync (filePath: string): any {
412-
return Bluebird.resolve(executable(filePath))
412+
return Promise.resolve(executable(filePath))
413413
},
414414

415415
isLinux,

packages/app/cypress/e2e/runner/reporter-ct-generator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ export const generateCtUncaughtErrorTests = (server: 'Webpack' | 'Vite', configF
631631

632632
verify('spec Bluebird unhandled rejection', {
633633
uncaught: true,
634-
column: [21, 22],
634+
column: [19, 20, 21],
635635
originalMessage: 'Unhandled promise rejection from the spec',
636636
message: [
637637
'The following error originated from your application code',
@@ -642,7 +642,7 @@ export const generateCtUncaughtErrorTests = (server: 'Webpack' | 'Vite', configF
642642

643643
verify('spec Bluebird unhandled rejection with done', {
644644
uncaught: true,
645-
column: [21, 22],
645+
column: [19, 20, 21],
646646
originalMessage: 'Unhandled promise rejection from the spec',
647647
message: [
648648
'The following error originated from your application code',

packages/app/cypress/e2e/runner/reporter.errors.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ describe('errors ui', {
204204

205205
verify('spec Bluebird unhandled rejection', {
206206
uncaught: true,
207-
column: 21,
207+
column: 20,
208208
originalMessage: 'Unhandled promise rejection from the spec',
209209
message: [
210210
'The following error originated from your test code',
@@ -214,7 +214,7 @@ describe('errors ui', {
214214

215215
verify('spec Bluebird unhandled rejection with done', {
216216
uncaught: true,
217-
column: 21,
217+
column: 20,
218218
originalMessage: 'Unhandled promise rejection from the spec',
219219
message: [
220220
'The following error originated from your test code',

packages/app/src/runner/event-manager.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,8 @@ export class EventManager {
582582

583583
Cypress.on('collect:run:state', () => {
584584
if (Cypress.config('hideCommandLog')) {
585+
// TODO: Need more refactoring to use native Promise here since
586+
// this goes to events.emitThen = map(Bluebird.map) which expect a Bluebird promise
585587
return Bluebird.resolve()
586588
}
587589

packages/config/src/project/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ export function relativeToProjectRoot (projectRoot: string, file: string) {
274274
// async function
275275
export async function setSupportFileAndFolder (obj: Config, getFilesByGlob: any) {
276276
if (!obj.supportFile) {
277-
return Bluebird.resolve(obj)
277+
return Promise.resolve(obj)
278278
}
279279

280280
obj = _.clone(obj)

packages/launcher/lib/linux/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function getLinuxBrowser (
109109
export function getVersionString (path: string) {
110110
debugVerbose('finding version string using command "%s --version"', path)
111111

112-
return Bluebird.resolve(utils.getOutput(path, ['--version']))
112+
return utils.getOutput(path, ['--version'])
113113
.timeout(30000, `Timed out after 30 seconds getting browser version for ${path}`)
114114
.then((val) => val.stdout)
115115
.then((val) => val.trim())

packages/proxy/lib/http/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export function _runStage (type: HttpStages, ctx: any, onError: Function) {
141141
const middlewareName = _.keys(middlewares)[0]
142142

143143
if (!middlewareName) {
144-
return Bluebird.resolve()
144+
return Promise.resolve()
145145
}
146146

147147
const middleware = middlewares[middlewareName]

packages/server/lib/browsers/chrome.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ const _getDefaultChromePreferences = (): ChromePreferences => {
7676
* Reads all known preference files (CHROME_PREFERENCE_PATHS) from disk and return
7777
* @param userDir
7878
*/
79-
const _getChromePreferences = (userDir: string): Bluebird<ChromePreferences> => {
79+
const _getChromePreferences = (userDir: string): Promise<ChromePreferences> => {
8080
// skip reading the preferences if requested by the user,
8181
// typically used when the AUT encrypts the user data dir, causing relaunches of the browser not to work
8282
// see https://github.com/cypress-io/cypress/issues/29330
8383
if (process.env.IGNORE_CHROME_PREFERENCES) {
8484
debug('ignoring chrome preferences: not reading from chrome preference files')
8585

86-
return Bluebird.resolve(_.mapValues(CHROME_PREFERENCE_PATHS, () => ({})))
86+
return Promise.resolve(_.mapValues(CHROME_PREFERENCE_PATHS, () => ({})))
8787
}
8888

8989
debug('reading chrome preferences... %o', { userDir, CHROME_PREFERENCE_PATHS })

packages/server/lib/cloud/api/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const rp = request.defaults((params: CypressRequestOptions, callback) => {
8080
if (params.cacheable && (resp = getCachedResponse(params))) {
8181
debug('resolving with cached response for %o', { url: params.url })
8282

83-
return Bluebird.resolve(resp)
83+
return Promise.resolve(resp)
8484
}
8585

8686
_.defaults(params, {

0 commit comments

Comments
 (0)