Permalink
Cannot retrieve contributors at this time
53 lines (49 sloc)
1.24 KB
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/nock/index.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const back = require('./lib/back') | |
const emitter = require('./lib/global_emitter') | |
const { | |
activate, | |
isActive, | |
isDone, | |
isOn, | |
pendingMocks, | |
activeMocks, | |
removeInterceptor, | |
disableNetConnect, | |
enableNetConnect, | |
removeAll, | |
abortPendingRequests, | |
} = require('./lib/intercept') | |
const recorder = require('./lib/recorder') | |
const { Scope, load, loadDefs, define } = require('./lib/scope') | |
module.exports = (basePath, options) => new Scope(basePath, options) | |
Object.assign(module.exports, { | |
activate, | |
isActive, | |
isDone, | |
pendingMocks, | |
activeMocks, | |
removeInterceptor, | |
disableNetConnect, | |
enableNetConnect, | |
cleanAll: removeAll, | |
abortPendingRequests, | |
load, | |
loadDefs, | |
define, | |
emitter, | |
recorder: { | |
rec: recorder.record, | |
clear: recorder.clear, | |
play: recorder.outputs, | |
}, | |
restore: recorder.restore, | |
back, | |
}) | |
// We always activate Nock on import, overriding the globals. | |
// Setting the Back mode "activates" Nock by overriding the global entries in the `http/s` modules. | |
// If Nock Back is configured, we need to honor that setting for backward compatibility, | |
// otherwise we rely on Nock Back's default initializing side effect. | |
if (isOn()) { | |
back.setMode(process.env.NOCK_BACK_MODE || 'dryrun') | |
} |