UNPKG

@revoloo/cypress6

Version:

Cypress.io end to end testing tool

24 lines (20 loc) 529 B
import { noop } from 'lodash' import { NetStubbingState } from './types' export function state (): NetStubbingState { return { requests: {}, routes: [], reset () { // clean up requests that are still pending for (const requestId in this.requests) { const { res } = this.requests[requestId] res.removeAllListeners('finish') res.removeAllListeners('error') res.on('error', noop) res.destroy() } this.requests = {} this.routes = [] }, } }