diff --git a/cli/lib/tasks/verify.js b/cli/lib/tasks/verify.js index 619ce4a9b6eb..826c35e1654f 100644 --- a/cli/lib/tasks/verify.js +++ b/cli/lib/tasks/verify.js @@ -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) diff --git a/cli/test/lib/tasks/verify_spec.js b/cli/test/lib/tasks/verify_spec.js index f1b314ff1de7..3865b44463c2 100644 --- a/cli/test/lib/tasks/verify_spec.js +++ b/cli/test/lib/tasks/verify_spec.js @@ -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`)]