All files / lib load-module.js

62.5% Statements 5/8
0% Branches 0/4
100% Functions 1/1
62.5% Lines 5/8

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    1x 5x 5x 5x             5x    
"use strict"
 
module.exports = function(name, resolve, reject) {
    let result = undefined
    try {
        result = require(name)
    } catch (e) {
        if (e instanceof Error && e.code === "MODULE_NOT_FOUND") {
            return reject()
        }
        throw e
    }
    return resolve(result)
}