mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-07 23:40:21 -05:00
feat: CLI config not supporting nested properties correctly (#20127)
* Support setting testingType specific config at root via cli args * Properly merge CLI testing-type specific arguments * Include CLI overrides when refreshing project config in dataContext * Make TS happy * Update config nesting to work without explicitly passed in testing type * Fix types * Fix types gooder * Fix server unit test for config nesting Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
This commit is contained in:
@@ -12,6 +12,10 @@ const _ = require('lodash')
|
||||
describe('lib/modes/info', () => {
|
||||
beforeEach(() => {
|
||||
capture.restore()
|
||||
|
||||
sinon.stub(browserUtils, 'getBrowserPath')
|
||||
.withArgs(chromeStable).returns('/path/to/user/chrome/profile')
|
||||
.withArgs(firefoxDev).returns('/path/to/user/firefox/profile')
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
@@ -54,6 +58,7 @@ describe('lib/modes/info', () => {
|
||||
|
||||
it('prints 1 found browser', async () => {
|
||||
sinon.stub(detect, 'detect').resolves([chromeStable])
|
||||
|
||||
await infoAndSnapshot('single chrome:stable')
|
||||
})
|
||||
|
||||
@@ -73,9 +78,6 @@ describe('lib/modes/info', () => {
|
||||
|
||||
it('adds profile for browser if folder exists', async () => {
|
||||
sinon.stub(detect, 'detect').resolves([chromeStable, firefoxDev])
|
||||
sinon.stub(browserUtils, 'getBrowserPath')
|
||||
.withArgs(chromeStable).returns('/path/to/user/chrome/profile')
|
||||
.withArgs(firefoxDev).returns('/path/to/user/firefox/profile')
|
||||
|
||||
sinon.stub(fs, 'statAsync')
|
||||
.withArgs('/path/to/user/chrome/profile').throws('No Chrome profile folder')
|
||||
|
||||
@@ -368,9 +368,11 @@ describe('lib/util/args', () => {
|
||||
const options = this.setup('--config', 'foo=bar,port=1111,supportFile=path/to/support_file')
|
||||
|
||||
expect(options.config.port).to.eq(1111)
|
||||
expect(options.config.supportFile).to.eq('path/to/support_file')
|
||||
expect(options.config.e2e.supportFile).to.eq('path/to/support_file')
|
||||
expect(options.config.component.supportFile).to.eq('path/to/support_file')
|
||||
|
||||
expect(options).not.to.have.property('foo')
|
||||
expect(options.config).not.to.have.property('supportFile')
|
||||
})
|
||||
|
||||
it('overrides port in config', function () {
|
||||
@@ -595,6 +597,20 @@ describe('lib/util/args', () => {
|
||||
config: {},
|
||||
})
|
||||
})
|
||||
|
||||
it('moves testing-type specific config options', function () {
|
||||
const result = argsUtil.toObject(['--config', '{"baseUrl": "http://foobar.com", "specPattern":"**/*.test.js"}'])
|
||||
|
||||
expect(result).to.deep.equal({
|
||||
cwd,
|
||||
_: [],
|
||||
invokedFromCli: false,
|
||||
config: {
|
||||
e2e: { baseUrl: 'http://foobar.com', specPattern: '**/*.test.js' },
|
||||
component: { specPattern: '**/*.test.js' },
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
context('--updating', () => {
|
||||
|
||||
Reference in New Issue
Block a user