Skip to content

Commit 2324d70

Browse files
chore(server): remove redundant supportFile check (#23543)
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
1 parent b08bc27 commit 2324d70

File tree

6 files changed

+4
-53
lines changed

6 files changed

+4
-53
lines changed

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
// Volar is the main extension that powers Vue's language features.
3939
// These are commented out because they slow down node development
4040
// "volar.autoCompleteRefs": false,
41-
"volar.takeOverMode.enabled": true,
41+
"volar.takeOverMode.enabled": "auto",
4242

4343
"editor.tabSize": 2,
4444
}

packages/server/lib/project-base.ts

-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import * as config from './config'
1010
import * as errors from './errors'
1111
import preprocessor from './plugins/preprocessor'
1212
import runEvents from './plugins/run_events'
13-
import { checkSupportFile } from './project_utils'
1413
import Reporter from './reporter'
1514
import * as savedState from './saved_state'
1615
import { ServerCt } from './server-ct'
@@ -225,8 +224,6 @@ export class ProjectBase<TServer extends Server> extends EE {
225224

226225
await this.saveState(stateToSave)
227226

228-
await checkSupportFile(cfg.supportFile)
229-
230227
if (cfg.isTextTerminal) {
231228
return
232229
}

packages/server/lib/project_utils.ts

-14
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import Debug from 'debug'
22
import path from 'path'
3-
import * as errors from './errors'
43
import { escapeFilenameInUrl } from './util/escape_filename'
5-
import { fs } from './util/fs'
64

75
const debug = Debug('cypress:server:project_utils')
86

@@ -35,15 +33,3 @@ export const getSpecUrl = ({
3533

3634
return specUrl
3735
}
38-
39-
export const checkSupportFile = async (supportFile: Cypress.Config['supportFile']) => {
40-
if (supportFile && typeof supportFile === 'string') {
41-
const found = await fs.pathExists(supportFile)
42-
43-
if (!found) {
44-
errors.throwErr('SUPPORT_FILE_NOT_FOUND', supportFile)
45-
}
46-
}
47-
48-
return
49-
}

packages/server/lib/server-e2e.ts

+2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ export class ServerE2E extends ServerBase<SocketE2E> {
118118
return ensureUrl.isListening(baseUrl)
119119
.return(null)
120120
.catch((err) => {
121+
debug('ensuring baseUrl (%s) errored: %o', baseUrl, err)
122+
121123
return errors.get('CANNOT_CONNECT_BASE_URL_WARNING', baseUrl)
122124
})
123125
}

packages/server/test/unit/project_spec.js

-11
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const config = require(`../../lib/config`)
1010
const scaffold = require(`../../lib/scaffold`)
1111
const { ServerE2E } = require(`../../lib/server-e2e`)
1212
const { ProjectBase } = require(`../../lib/project-base`)
13-
const ProjectUtils = require(`../../lib/project_utils`)
1413
const { Automation } = require(`../../lib/automation`)
1514
const savedState = require(`../../lib/saved_state`)
1615
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
255254
context('#open', () => {
256255
beforeEach(function () {
257256
sinon.stub(this.project, 'startWebsockets')
258-
this.checkSupportFileStub = sinon.stub(ProjectUtils, 'checkSupportFile').resolves()
259257
sinon.stub(this.project, 'scaffold').resolves()
260258
sinon.stub(this.project, 'getConfig').returns(this.config)
261259
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
295293
})
296294
})
297295

298-
it('calls checkSupportFile with server config when scaffolding is finished', function () {
299-
return this.project.open().then(() => {
300-
expect(this.checkSupportFileStub).to.be.calledWith({
301-
configFile: 'cypress.config.js',
302-
supportFile: false,
303-
})
304-
})
305-
})
306-
307296
it('initializes the plugins', function () {
308297
return this.project.open().then(() => {
309298
expect(plugins.init).to.be.called

packages/server/test/unit/project_utils_spec.ts

+1-24
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import Chai from 'chai'
22
import path from 'path'
3-
import { getSpecUrl, checkSupportFile } from '../../lib/project_utils'
3+
import { getSpecUrl } from '../../lib/project_utils'
44
import Fixtures from '@tooling/system-tests'
5-
import stripAnsi from 'strip-ansi'
65

76
const todosPath = Fixtures.projectPath('todos')
87

@@ -93,26 +92,4 @@ describe('lib/project_utils', () => {
9392
expect(str).to.eq('http://localhost:8888/__/#/specs/runner?file=tests/s%25%26%3Fub/a.spec.js')
9493
})
9594
})
96-
97-
describe('checkSupportFile', () => {
98-
it('does nothing when {supportFile: false}', async () => {
99-
const ret = await checkSupportFile({
100-
configFile: 'cypress.config.ts',
101-
supportFile: false,
102-
})
103-
104-
expect(ret).to.be.undefined
105-
})
106-
107-
it('throws when support file does not exist', async () => {
108-
try {
109-
await checkSupportFile({
110-
configFile: 'cypress.config.ts',
111-
supportFile: '/this/file/does/not/exist/foo/bar/cypress/support/e2e.js',
112-
})
113-
} catch (e) {
114-
expect(stripAnsi(e.message)).to.include('Your supportFile is missing or invalid')
115-
}
116-
})
117-
})
11895
})

0 commit comments

Comments
 (0)