()
| 890 | } |
| 891 | |
| 892 | function setupSharedModuleState() { |
| 893 | if (sharedModuleState === undefined) { |
| 894 | const { mock } = require('test'); |
| 895 | const mockExports = new SafeMap(); |
| 896 | const { registerHooks } = require('internal/modules/customization_hooks'); |
| 897 | const moduleLoader = esmLoader.getOrInitializeCascadedLoader(); |
| 898 | |
| 899 | registerHooks(mockHooks); |
| 900 | |
| 901 | sharedModuleState = { |
| 902 | __proto__: null, |
| 903 | mockExports, |
| 904 | mockMap: new SafeMap(), |
| 905 | moduleLoader, |
| 906 | }; |
| 907 | mock._mockExports = mockExports; |
| 908 | Module._load = FunctionPrototypeBind(cjsMockModuleLoad, sharedModuleState); |
| 909 | } |
| 910 | |
| 911 | return sharedModuleState; |
| 912 | } |
| 913 | |
| 914 | function cjsMockModuleLoad(request, parent, isMain) { |
| 915 | // Imported mocked URLs may re-enter Module._load with the mock query attached. |
no test coverage detected
searching dependent graphs…