From 2324d703c22cd0017c0e3b41ae098e92fbef22d9 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Mon, 29 Aug 2022 10:21:58 -0500 Subject: [PATCH] chore(server): remove redundant supportFile check (#23543) Co-authored-by: Chris Breiding --- .vscode/settings.json | 2 +- packages/server/lib/project-base.ts | 3 --- packages/server/lib/project_utils.ts | 14 ----------- packages/server/lib/server-e2e.ts | 2 ++ packages/server/test/unit/project_spec.js | 11 -------- .../server/test/unit/project_utils_spec.ts | 25 +------------------ 6 files changed, 4 insertions(+), 53 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index f651d34a4f42..47436c0f111d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -38,7 +38,7 @@ // Volar is the main extension that powers Vue's language features. // These are commented out because they slow down node development // "volar.autoCompleteRefs": false, - "volar.takeOverMode.enabled": true, + "volar.takeOverMode.enabled": "auto", "editor.tabSize": 2, } diff --git a/packages/server/lib/project-base.ts b/packages/server/lib/project-base.ts index 94315d6f636b..bd34d99478fb 100644 --- a/packages/server/lib/project-base.ts +++ b/packages/server/lib/project-base.ts @@ -10,7 +10,6 @@ import * as config from './config' import * as errors from './errors' import preprocessor from './plugins/preprocessor' import runEvents from './plugins/run_events' -import { checkSupportFile } from './project_utils' import Reporter from './reporter' import * as savedState from './saved_state' import { ServerCt } from './server-ct' @@ -225,8 +224,6 @@ export class ProjectBase extends EE { await this.saveState(stateToSave) - await checkSupportFile(cfg.supportFile) - if (cfg.isTextTerminal) { return } diff --git a/packages/server/lib/project_utils.ts b/packages/server/lib/project_utils.ts index 6d84f96a6767..df24ca64d791 100644 --- a/packages/server/lib/project_utils.ts +++ b/packages/server/lib/project_utils.ts @@ -1,8 +1,6 @@ import Debug from 'debug' import path from 'path' -import * as errors from './errors' import { escapeFilenameInUrl } from './util/escape_filename' -import { fs } from './util/fs' const debug = Debug('cypress:server:project_utils') @@ -35,15 +33,3 @@ export const getSpecUrl = ({ return specUrl } - -export const checkSupportFile = async (supportFile: Cypress.Config['supportFile']) => { - if (supportFile && typeof supportFile === 'string') { - const found = await fs.pathExists(supportFile) - - if (!found) { - errors.throwErr('SUPPORT_FILE_NOT_FOUND', supportFile) - } - } - - return -} diff --git a/packages/server/lib/server-e2e.ts b/packages/server/lib/server-e2e.ts index 67bd35e0eb8e..1399119dcecb 100644 --- a/packages/server/lib/server-e2e.ts +++ b/packages/server/lib/server-e2e.ts @@ -118,6 +118,8 @@ export class ServerE2E extends ServerBase { return ensureUrl.isListening(baseUrl) .return(null) .catch((err) => { + debug('ensuring baseUrl (%s) errored: %o', baseUrl, err) + return errors.get('CANNOT_CONNECT_BASE_URL_WARNING', baseUrl) }) } diff --git a/packages/server/test/unit/project_spec.js b/packages/server/test/unit/project_spec.js index ae77d612909c..670780d1cfb0 100644 --- a/packages/server/test/unit/project_spec.js +++ b/packages/server/test/unit/project_spec.js @@ -10,7 +10,6 @@ const config = require(`../../lib/config`) const scaffold = require(`../../lib/scaffold`) const { ServerE2E } = require(`../../lib/server-e2e`) const { ProjectBase } = require(`../../lib/project-base`) -const ProjectUtils = require(`../../lib/project_utils`) const { Automation } = require(`../../lib/automation`) const savedState = require(`../../lib/saved_state`) const plugins = require(`../../lib/plugins`) @@ -255,7 +254,6 @@ This option will not have an effect in Some-other-name. Tests that rely on web s context('#open', () => { beforeEach(function () { sinon.stub(this.project, 'startWebsockets') - this.checkSupportFileStub = sinon.stub(ProjectUtils, 'checkSupportFile').resolves() sinon.stub(this.project, 'scaffold').resolves() sinon.stub(this.project, 'getConfig').returns(this.config) sinon.stub(ServerE2E.prototype, 'open').resolves([]) @@ -295,15 +293,6 @@ This option will not have an effect in Some-other-name. Tests that rely on web s }) }) - it('calls checkSupportFile with server config when scaffolding is finished', function () { - return this.project.open().then(() => { - expect(this.checkSupportFileStub).to.be.calledWith({ - configFile: 'cypress.config.js', - supportFile: false, - }) - }) - }) - it('initializes the plugins', function () { return this.project.open().then(() => { expect(plugins.init).to.be.called diff --git a/packages/server/test/unit/project_utils_spec.ts b/packages/server/test/unit/project_utils_spec.ts index a93c43577554..803f576ae50a 100644 --- a/packages/server/test/unit/project_utils_spec.ts +++ b/packages/server/test/unit/project_utils_spec.ts @@ -1,8 +1,7 @@ import Chai from 'chai' import path from 'path' -import { getSpecUrl, checkSupportFile } from '../../lib/project_utils' +import { getSpecUrl } from '../../lib/project_utils' import Fixtures from '@tooling/system-tests' -import stripAnsi from 'strip-ansi' const todosPath = Fixtures.projectPath('todos') @@ -93,26 +92,4 @@ describe('lib/project_utils', () => { expect(str).to.eq('http://localhost:8888/__/#/specs/runner?file=tests/s%25%26%3Fub/a.spec.js') }) }) - - describe('checkSupportFile', () => { - it('does nothing when {supportFile: false}', async () => { - const ret = await checkSupportFile({ - configFile: 'cypress.config.ts', - supportFile: false, - }) - - expect(ret).to.be.undefined - }) - - it('throws when support file does not exist', async () => { - try { - await checkSupportFile({ - configFile: 'cypress.config.ts', - supportFile: '/this/file/does/not/exist/foo/bar/cypress/support/e2e.js', - }) - } catch (e) { - expect(stripAnsi(e.message)).to.include('Your supportFile is missing or invalid') - } - }) - }) })