1 | 'use strict'
|
2 |
|
3 | const back = require('./lib/back')
|
4 | const emitter = require('./lib/global_emitter')
|
5 | const {
|
6 | activate,
|
7 | isActive,
|
8 | isDone,
|
9 | pendingMocks,
|
10 | activeMocks,
|
11 | removeInterceptor,
|
12 | disableNetConnect,
|
13 | enableNetConnect,
|
14 | removeAll,
|
15 | abortPendingRequests,
|
16 | } = require('./lib/intercept')
|
17 | const recorder = require('./lib/recorder')
|
18 | const { Scope, load, loadDefs, define } = require('./lib/scope')
|
19 |
|
20 | module.exports = (basePath, options) => new Scope(basePath, options)
|
21 |
|
22 | Object.assign(module.exports, {
|
23 | activate,
|
24 | isActive,
|
25 | isDone,
|
26 | pendingMocks,
|
27 | activeMocks,
|
28 | removeInterceptor,
|
29 | disableNetConnect,
|
30 | enableNetConnect,
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | cleanAll() {
|
36 | removeAll()
|
37 | return module.exports
|
38 | },
|
39 | abortPendingRequests,
|
40 | load,
|
41 | loadDefs,
|
42 | define,
|
43 | emitter,
|
44 | recorder: {
|
45 | rec: recorder.record,
|
46 | clear: recorder.clear,
|
47 | play: recorder.outputs,
|
48 | },
|
49 | restore: recorder.restore,
|
50 | back,
|
51 | })
|