Files
cypress/packages/server/lib/plugins/dev-server.js
Ryan Manuel f2bce02f5d fix: issue with compilation failures in component testing (#21599)
* fix: issue with compilation failures in component testing

* add tests

* fix tests

* Refactor tests

* Fix tests

* Refactor tests

* Fix tests

* Fix paths for dependencies in system tests

* Fix tests

* Fix tests

* Fix tests

* Fix tests

* test fix for initial esbuild failures

* Fix tests

* Add back ESLintPlugin

* Add comments around our special esbuild handling logic in vite

* Code cleanup and additional test scenario

* Add config syntax error tests

* Improve tests

* Update comment and remove unused variable

* Remove unneeded hook in webpack dev server

* Disable dev server overlay

* Revert "Remove unneeded hook in webpack dev server"

This reverts commit 98b2f269ae.

* PR comments

* Accidental removal

* Fix dedent

* PR comments
2022-05-25 18:02:05 -05:00

43 lines
1003 B
JavaScript

require('../cwd')
const EE = require('events')
const debug = require('debug')('cypress:ct:dev-server')
const plugins = require('../plugins')
const errors = require('../errors')
const baseEmitter = new EE()
plugins.registerHandler((ipc) => {
baseEmitter.on('dev-server:specs:changed', (specs) => {
ipc.send('dev-server:specs:changed', specs)
})
ipc.on('dev-server:compile:success', ({ specFile } = {}) => {
baseEmitter.emit('dev-server:compile:success', { specFile })
})
})
// for simpler stubbing from unit tests
const API = {
emitter: baseEmitter,
start ({ specs, config }) {
if (!plugins.has('dev-server:start')) {
throw errors.get('CONFIG_FILE_INVALID_DEV_START_EVENT', config.pluginsFile)
}
return plugins.execute('dev-server:start', { specs, config })
},
updateSpecs (specs) {
baseEmitter.emit('dev-server:specs:changed', specs)
},
close () {
debug('close dev-server')
baseEmitter.removeAllListeners()
},
}
module.exports = API