diff --git a/packages/server/lib/controllers/files.js b/packages/server/lib/controllers/files.js index 9ed18945d0..0d5a71c766 100644 --- a/packages/server/lib/controllers/files.js +++ b/packages/server/lib/controllers/files.js @@ -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') diff --git a/packages/server/lib/open_project.js b/packages/server/lib/open_project.js index 4913998fb2..1984fbb117 100644 --- a/packages/server/lib/open_project.js +++ b/packages/server/lib/open_project.js @@ -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) diff --git a/packages/server/lib/scaffold.js b/packages/server/lib/scaffold.js index 47ab7d9432..2dbb92f0fd 100644 --- a/packages/server/lib/scaffold.js +++ b/packages/server/lib/scaffold.js @@ -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') } diff --git a/packages/server/lib/util/path_helpers.js b/packages/server/lib/util/path_helpers.js index e52aeea3f6..2699a5e88b 100644 --- a/packages/server/lib/util/path_helpers.js +++ b/packages/server/lib/util/path_helpers.js @@ -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 diff --git a/packages/server/lib/util/specs.js b/packages/server/lib/util/specs.js index 040dde5e85..f484edef50 100644 --- a/packages/server/lib/util/specs.js +++ b/packages/server/lib/util/specs.js @@ -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) diff --git a/packages/server/package.json b/packages/server/package.json index 38d9085c9b..3d5dd333b8 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -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", diff --git a/packages/server/test/e2e/0_component_tests_spec.js b/packages/server/test/e2e/0_component_tests_spec.js deleted file mode 100644 index 301b1082fe..0000000000 --- a/packages/server/test/e2e/0_component_tests_spec.js +++ /dev/null @@ -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) - }) - }) -}) diff --git a/packages/server/test/unit/specs_spec.js b/packages/server/test/unit/specs_spec.js index 0deb1dd1ea..aac4be6fcc 100644 --- a/packages/server/test/unit/specs_spec.js +++ b/packages/server/test/unit/specs_spec.js @@ -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']))