mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-22 06:59:30 -06:00
fix: use util.getEnv to handle environment variables set with npm (#19560)
Co-authored-by: Matt Henkes <mjhenkes@gmail.com> Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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`)]
|
||||
|
||||
Reference in New Issue
Block a user