Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal: add env variable to force scaffolding #7558

Merged
merged 3 commits into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions packages/server/lib/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,15 @@ class Project extends EE {
// and example support file if dir doesnt exist
push(scaffold.support(cfg.supportFolder, cfg))

// if we're in headed mode add these other scaffolding
// tasks
if (!cfg.isTextTerminal) {
// if we're in headed mode add these other scaffolding tasks
const scaffoldExamples = !cfg.isTextTerminal || process.env.CYPRESS_INTERNAL_FORCE_SCAFFOLD

if (scaffoldExamples) {
debug('will scaffold integration and fixtures folder')
jennifer-shehane marked this conversation as resolved.
Show resolved Hide resolved
push(scaffold.integration(cfg.integrationFolder, cfg))
push(scaffold.fixture(cfg.fixturesFolder, cfg))
} else {
debug('will not scaffold integration or fixtures folder')
jennifer-shehane marked this conversation as resolved.
Show resolved Hide resolved
}

return Promise.all(scaffolds)
Expand Down
23 changes: 23 additions & 0 deletions packages/server/test/unit/project_spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require('../spec_helper')

const mockedEnv = require('mocked-env')
const path = require('path')
const commitInfo = require('@cypress/commit-info')
const tsnode = require('ts-node')
Expand Down Expand Up @@ -468,6 +469,28 @@ This option will not have an effect in Some-other-name. Tests that rely on web s
expect(scaffold.plugins).not.to.be.called
})
})

bahmutov marked this conversation as resolved.
Show resolved Hide resolved
describe('forced', () => {
let resetEnv

beforeEach(() => {
resetEnv = mockedEnv({
CYPRESS_INTERNAL_FORCE_SCAFFOLD: '1',
})
})

afterEach(() => {
resetEnv()
})

it('calls scaffold when forced by environment variable', function () {
return this.project.scaffold(this.obj).then(() => {
expect(scaffold.integration).to.be.calledWith(this.obj.integrationFolder)
expect(scaffold.fixture).to.be.calledWith(this.obj.fixturesFolder)
expect(scaffold.support).to.be.calledWith(this.obj.supportFolder)
})
})
})
})

context('#watchSettings', () => {
Expand Down