mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-25 16:39:04 -06:00
* chore: use import type across repo * chore: use import type across repo * chore: use import type across repo * chore: use import type across repo * update exports * update test * update import type * update types * use import type in driver * correctly export function * revert test * remove unrelated code * revert code * improve type imports * override for reporter
22 lines
541 B
TypeScript
22 lines
541 B
TypeScript
import Bluebird from 'bluebird'
|
|
import type http from 'http'
|
|
import * as network from '@packages/network'
|
|
|
|
export interface DestroyableHttpServer extends http.Server {
|
|
/** asynchronously destroys the http server, waiting
|
|
* for all open socket connections to first close
|
|
*/
|
|
destroyAsync (): Bluebird<void>
|
|
}
|
|
|
|
export const allowDestroy = (server) => {
|
|
network.allowDestroy(server)
|
|
|
|
server.destroyAsync = () => {
|
|
return Bluebird.promisify(server.destroy)()
|
|
.catch(() => {}) // dont catch any errors
|
|
}
|
|
|
|
return server
|
|
}
|