All files / switchman-core/src/config index.js

82.35% Statements 14/17
44.44% Branches 4/9
50% Functions 2/4
92.85% Lines 13/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 342x 2x   2x   2x   2x     1x       2x 2x   2x   2x 2x 2x                     2x  
const path = require('path');
const fs = require('fs');
 
const loadFile = require('../file-tool/read-file');
 
const mappingFileName = 'mappinginfo.json';
 
const core = {
    //添加环境
    addConfig(options = {}) {
        options.location;
 
    },
    get(projectConfigPath, configAlias) {
        Iif (!projectConfigPath) throw new Error('projectConfigPath is null or undefined');
        Iif (!configAlias) throw new Error('configAlias is null or undefined');
 
        const configPath = path.join(projectConfigPath, configAlias, mappingFileName);
 
        Eif (fs.existsSync(configPath)) {
            const configDetail = loadFile(configPath).toString();
            Eif (configDetail) return JSON.parse(configDetail);
        }
 
        return null;
    },
    getAll(projectConfigPath) {
    },
    remove() {
    }
};
 
module.exports = core;