Skip to content

Commit

Permalink
chore: remove Firefox < 80 auto garbage collection (#17368)
Browse files Browse the repository at this point in the history
  • Loading branch information
flotwig authored Jul 19, 2021
1 parent deee831 commit 97c03c1
Show file tree
Hide file tree
Showing 26 changed files with 40 additions and 920 deletions.
240 changes: 0 additions & 240 deletions packages/driver/cypress/integration/util/firefox_forced_gc_spec.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/driver/src/cypress.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const $Commands = require('./cypress/commands')
const $Cookies = require('./cypress/cookies')
const $Cy = require('./cypress/cy')
const $Events = require('./cypress/events')
const $FirefoxForcedGc = require('./util/firefox_forced_gc')
const $Keyboard = require('./cy/keyboard')
const $SetterGetter = require('./cypress/setter_getter')
const $Log = require('./cypress/log')
Expand Down Expand Up @@ -137,7 +136,6 @@ class $Cypress {
this.originalConfig = _.cloneDeep(config)
this.config = $SetterGetter.create(config)
this.env = $SetterGetter.create(env)
this.getFirefoxGcInterval = $FirefoxForcedGc.createIntervalGetter(this)
this.getTestRetries = function () {
const testRetries = this.config('retries')

Expand Down Expand Up @@ -213,8 +211,6 @@ class $Cypress {

this.events.proxyTo(this.cy)

$FirefoxForcedGc.install(this)

$scriptUtils.runScripts(specWindow, scripts)
.catch((error) => {
this.runner.onSpecError('error')({ error })
Expand Down
64 changes: 0 additions & 64 deletions packages/driver/src/util/firefox_forced_gc.ts

This file was deleted.

13 changes: 0 additions & 13 deletions packages/launcher/lib/detect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,21 +133,9 @@ function checkOneBrowser (browser: Browser): Promise<boolean | FoundBrowser> {
.then(pickBrowserProps)
.then(tap(logBrowser))
.then((browser) => setMajorVersion(browser))
.then(maybeSetFirefoxWarning)
.catch(failed)
}

export const firefoxGcWarning = 'This version of Firefox has a bug that causes excessive memory consumption and will cause your tests to run slowly. It is recommended to upgrade to Firefox 80 or newer. [Learn more.](https://docs.cypress.io/guides/references/configuration.html#firefoxGcInterval)'

// @see https://github.com/cypress-io/cypress/issues/8241
const maybeSetFirefoxWarning = (browser: FoundBrowser) => {
if (browser.family === 'firefox' && Number(browser.majorVersion) < 80) {
browser.warning = firefoxGcWarning
}

return browser
}

/** returns list of detected browsers */
export const detect = (goalBrowsers?: Browser[]): Bluebird<FoundBrowser[]> => {
// we can detect same browser under different aliases
Expand Down Expand Up @@ -232,7 +220,6 @@ export const detectByPath = (

return setCustomBrowserData(browser, pathData.path, version)
})
.then(maybeSetFirefoxWarning)
.catch((err: NotDetectedAtPathError) => {
if (err.notDetectedAtPath) {
throw err
Expand Down
17 changes: 1 addition & 16 deletions packages/launcher/test/unit/detect_spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require('../spec_helper')
import { firefoxGcWarning, detect, detectByPath, setMajorVersion } from '../../lib/detect'
import { detect, detectByPath, setMajorVersion } from '../../lib/detect'
import { goalBrowsers } from '../fixtures'
import { expect } from 'chai'
import { utils } from '../../lib/utils'
Expand Down Expand Up @@ -167,20 +167,5 @@ describe('browser detection', () => {
expect(foundBrowser.warning).to.contain('does not support running Custom Firefox version 85')
.and.contain('Firefox newer than or equal to 86')
})

// @see https://github.com/cypress-io/cypress/issues/8241
it('adds warnings to Firefox versions less than 80', async () => {
execa.withArgs('/good-firefox', ['--version'])
.resolves({ stdout: 'Mozilla Firefox 80.0' })

execa.withArgs('/bad-firefox', ['--version'])
.resolves({ stdout: 'Mozilla Firefox 79.1' })

// TODO: remove this warning/auto-GC, since Cy no longer supports FF < 86
// expect(await detectByPath('/good-firefox')).to.not.have.property('warning')
expect(await detectByPath('/bad-firefox')).to.include({
warning: firefoxGcWarning,
})
})
})
})
Loading

0 comments on commit 97c03c1

Please sign in to comment.