{"_id":"require-without-cache","_rev":"23-2d6fac6e971046c659347dcde3436495","name":"require-without-cache","description":"require module without cache","dist-tags":{"latest":"0.0.6"},"versions":{"0.0.0":{"name":"require-without-cache","version":"0.0.0","description":"require module without cache","main":"index.js","scripts":{"test":""},"repository":{"type":"git","url":"https://github.com/nazomikan/require-without-cache"},"keywords":["require","cache","stub"],"author":{"name":"nazomikan"},"license":"MIT","bugs":{"url":"https://github.com/nazomikan/require-without-cache/issues"},"homepage":"https://github.com/nazomikan/require-without-cache","_id":"require-without-cache@0.0.0","dist":{"shasum":"6db90571519457259c0a6175f2524e8d892fc2b8","tarball":"https://registry.npmjs.org/require-without-cache/-/require-without-cache-0.0.0.tgz","integrity":"sha512-XcXP7NHGwEsHe0uwPGtZNTj5mSK3X/BDfT3RopfFkZRUHjHH5JuRwrUy7GA7ooxZsZGbuoOSTUEmhRLvu7WE8g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHAl2Vcxy0vnEUf9/4LvGA9JdUD2GmFxg3z4d/p2m+yvAiBX5u+zSaUxcoPcmb3DdWHPBFlWMisxpZjY+1th1g4d7A=="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"nazomikan","email":"nazomikan@gmail.com"},"maintainers":[{"name":"nazomikan","email":"nazomikan@gmail.com"}]},"0.0.1":{"name":"require-without-cache","version":"0.0.1","description":"require module without cache","main":"index.js","scripts":{"test":""},"repository":{"type":"git","url":"https://github.com/nazomikan/require-without-cache"},"keywords":["require","cache","stub"],"author":{"name":"nazomikan"},"license":"MIT","bugs":{"url":"https://github.com/nazomikan/require-without-cache/issues"},"homepage":"https://github.com/nazomikan/require-without-cache","_id":"require-without-cache@0.0.1","dist":{"shasum":"13ce9e07262871909027831dec3560950fbc3ed1","tarball":"https://registry.npmjs.org/require-without-cache/-/require-without-cache-0.0.1.tgz","integrity":"sha512-b7YK1TqLdwhrVgnlAfSoYDABhdbaUlyTYt3oY76Ir5ZxQCoPUjSa3kBMQjOu7w+1Z1YFY5zaj9FWjBvlkGM/NA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCRQK3fw+5oj+aSSurT3MF/cIDuGcy9CykeUZcghiCF1gIgfFl93bG2VQQRio7nVrARW30b1c+J370drZ46F0VAEwo="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"nazomikan","email":"nazomikan@gmail.com"},"maintainers":[{"name":"nazomikan","email":"nazomikan@gmail.com"}]},"0.0.2":{"name":"require-without-cache","version":"0.0.2","description":"require module without cache","main":"index.js","scripts":{"test":"mocha --reporter spec test/target-test.js"},"repository":{"type":"git","url":"https://github.com/nazomikan/require-without-cache"},"keywords":["require","cache","stub"],"author":{"name":"nazomikan"},"license":"MIT","bugs":{"url":"https://github.com/nazomikan/require-without-cache/issues"},"homepage":"https://github.com/nazomikan/require-without-cache","devDependencies":{"mocha":"^1.19.0","sinon":"^1.10.0"},"_id":"require-without-cache@0.0.2","dist":{"shasum":"336f11ed1254f9c6ca0ca07782b886de1269cf51","tarball":"https://registry.npmjs.org/require-without-cache/-/require-without-cache-0.0.2.tgz","integrity":"sha512-gEor1est4oaKsIjSWC5b28G2ot8E7+ssx1vPPuvu8bsu3/0AXyqjMRxAJ+oj6fHz24ylKgG+0ikXJKeaUcYHrw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHmsru/ht0dMQybyLC7rG25ECNN/q4aDnP6yjTLS2lexAiEAu0yZqEuWLiAy0zBbSj4PE01eFOentkF1ZrDZUJdKSfo="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"nazomikan","email":"nazomikan@gmail.com"},"maintainers":[{"name":"nazomikan","email":"nazomikan@gmail.com"}]},"0.0.3":{"name":"require-without-cache","version":"0.0.3","description":"require module without cache","main":"index.js","scripts":{"test":"mocha --reporter spec test/target-test.js"},"repository":{"type":"git","url":"https://github.com/nazomikan/require-without-cache"},"keywords":["require","cache","stub"],"author":{"name":"nazomikan"},"license":"MIT","bugs":{"url":"https://github.com/nazomikan/require-without-cache/issues"},"homepage":"https://github.com/nazomikan/require-without-cache","devDependencies":{"mocha":"^1.19.0","sinon":"^1.10.0"},"_id":"require-without-cache@0.0.3","dist":{"shasum":"b4802c6d30218894ab324a967033e217a626b123","tarball":"https://registry.npmjs.org/require-without-cache/-/require-without-cache-0.0.3.tgz","integrity":"sha512-UHWJMnLgd1ngDNQaeMefnsguoRdwTONF7FRF2bHQCs40uN71foWmSZozr5rF6zTAfaLRMeF9hyZMpqN55a7oYA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG1KMpTp/+dOIsHJlz0KKI/oiMl/uTFRcdfgV3Qf49CqAiEA70LHPvNS4/jSx4/XQKoulwvYQukuLgGF5Zg5pOK/jho="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"nazomikan","email":"nazomikan@gmail.com"},"maintainers":[{"name":"nazomikan","email":"nazomikan@gmail.com"}]},"0.0.4":{"name":"require-without-cache","version":"0.0.4","description":"require module without cache","main":"index.js","scripts":{"test":"mocha --reporter spec test/target-test.js"},"repository":{"type":"git","url":"https://github.com/nazomikan/require-without-cache"},"keywords":["require","cache","stub"],"author":{"name":"nazomikan"},"license":"MIT","bugs":{"url":"https://github.com/nazomikan/require-without-cache/issues"},"homepage":"https://github.com/nazomikan/require-without-cache","devDependencies":{"mocha":"^1.19.0","sinon":"^1.10.0"},"_id":"require-without-cache@0.0.4","dist":{"shasum":"84d01cc45091a3fabf8547ef96ad7fb859f8943e","tarball":"https://registry.npmjs.org/require-without-cache/-/require-without-cache-0.0.4.tgz","integrity":"sha512-+KXnitHMt8I4/YWa4PlTruMS6jifzH/9OWwQ1AmutDyKtgchI1+4tn5H7kBMoMo7c1tuY7/2NWaIRTNyRcHtbA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGqGNTFxZojzJZutX8f0E4VnPx58QyQaP7iNCUfu9pYxAiBghdQKp8sH8oAASa7lQPCw+ZBqYqZ9HWn9WmQz9TQgqw=="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"nazomikan","email":"nazomikan@gmail.com"},"maintainers":[{"name":"nazomikan","email":"nazomikan@gmail.com"}]},"0.0.5":{"name":"require-without-cache","version":"0.0.5","description":"require module without cache","main":"index.js","scripts":{"test":"mocha --reporter spec test/target-test.js"},"repository":{"type":"git","url":"https://github.com/nazomikan/require-without-cache"},"keywords":["require","cache","stub"],"author":{"name":"nazomikan"},"license":"MIT","bugs":{"url":"https://github.com/nazomikan/require-without-cache/issues"},"homepage":"https://github.com/nazomikan/require-without-cache","devDependencies":{"mocha":"^1.19.0","sinon":"^1.10.0"},"_id":"require-without-cache@0.0.5","dist":{"shasum":"dfa45b162fd649da5fb9aa3fa1a2f5504a9cc967","tarball":"https://registry.npmjs.org/require-without-cache/-/require-without-cache-0.0.5.tgz","integrity":"sha512-NpxMtH9kEv6zSk2duW93qtsByckXNSjd8uncMHRm8sBXv+x4klqCbEf1c8s+QJv5D0kxcqknnB47vF3x37hSsQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFWR/c6NDLjUHs/uo+N2U6odImg/tLK6eLY0l3HRsDAuAiBfX1FBFjvU/+A87cf26FT+7K7MIL+R6no4+MxRxHzfCQ=="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"nazomikan","email":"nazomikan@gmail.com"},"maintainers":[{"name":"nazomikan","email":"nazomikan@gmail.com"}]},"0.0.6":{"name":"require-without-cache","version":"0.0.6","description":"require module without cache","main":"index.js","scripts":{"test":"mocha --reporter spec test/target-test.js"},"repository":{"type":"git","url":"https://github.com/nazomikan/require-without-cache"},"keywords":["require","cache","stub"],"author":{"name":"nazomikan"},"license":"MIT","bugs":{"url":"https://github.com/nazomikan/require-without-cache/issues"},"homepage":"https://github.com/nazomikan/require-without-cache","devDependencies":{"mocha":"^1.19.0","sinon":"^1.10.0"},"_id":"require-without-cache@0.0.6","dist":{"shasum":"b76566d78f8c5efa58b978266b9cfbeb96e037e2","tarball":"https://registry.npmjs.org/require-without-cache/-/require-without-cache-0.0.6.tgz","integrity":"sha512-L5vEtdrAP1rbP0b+wTz/bO5KcDVsJuYtUO29njyOWnGVZBjJAcVf0p2i43KyRZHcK06rmnipifsGSP4YjhIDYg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEGh0Ew2tBzawrCzfp8vKDV1a0HjsEWq4/LLWPVYT8CqAiEA8Xj91/tS0E9iZpD4jRVZwUtTOhgWEFK46lMLaKEQsJY="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"nazomikan","email":"nazomikan@gmail.com"},"maintainers":[{"name":"nazomikan","email":"nazomikan@gmail.com"}]}},"readme":"require-without-cache\n===================\n\nrequire without cache\n\n## How to use\n\n```sh\nnpm install require-without-cache\n```\n\n```javascript\nvar requireWithoutCache = require('require-without-cache')\n  , hoge = requireWithoutCache('./path/to/module', require)\n  ;\n\n// ...\n```\n\n## Using case\n\nIt is intended to be used in the spec file.\n\ntarget file\n\n```javascript\nvar model = require('path/to/model').create();\n\nexports.handle = function (cb) {\n  model.get('foo/model', function (err, res) {\n    cb(err, res);\n  });\n};\n```\n\nspec file\n\n```javascript\nvar requireWithoutCache = require('require-without-cache')\n  , sinon = require('sinon')\n  , assert = require('assert')\n  ;\n\ndescribe('#handle', function () {\n  it('should be error', function (done) {\n    var model = require('path/to/model')\n      , sinon = require('sinon')\n      , target\n      ;\n\n    sinon.stub(model, 'create', function () {\n      return {get: function (name, cb) { return cb('an_error'); }};\n    });\n\n    target = requireWithoutCache('./path/to/module', require); // [1]\n    target.handle(function (err, data) {\n      assert.ok(err);\n      model.create.restore();\n      done();\n    });\n  });\n});\n```\n\nif [1] use normal `require`, `target` may be cache.\n\nIn that case, `model` does not replace the stub.\n\nby require.cache\n\nHowever, you may want to carry out the test without a problem if you use the `require-without-cache`.\n\n\n## API\n\n* requireWithoutCache(path, require)\n  * path {String} filePath\n  * require {Function} require method\n\n## If using custom require\n\nPlease define an API for use by the following.\n\n```javascript\nvar path = require('path');\n\nfunction requireFromAppRoot(relativePath) {\n  var absolutePath\n    ;\n\n  // sample require system\n  absolutePath = requireFromAppRoot.resolve(relativePath);\n  return require(absolutePath);\n};\n\nrequireFromAppRoot.resolve = function (relativePath) {\n  var absolutePath = path.resolve(app_route, relativePath);\n  return require.resolve(absolutePath);\n}\n\nObject.defineProperty(requireFromAppRoot, 'cache', {\n  get: function () {\n    return require.cache;\n  }\n});\n```\n\n`require-without-cache` need `require.resolve` and `require.cache`\n","maintainers":[{"name":"nazomikan","email":"nazomikan@gmail.com"}],"time":{"modified":"2022-06-26T11:41:15.470Z","created":"2014-05-20T09:43:57.219Z","0.0.0":"2014-05-20T09:43:57.219Z","0.0.1":"2014-05-20T10:41:57.588Z","0.0.2":"2014-05-20T11:20:23.782Z","0.0.3":"2014-05-20T11:33:31.212Z","0.0.4":"2014-05-20T14:59:26.166Z","0.0.5":"2014-05-20T15:20:17.132Z","0.0.6":"2014-05-23T20:33:17.883Z"},"homepage":"https://github.com/nazomikan/require-without-cache","keywords":["require","cache","stub"],"repository":{"type":"git","url":"https://github.com/nazomikan/require-without-cache"},"author":{"name":"nazomikan"},"bugs":{"url":"https://github.com/nazomikan/require-without-cache/issues"},"license":"MIT","readmeFilename":"README.md","users":{"khai96_":true}}