ModuleLoader.js
function loadSimpleResourceMap(config) {
    return new Promise((resolve, reject) => {

        // Convert Jest config into glob pattern.
        let testPathDirs;
        let testFileExtensions;
        let generatedGlob;

        if (config.testPathDirs.length === 1) {
            testPathDirs = config.testPathDirs[0];
        } else {
            testPathDirs = '{' + config.testPathDirs.join(',') + '}';
        }

        if (config.testFileExtensions.length === 1) {
            testFileExtensions = config.testFileExtensions[0];
        } else {
            testFileExtensions = '{' + config.testFileExtensions.join(',') + '}';
        }

        generatedGlob = testPathDirs + '/' +
            '**/' + config.testDirectoryName + '/**/*.' + testFileExtensions;

        glob(generatedGlob, (err, files) => {
            if (err) {
                reject(err);
            } else {
                let resourceMap;
                resourceMap = {
                    resourcePathMap: {}
                };
                files.forEach(file => {
                    let fullPath = path.resolve(file);
                    resourceMap.resourcePathMap[fullPath] = {
                        path: fullPath
                    };
                });
                resolve(resourceMap);
            }
        });
    });
}
function loadSimpleResourceMap(config) {
    return new Promise((resolve, reject) => {

        // Convert Jest config into glob pattern.
        let testPathDirs;
        let testFileExtensions;
        let generatedGlob;

        if (config.testPathDirs.length === 1) {
            testPathDirs = config.testPathDirs[0];
        } else {
            testPathDirs = '{' + config.testPathDirs.join(',') + '}';
        }

        if (config.testFileExtensions.length === 1) {
            testFileExtensions = config.testFileExtensions[0];
        } else {
            testFileExtensions = '{' + config.testFileExtensions.join(',') + '}';
        }

        generatedGlob = testPathDirs + '/' +
            '**/' + config.testDirectoryName + '/**/*.' + testFileExtensions;

        glob(generatedGlob, (err, files) => {
            if (err) {
                reject(err);
            } else {
                let resourceMap;
                resourceMap = {
                    resourcePathMap: {}
                };
                files.forEach(file => {
                    let fullPath = path.resolve(file);
                    resourceMap.resourcePathMap[fullPath] = {
                        path: fullPath
                    };
                });
                resolve(resourceMap);
            }
        });
    });
}
function loadSimpleResourceMap ( config ) { return new Promise ( ( resolve , reject ) => { // Convert Jest config into glob pattern. let testPathDirs ; let testFileExtensions ; let generatedGlob ; if ( config . testPathDirs . length === 1 ) { testPathDirs = config . testPathDirs [ 0 ] ; } else { testPathDirs = '{' + config . testPathDirs . join ( ',' ) + '}' ; } if ( config . testFileExtensions . length === 1 ) { testFileExtensions = config . testFileExtensions [ 0 ] ; } else { testFileExtensions = '{' + config . testFileExtensions . join ( ',' ) + '}' ; } generatedGlob = testPathDirs + '/' + '**/' + config . testDirectoryName + '/**/*.' + testFileExtensions ; glob ( generatedGlob , ( err , files ) => { if ( err ) { reject ( err ) ; } else { let resourceMap ; resourceMap = { resourcePathMap : { } } ; files . forEach ( file => { let fullPath = path . resolve ( file ) ; resourceMap . resourcePathMap [ fullPath ] = { path : fullPath } ; } ) ; resolve ( resourceMap ) ; } } ) ; } ) ; }
Builds simple resource map containing only the bundled test files.
@param  {Object}  config The Jest config.
@return {Promise}        The 'node-haste'(ish) resource map.
Builds simple resource map containing only the bundled test files .