mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-29 19:41:16 -05:00
Always pass NODE_OPTIONS with max-http-header-size (#5452)
* cli: set NODE_OPTIONS=--max-http-header-size=1024*1024 on spawn * electron: remove redundant max-http-header-size * server: add useCli option to make e2e tests go thru cli * server: add test for XHR with body > 100kb via CLI * clean up conditional * cli: don't pass --max-http-header-size in dev w node < 11.10 * add original_node_options to restore o.g. user node_options * force no color
This commit is contained in:
committed by
Jennifer Shehane
parent
3a747abf5d
commit
978d97ee6d
@@ -3,6 +3,7 @@ require('../../spec_helper')
|
||||
const _ = require('lodash')
|
||||
const cp = require('child_process')
|
||||
const os = require('os')
|
||||
const snapshot = require('snap-shot-it')
|
||||
const tty = require('tty')
|
||||
const path = require('path')
|
||||
const EE = require('events')
|
||||
@@ -287,14 +288,7 @@ describe('lib/exec/spawn', function () {
|
||||
|
||||
return spawn.start([], { env: {} })
|
||||
.then(() => {
|
||||
expect(cp.spawn.firstCall.args[2].env).to.deep.eq({
|
||||
FORCE_COLOR: '1',
|
||||
DEBUG_COLORS: '1',
|
||||
MOCHA_COLORS: '1',
|
||||
FORCE_STDERR_TTY: '1',
|
||||
FORCE_STDIN_TTY: '1',
|
||||
FORCE_STDOUT_TTY: '1',
|
||||
})
|
||||
snapshot(cp.spawn.firstCall.args[2].env)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -326,13 +320,7 @@ describe('lib/exec/spawn', function () {
|
||||
|
||||
return spawn.start([], { env: {} })
|
||||
.then(() => {
|
||||
expect(cp.spawn.firstCall.args[2].env).to.deep.eq({
|
||||
FORCE_COLOR: '0',
|
||||
DEBUG_COLORS: '0',
|
||||
FORCE_STDERR_TTY: '0',
|
||||
FORCE_STDIN_TTY: '0',
|
||||
FORCE_STDOUT_TTY: '0',
|
||||
})
|
||||
snapshot(cp.spawn.firstCall.args[2].env)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ require('../spec_helper')
|
||||
const os = require('os')
|
||||
const tty = require('tty')
|
||||
const snapshot = require('../support/snapshot')
|
||||
const mockedEnv = require('mocked-env')
|
||||
const supportsColor = require('supports-color')
|
||||
const proxyquire = require('proxyquire')
|
||||
const hasha = require('hasha')
|
||||
@@ -11,6 +12,9 @@ const la = require('lazy-ass')
|
||||
const util = require(`${lib}/util`)
|
||||
const logger = require(`${lib}/logger`)
|
||||
|
||||
// https://github.com/cypress-io/cypress/issues/5431
|
||||
const expectedNodeOptions = `--max-http-header-size=${1024 * 1024}`
|
||||
|
||||
describe('util', () => {
|
||||
beforeEach(() => {
|
||||
sinon.stub(process, 'exit')
|
||||
@@ -213,6 +217,7 @@ describe('util', () => {
|
||||
FORCE_COLOR: '1',
|
||||
DEBUG_COLORS: '1',
|
||||
MOCHA_COLORS: '1',
|
||||
NODE_OPTIONS: expectedNodeOptions,
|
||||
})
|
||||
|
||||
util.supportsColor.returns(false)
|
||||
@@ -224,10 +229,49 @@ describe('util', () => {
|
||||
FORCE_STDERR_TTY: '0',
|
||||
FORCE_COLOR: '0',
|
||||
DEBUG_COLORS: '0',
|
||||
NODE_OPTIONS: expectedNodeOptions,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
context('.getNodeOptions', () => {
|
||||
let restoreEnv
|
||||
|
||||
afterEach(() => {
|
||||
if (restoreEnv) {
|
||||
restoreEnv()
|
||||
restoreEnv = null
|
||||
}
|
||||
})
|
||||
|
||||
it('adds required NODE_OPTIONS', () => {
|
||||
restoreEnv = mockedEnv({
|
||||
NODE_OPTIONS: undefined,
|
||||
})
|
||||
|
||||
expect(util.getNodeOptions({})).to.deep.eq({
|
||||
NODE_OPTIONS: expectedNodeOptions,
|
||||
})
|
||||
})
|
||||
|
||||
it('includes existing NODE_OPTIONS', () => {
|
||||
restoreEnv = mockedEnv({
|
||||
NODE_OPTIONS: '--foo --bar',
|
||||
})
|
||||
|
||||
expect(util.getNodeOptions({})).to.deep.eq({
|
||||
NODE_OPTIONS: `${expectedNodeOptions} --foo --bar`,
|
||||
ORIGINAL_NODE_OPTIONS: '--foo --bar',
|
||||
})
|
||||
})
|
||||
|
||||
it('does not return if dev is set and version < 12', () => {
|
||||
expect(util.getNodeOptions({
|
||||
dev: true,
|
||||
}, 11)).to.be.undefined
|
||||
})
|
||||
})
|
||||
|
||||
context('.getForceTty', () => {
|
||||
it('forces when each stream is a tty', () => {
|
||||
sinon.stub(tty, 'isatty')
|
||||
|
||||
Reference in New Issue
Block a user