Skip to content

Commit

Permalink
fix: use util.getEnv to handle environment variables set with npm (#1…
Browse files Browse the repository at this point in the history
…9560)

Co-authored-by: Matt Henkes <[email protected]>
Co-authored-by: Emily Rohrbough <[email protected]>
  • Loading branch information
3 people committed Jan 12, 2022
1 parent 0382768 commit 576519e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cli/lib/tasks/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const logger = require('../logger')
const xvfb = require('../exec/xvfb')
const state = require('./state')

const VERIFY_TEST_RUNNER_TIMEOUT_MS = +process.env.CYPRESS_VERIFY_TIMEOUT || 30000
const VERIFY_TEST_RUNNER_TIMEOUT_MS = +util.getEnv('CYPRESS_VERIFY_TIMEOUT') || 30000

const checkExecutable = (binaryDir) => {
const executable = state.getPathToExecutable(binaryDir)
Expand Down
8 changes: 8 additions & 0 deletions cli/test/lib/tasks/verify_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ context('lib/tasks/verify', () => {
expect(newVerifyInstance.VERIFY_TEST_RUNNER_TIMEOUT_MS).to.eql(500000)
})

it('accepts custom verify task timeout from npm', () => {
process.env.npm_config_CYPRESS_VERIFY_TIMEOUT = '500000'
delete require.cache[require.resolve(`${lib}/tasks/verify`)]
const newVerifyInstance = require(`${lib}/tasks/verify`)

expect(newVerifyInstance.VERIFY_TEST_RUNNER_TIMEOUT_MS).to.eql(500000)
})

it('falls back to default verify task timeout if custom value is invalid', () => {
process.env.CYPRESS_VERIFY_TIMEOUT = 'foobar'
delete require.cache[require.resolve(`${lib}/tasks/verify`)]
Expand Down

3 comments on commit 576519e

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 576519e Jan 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.2.2/circle-develop-576519e465af28e2ed3f0b2c181fbe8f17e348a2/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 576519e Jan 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.2.2/circle-develop-576519e465af28e2ed3f0b2c181fbe8f17e348a2/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 576519e Jan 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.2.2/circle-develop-576519e465af28e2ed3f0b2c181fbe8f17e348a2/cypress.tgz

Please sign in to comment.