How to use the jest-cli/src/lib/utils.runContentWithLocalBindings 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
_execModule(moduleObj) {

        let modulePath = moduleObj.__filename;
        let moduleLocalBindings = {
            // `module`, `exports`, `require`, `__dirname` and `__filename` aren't
            // necessary here as we're only executing a Webpack bundle.
            global: this._environment.global,
            jest: this.getJestRuntime()
        };

        utils.runContentWithLocalBindings(
            this._environment,
            fs.readFileSync(modulePath, 'utf8'),
            modulePath,
            moduleLocalBindings
        );
    }