All files get-config.js

90% Statements 9/10
50% Branches 1/2
100% Functions 5/5
90% Lines 9/10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 221x   1x     1x 1x 1x 1x     1x         1x       1x  
const CMD_CONFIG = 'gcloud config config-helper --format=json';
 
module.exports = function({
    exec,
}) {
    return function getConfig() {
        return new Promise((resolve, reject) => {
            exec(CMD_CONFIG, (error, stdout, stderr) => {
                Iif (error) {
                    reject(error);
                } else {
                    resolve(stdout.trim());
                }
            });
        })
        .then(JSON.parse)
        .then(({credential: {access_token: token}, configuration: {properties: {core: {project: projectId}}}}) => ({projectId, token}));
    };
}
 
module.exports.CMD_CONFIG = CMD_CONFIG;