break: removing the experimentalCypressComponentTesting flag

This commit is contained in:
Jessica Sachs
2021-03-29 15:29:59 -04:00
parent 2ce77aaa74
commit 3b69ccc283
8 changed files with 11 additions and 85 deletions

View File

@@ -80,7 +80,7 @@ module.exports = {
const getSpecsHelper = () => {
// grab all of the specs if this is ci
const componentTestingEnabled = _.get(config, 'resolved.testingType', 'e2e') === 'component'
const componentTestingEnabled = _.get(config, 'resolved.testingType.value', 'e2e') === 'component'
if (spec === '__all') {
debug('returning all specs')

View File

@@ -167,7 +167,7 @@ const moduleFactory = () => {
)
}
const componentTestingEnabled = _.get(cfg, 'resolved.testingType', 'e2e') === 'component'
const componentTestingEnabled = _.get(cfg, 'resolved.testingType.value', 'e2e') === 'component'
if (componentTestingEnabled) {
// separate specs into integration and component lists
@@ -222,7 +222,7 @@ const moduleFactory = () => {
const createSpecsWatcher = (cfg) => {
// TODO I keep repeating this to get the resolved value
// probably better to have a single function that does this
const componentTestingEnabled = _.get(cfg, 'resolved.testingType', 'e2e') === 'component'
const componentTestingEnabled = _.get(cfg, 'resolved.testingType.value', 'e2e') === 'component'
debug('createSpecWatch component testing enabled', componentTestingEnabled)

View File

@@ -66,7 +66,7 @@ const filesSizesAreSame = (files, index) => {
}
const componentTestingEnabled = (config) => {
const componentTestingEnabled = _.get(config, 'resolved.testingType', 'e2e') === 'component'
const componentTestingEnabled = _.get(config, 'resolved.testingType.value', 'e2e') === 'component'
return componentTestingEnabled && !isDefault(config, 'componentFolder')
}

View File

@@ -76,7 +76,7 @@ module.exports = {
getAbsolutePathToSpec (spec, config) {
debug('get absolute path to spec %o', { spec })
const componentTestingEnabled = _.get(config, 'resolved.testingType', 'e2e') === 'component'
const componentTestingEnabled = _.get(config, 'resolved.testingType.value', 'e2e') === 'component'
// if our file is an integration test
// then figure out the absolute path

View File

@@ -185,7 +185,7 @@ function findSpecsOfType (searchOptions, specPattern) {
const find = (config, specPattern) => {
const commonSearchOptions = ['fixturesFolder', 'supportFile', 'projectRoot', 'javascripts', 'testFiles', 'ignoreTestFiles']
const componentTestingEnabled = _.get(config, 'resolved.testingType', 'e2e') === 'component'
const componentTestingEnabled = _.get(config, 'resolved.testingType.value', 'e2e') === 'component'
debug('componentTesting %o', componentTestingEnabled)
if (componentTestingEnabled) {
@@ -238,7 +238,9 @@ const find = (config, specPattern) => {
}
return Bluebird.resolve(
componentTestingEnabled ? findComponentSpecs : findIntegrationSpecs,
componentTestingEnabled ?
findComponentSpecs() :
findIntegrationSpecs(),
).tap((foundSpecs) => {
if (debug.enabled) {
printFoundSpecs(foundSpecs)

View File

@@ -13,7 +13,7 @@
"repl": "node repl.js",
"start": "node ../../scripts/cypress open --dev --global",
"test": "node ./test/scripts/run.js",
"test-e2e": "node ./test/scripts/run.js ./test/unit/specs_spec.js",
"test-e2e": "node ./test/scripts/run.js --glob-in-dir=test/e2e",
"test-integration": "node ./test/scripts/run.js --glob-in-dir=test/integration",
"test-performance": "node ./test/scripts/run.js --glob-in-dir=test/performance",
"test-unit": "node ./test/scripts/run.js --glob-in-dir=test/unit",

View File

@@ -1,76 +0,0 @@
const e2e = require('../support/helpers/e2e').default
const Fixtures = require('../support/helpers/fixtures')
const snapshot = require('snap-shot-it')
const path = require('path')
describe('e2e component tests', () => {
e2e.setup()
const project = Fixtures.projectPath('component-tests')
it('runs just the integration spec file', function () {
return e2e.exec(this, {
project,
spec: 'integration-spec.js',
config: {
ignoreTestFiles: '**fails**',
video: false,
},
})
.then((result) => {
const runSummary = e2e.leaveRunFinishedTable(e2e.normalizeStdout(result.stdout))
return snapshot('integration spec run', runSummary)
})
})
it('runs component spec file', function () {
// for now the component spec should use full path
const spec = path.join(project, 'cypress/component-tests/foo.spec.js')
return e2e.exec(this, {
project,
spec,
config: {
video: false,
ignoreTestFiles: '**fails**',
},
})
.then((result) => {
const runSummary = e2e.leaveRunFinishedTable(e2e.normalizeStdout(result.stdout))
return console.log(runSummary)
})
})
it('runs integration and component spec file when running all tests', function () {
return e2e.exec(this, {
project,
config: {
ignoreTestFiles: '**fails**',
video: false,
},
})
.then((result) => {
const runSummary = e2e.leaveRunFinishedTable(e2e.normalizeStdout(result.stdout))
return snapshot('all tests results summary', runSummary)
})
})
it('fails and exits with correct code', function () {
return e2e.exec(this, {
project,
config: {
video: false,
testingType: 'component',
},
expectedExitCode: 2,
})
.then((result) => {
const runSummary = e2e.leaveRunFinishedTable(e2e.normalizeStdout(result.stdout))
return snapshot('component testing exit codes', runSummary)
})
})
})

View File

@@ -62,7 +62,7 @@ describe('lib/util/specs', () => {
it('finds component tests if testingType === component', () => {
return config.get(FixturesHelper.projectPath('component-tests'))
.then((cfg) => {
cfg.resolved.testingType = 'component'
cfg.resolved.testingType = { value: 'component' }
return specsUtil.find(cfg)
}).then(R.project(['relative', 'specType']))