UNPKG

rewiremock

Version:

Advanced dependency mocking device.

24 lines (21 loc) 571 B
var FS_MODULE_NAME = 'fs'; var fs = void 0; if (typeof __webpack_modules__ === 'undefined') { try { fs = require(FS_MODULE_NAME); } catch (e) { //nop } } export function fileExists(path) { if (typeof __webpack_modules__ !== 'undefined') { var npath = path[0] === '.' ? path : '.' + path; return __webpack_modules__[npath] && npath; } try { return !fs.accessSync(path, fs.F_OK) && path; } catch (e) { return false; } } export var ensureRequire = typeof __webpack_require__ !== 'undefined' ? __webpack_require__ : eval('require');