Skip to content

Commit

Permalink
chore(server): remove redundant supportFile check (#23543)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
  • Loading branch information
emilyrohrbough and chrisbreiding authored Aug 29, 2022
1 parent b08bc27 commit 2324d70
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
3 changes: 0 additions & 3 deletions packages/server/lib/project-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -225,8 +224,6 @@ export class ProjectBase<TServer extends Server> extends EE {

await this.saveState(stateToSave)

await checkSupportFile(cfg.supportFile)

if (cfg.isTextTerminal) {
return
}
Expand Down
14 changes: 0 additions & 14 deletions packages/server/lib/project_utils.ts
Original file line number Diff line number Diff line change
@@ -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')

Expand Down Expand Up @@ -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
}
2 changes: 2 additions & 0 deletions packages/server/lib/server-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ export class ServerE2E extends ServerBase<SocketE2E> {
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)
})
}
Expand Down
11 changes: 0 additions & 11 deletions packages/server/test/unit/project_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down Expand Up @@ -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([])
Expand Down Expand Up @@ -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
Expand Down
25 changes: 1 addition & 24 deletions packages/server/test/unit/project_utils_spec.ts
Original file line number Diff line number Diff line change
@@ -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')

Expand Down Expand Up @@ -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')
}
})
})
})

4 comments on commit 2324d70

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 2324d70 Aug 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.7.0/linux-x64/develop-2324d703c22cd0017c0e3b41ae098e92fbef22d9/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 2324d70 Aug 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.7.0/linux-arm64/develop-2324d703c22cd0017c0e3b41ae098e92fbef22d9/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 2324d70 Aug 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.7.0/darwin-x64/develop-2324d703c22cd0017c0e3b41ae098e92fbef22d9/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 2324d70 Aug 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.7.0/win32-x64/develop-2324d703c22cd0017c0e3b41ae098e92fbef22d9/cypress.tgz

Please sign in to comment.