How to use the jest-cli/src/lib/moduleMocker.generateFromMetadata function in jest-cli

To help you get started, we’ve selected a few jest-cli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 60frames / jestpack / ModuleLoader.js View on Github external
module = this._webpackRequireModule(moduleId);

            // Restore the "real" module/mock registries
            this._mockRegistry = origMockRegistry;
            this._environment.global.installedModules = origModuleRegistry;

            this._mockMetaDataCache[moduleId] = moduleMocker.getMetadata(module);
        }

        // Check whether a manual mock was registered as a result of running the module
        // via `jest._registerManualMock` / the `ManualMockLoader`.
        if (!ignoreManualMock && this._manualMockMap.hasOwnProperty(moduleId)) {
            return this._webpackRequireModule(this._manualMockMap[moduleId]);
        }

        return moduleMocker.generateFromMetadata(this._mockMetaDataCache[moduleId]);
    }