{"action":"created","issue":{"url":"https://api.github.com/repos/tschaub/mock-fs/issues/43","repository_url":"https://api.github.com/repos/tschaub/mock-fs","labels_url":"https://api.github.com/repos/tschaub/mock-fs/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/tschaub/mock-fs/issues/43/comments","events_url":"https://api.github.com/repos/tschaub/mock-fs/issues/43/events","html_url":"https://github.com/tschaub/mock-fs/issues/43","id":83586614,"number":43,"title":"Require error with io.js@2.2.x","user":{"login":"blond","id":2225579,"avatar_url":"https://avatars.githubusercontent.com/u/2225579?v=3","gravatar_id":"","url":"https://api.github.com/users/blond","html_url":"https://github.com/blond","followers_url":"https://api.github.com/users/blond/followers","following_url":"https://api.github.com/users/blond/following{/other_user}","gists_url":"https://api.github.com/users/blond/gists{/gist_id}","starred_url":"https://api.github.com/users/blond/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blond/subscriptions","organizations_url":"https://api.github.com/users/blond/orgs","repos_url":"https://api.github.com/users/blond/repos","events_url":"https://api.github.com/users/blond/events{/privacy}","received_events_url":"https://api.github.com/users/blond/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-01T16:21:28Z","updated_at":"2016-02-12T09:12:31Z","closed_at":"2015-11-29T02:24:37Z","body":"In `io.js@2.2.0` were changes with `require` — https://github.com/nodejs/io.js/pull/1801\r\n\r\nFor real file system `require` works well, but with `mock-fs` fail with error.\r\n\r\n**How to reproduce:**\r\n\r\n```js\r\nvar path = require('path'),\r\n    fs = require('fs'),\r\n    mock = require('mock-fs');\r\n\r\nmock({\r\n    'file.js': 'module.exports = 10;'\r\n});\r\n\r\nvar filename = path.resolve('file.js'),\r\n    contents = fs.readFileSync(filename, 'utf-8');\r\n\r\n// File exists\r\nconsole.log(contents); // module.exports = 10;\r\n\r\nvar val = require(filename); // throw error\r\n\r\nconsole.log(val);\r\n```\r\n\r\n**Expected:**\r\n\r\n```\r\nmodule.exports = 10;\r\n10\r\n```\r\n\r\n**Actual:**\r\n\r\n```\r\nmodule.js:334\r\n    throw err;\r\n          ^\r\nError: Cannot find module '/Users/blond/projects/mock-test/file.js'\r\n    at Function.Module._resolveFilename (module.js:332:15)\r\n    at Function.Module._load (module.js:282:25)\r\n    at Module.require (module.js:361:17)\r\n    at require (module.js:380:17)\r\n    at Object.<anonymous> (/Users/blond/projects/mock-test/index.js:14:11)\r\n    at Module._compile (module.js:426:26)\r\n    at Object.Module._extensions..js (module.js:444:10)\r\n    at Module.load (module.js:351:32)\r\n    at Function.Module._load (module.js:306:12)\r\n    at Function.Module.runMain (module.js:467:10)\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/tschaub/mock-fs/issues/comments/183244713","html_url":"https://github.com/tschaub/mock-fs/issues/43#issuecomment-183244713","issue_url":"https://api.github.com/repos/tschaub/mock-fs/issues/43","id":183244713,"user":{"login":"rndD","id":850302,"avatar_url":"https://avatars.githubusercontent.com/u/850302?v=3","gravatar_id":"","url":"https://api.github.com/users/rndD","html_url":"https://github.com/rndD","followers_url":"https://api.github.com/users/rndD/followers","following_url":"https://api.github.com/users/rndD/following{/other_user}","gists_url":"https://api.github.com/users/rndD/gists{/gist_id}","starred_url":"https://api.github.com/users/rndD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rndD/subscriptions","organizations_url":"https://api.github.com/users/rndD/orgs","repos_url":"https://api.github.com/users/rndD/repos","events_url":"https://api.github.com/users/rndD/events{/privacy}","received_events_url":"https://api.github.com/users/rndD/received_events","type":"User","site_admin":false},"created_at":"2016-02-12T09:12:31Z","updated_at":"2016-02-12T09:12:31Z","body":":+1: reproduced this error in `Node 4.x`."}}