{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/18586","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/18586/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/18586/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/18586/events","html_url":"https://github.com/nodejs/node/issues/18586","id":294530083,"number":18586,"title":"require() call sometimes does not load","user":{"login":"unional","id":3254987,"avatar_url":"https://avatars0.githubusercontent.com/u/3254987?v=4","gravatar_id":"","url":"https://api.github.com/users/unional","html_url":"https://github.com/unional","followers_url":"https://api.github.com/users/unional/followers","following_url":"https://api.github.com/users/unional/following{/other_user}","gists_url":"https://api.github.com/users/unional/gists{/gist_id}","starred_url":"https://api.github.com/users/unional/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unional/subscriptions","organizations_url":"https://api.github.com/users/unional/orgs","repos_url":"https://api.github.com/users/unional/repos","events_url":"https://api.github.com/users/unional/events{/privacy}","received_events_url":"https://api.github.com/users/unional/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-05T20:23:34Z","updated_at":"2018-02-05T20:34:26Z","closed_at":null,"author_association":"NONE","body":"node@9.4.0\r\nosx High Sierra 10.13.3\r\n\r\nEncounter this issue from:\r\nhttps://github.com/Microsoft/TypeScript/issues/21612#issuecomment-363207983\r\n\r\nFrom these lines: https://github.com/unional/komondor/blob/node-9.4.0-require/src/environment.ts#L58-L60\r\n\r\nwhen I run `npm run watch` in that repro, I will get:\r\n\r\n```sh\r\n> komondor@0.0.0-development lint /Users/hwong/code/unional/komondor\r\n> tslint -p tsconfig.json 'src/**/*.ts'\r\ndirect get ./spec {}\r\n/Users/hwong/code/unional/komondor/dist-es5/environment.js:114\r\nconsole.log('spec.simulate', spec_1.spec.simulate);\r\n                                         ^\r\n\r\nTypeError: Cannot read property 'simulate' of undefined\r\n    at Object.<anonymous> (/Users/hwong/code/unional/komondor/src/environment.ts:60:35)\r\n    at Module._compile (module.js:660:30)\r\n    at Module._extensions..js (module.js:671:10)\r\n    at extensions.(anonymous function) (/Users/hwong/code/unional/komondor/node_modules/require-precompiled/index.js:16:3)\r\n    at Object.require.extensions.(anonymous function) [as .js] (/Users/hwong/code/unional/komondor/node_modules/ava/lib/process-adapter.js:100:4)\r\n    at Module.load (module.js:573:32)\r\n    at tryModuleLoad (module.js:513:12)\r\n    at Function.Module._load (module.js:505:3)\r\n    at Module.require (module.js:604:17)\r\n    at require (internal/module.js:11:18)\r\n    at Object.<anonymous> (/Users/hwong/code/unional/komondor/src/index.ts:2:1)\r\n    at Module._compile (module.js:660:30)\r\n    at Module._extensions..js (module.js:671:10)\r\n    at extensions.(anonymous function) (/Users/hwong/code/unional/komondor/node_modules/require-precompiled/index.js:16:3)\r\n    at Object.require.extensions.(anonymous function) [as .js] (/Users/hwong/code/unional/komondor/node_modules/ava/lib/process-adapter.js:100:4)\r\n    at Module.load (module.js:573:32)\r\ndirect get ./spec { makeErrorSerializable: [Function: makeErrorSerializable],\r\n  spec: { [Function: spec] save: [Function: save], simulate: [Function: simulate] } }\r\nspec.simulate function (id, subject) {\r\n        return __awaiter(this, void 0, void 0, function () {\r\n            var mode;\r\n            return __generator(this, function (_a) {\r\n                mode = getMode(id, 'simulate');\r\n                return [2 /*return*/, createSpec(id, subject, mode)];\r\n            });\r\n        });\r\n    }\r\n komondor  Cannot load saved record for spec 'class/notExist'.\r\n komondor  { errno: -2, code: 'ENOENT', syscall: 'open', path: '/Users/hwong/code/unional/komondor/__komondor__/specs/class/no... }\r\n komondor  No record for 'constructor'. Spying instead\r\n komondor  The current action 'constructor' does not match with saved record of class/extendToSpy. Spying instead.\r\ndirect get ./spec { makeErrorSerializable: [Function: makeErrorSerializable],\r\n  spec: { [Function: spec] save: [Function: save], simulate: [Function: simulate] } }\r\nspec.simulate function (id, subject) {\r\n        return __awaiter(this, void 0, void 0, function () {\r\n            var mode;\r\n            return __generator(this, function (_a) {\r\n                mode = getMode(id, 'simulate');\r\n                return [2 /*return*/, createSpec(id, subject, mode)];\r\n            });\r\n        });\r\n    }\r\ndirect get ./spec { makeErrorSerializable: [Function: makeErrorSerializable],\r\n  spec: { [Function: spec] save: [Function: save], simulate: [Function: simulate] } }\r\nspec.simulate function (id, subject) {\r\n        return __awaiter(this, void 0, void 0, function () {\r\n            var mode;\r\n            return __generator(this, function (_a) {\r\n                mode = getMode(id, 'simulate');\r\n                return [2 /*return*/, createSpec(id, subject, mode)];\r\n            });\r\n        });\r\n    }\r\ndirect get ./spec {}\r\n/Users/hwong/code/unional/komondor/dist-es5/environment.js:114\r\nconsole.log('spec.simulate', spec_1.spec.simulate);\r\n                                         ^\r\n\r\nTypeError: Cannot read property 'simulate' of undefined\r\n    at Object.<anonymous> (/Users/hwong/code/unional/komondor/src/environment.ts:60:35)\r\n    at Module._compile (module.js:660:30)\r\n    at Module._extensions..js (module.js:671:10)\r\n    at extensions.(anonymous function) (/Users/hwong/code/unional/komondor/node_modules/require-precompiled/index.js:16:3)\r\n    at Object.require.extensions.(anonymous function) [as .js] (/Users/hwong/code/unional/komondor/node_modules/ava/lib/process-adapter.js:100:4)\r\n    at Module.load (module.js:573:32)\r\n    at tryModuleLoad (module.js:513:12)\r\n    at Function.Module._load (module.js:505:3)\r\n    at Module.require (module.js:604:17)\r\n    at require (internal/module.js:11:18)\r\n    at Object.<anonymous> (/Users/hwong/code/unional/komondor/src/index.ts:2:1)\r\n    at Module._compile (module.js:660:30)\r\n    at Module._extensions..js (module.js:671:10)\r\n    at extensions.(anonymous function) (/Users/hwong/code/unional/komondor/node_modules/require-precompiled/index.js:16:3)\r\n    at Object.require.extensions.(anonymous function) [as .js] (/Users/hwong/code/unional/komondor/node_modules/ava/lib/process-adapter.js:100:4)\r\n    at Module.load (module.js:573:32)\r\ndirect get ./spec {}\r\n/Users/hwong/code/unional/komondor/dist-es5/environment.js:114\r\nconsole.log('spec.simulate', spec_1.spec.simulate);\r\n                                         ^\r\n\r\nTypeError: Cannot read property 'simulate' of undefined\r\n    at Object.<anonymous> (/Users/hwong/code/unional/komondor/src/environment.ts:60:35)\r\n    at Module._compile (module.js:660:30)\r\n    at Module._extensions..js (module.js:671:10)\r\n    at extensions.(anonymous function) (/Users/hwong/code/unional/komondor/node_modules/require-precompiled/index.js:16:3)\r\n    at Object.require.extensions.(anonymous function) [as .js] (/Users/hwong/code/unional/komondor/node_modules/ava/lib/process-adapter.js:100:4)\r\n    at Module.load (module.js:573:32)\r\n    at tryModuleLoad (module.js:513:12)\r\n    at Function.Module._load (module.js:505:3)\r\n    at Module.require (module.js:604:17)\r\n    at require (internal/module.js:11:18)\r\n    at Object.<anonymous> (/Users/hwong/code/unional/komondor/src/index.ts:2:1)\r\n    at Module._compile (module.js:660:30)\r\n    at Module._extensions..js (module.js:671:10)\r\n    at extensions.(anonymous function) (/Users/hwong/code/unional/komondor/node_modules/require-precompiled/index.js:16:3)\r\n    at Object.require.extensions.(anonymous function) [as .js] (/Users/hwong/code/unional/komondor/node_modules/ava/lib/process-adapter.js:100:4)\r\n    at Module.load (module.js:573:32)\r\ndirect get ./spec {}\r\n/Users/hwong/code/unional/komondor/dist-es5/environment.js:114\r\nconsole.log('spec.simulate', spec_1.spec.simulate);\r\n                                         ^\r\n\r\nTypeError: Cannot read property 'simulate' of undefined\r\n    at Object.<anonymous> (/Users/hwong/code/unional/komondor/src/environment.ts:60:35)\r\n    at Module._compile (module.js:660:30)\r\n    at Module._extensions..js (module.js:671:10)\r\n    at extensions.(anonymous function) (/Users/hwong/code/unional/komondor/node_modules/require-precompiled/index.js:16:3)\r\n    at Object.require.extensions.(anonymous function) [as .js] (/Users/hwong/code/unional/komondor/node_modules/ava/lib/process-adapter.js:100:4)\r\n    at Module.load (module.js:573:32)\r\n    at tryModuleLoad (module.js:513:12)\r\n    at Function.Module._load (module.js:505:3)\r\n    at Module.require (module.js:604:17)\r\n    at require (internal/module.js:11:18)\r\n    at Object.<anonymous> (/Users/hwong/code/unional/komondor/src/index.ts:2:1)\r\n    at Module._compile (module.js:660:30)\r\n    at Module._extensions..js (module.js:671:10)\r\n    at extensions.(anonymous function) (/Users/hwong/code/unional/komondor/node_modules/require-precompiled/index.js:16:3)\r\n    at Object.require.extensions.(anonymous function) [as .js] (/Users/hwong/code/unional/komondor/node_modules/ava/lib/process-adapter.js:100:4)\r\n    at Module.load (module.js:573:32)\r\ndirect get ./spec { makeErrorSerializable: [Function: makeErrorSerializable],\r\n  spec: { [Function: spec] save: [Function: save], simulate: [Function: simulate] } }\r\nspec.simulate function (id, subject) {\r\n        return __awaiter(this, void 0, void 0, function () {\r\n            var mode;\r\n            return __generator(this, function (_a) {\r\n                mode = getMode(id, 'simulate');\r\n                return [2 /*return*/, createSpec(id, subject, mode)];\r\n            });\r\n        });\r\n    }\r\n komondor  Cannot load saved record for spec 'ws/echo/notExist'.\r\n komondor  { errno: -2, code: 'ENOENT', syscall: 'open', path: '/Users/hwong/code/unional/komondor/__komondor__/specs/ws/echo/... }\r\n komondor  The current action 'constructor' does not match with saved record of ws/echo/notExist. Spying instead.\r\ndirect get ./spec { makeErrorSerializable: [Function: makeErrorSerializable],\r\n  spec: { [Function: spec] save: [Function: save], simulate: [Function: simulate] } }\r\nspec.simulate function (id, subject) {\r\n        return __awaiter(this, void 0, void 0, function () {\r\n            var mode;\r\n            return __generator(this, function (_a) {\r\n                mode = getMode(id, 'simulate');\r\n                return [2 /*return*/, createSpec(id, subject, mode)];\r\n            });\r\n        });\r\n    }\r\n komondor  Cannot load saved record for spec 'specStore/notExist'.\r\n komondor  { errno: -2, code: 'ENOENT', syscall: 'open', path: '/Users/hwong/code/unional/komondor/__komondor__/specs/specStor... }\r\n```\r\n\r\nYou can see that sometimes it works and sometimes `require('./spec')` returns an empty object.\r\n"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/363212766","html_url":"https://github.com/nodejs/node/issues/18586#issuecomment-363212766","issue_url":"https://api.github.com/repos/nodejs/node/issues/18586","id":363212766,"user":{"login":"vkurchatkin","id":2993861,"avatar_url":"https://avatars2.githubusercontent.com/u/2993861?v=4","gravatar_id":"","url":"https://api.github.com/users/vkurchatkin","html_url":"https://github.com/vkurchatkin","followers_url":"https://api.github.com/users/vkurchatkin/followers","following_url":"https://api.github.com/users/vkurchatkin/following{/other_user}","gists_url":"https://api.github.com/users/vkurchatkin/gists{/gist_id}","starred_url":"https://api.github.com/users/vkurchatkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkurchatkin/subscriptions","organizations_url":"https://api.github.com/users/vkurchatkin/orgs","repos_url":"https://api.github.com/users/vkurchatkin/repos","events_url":"https://api.github.com/users/vkurchatkin/events{/privacy}","received_events_url":"https://api.github.com/users/vkurchatkin/received_events","type":"User","site_admin":false},"created_at":"2018-02-05T20:34:26Z","updated_at":"2018-02-05T20:34:26Z","author_association":"MEMBER","body":"This is probably due to cyclic dependencies, i.e. this is expected"}}
{"actor":{"display_login":"vkurchatkin"}}