UNPKG

require-hijack

Version:

Hijack node require calls, with support for hijacking the entire module itself rather than only its properties. Handy for unit testing and mocking require calls in sub modules!

12 lines (11 loc) 289 B
// Seems buffer doesn't expose a constructor directly! Good! var Buffer = require('buffer').Buffer; module.exports = { lol: function () { var shouldbetrue = Buffer.isEncoding('lol'); if (!shouldbetrue) { throw "Should have been true via the stub"; } return shouldbetrue; } }