{"action":"created","issue":{"url":"https://api.github.com/repos/airbnb/enzyme/issues/123","labels_url":"https://api.github.com/repos/airbnb/enzyme/issues/123/labels{/name}","comments_url":"https://api.github.com/repos/airbnb/enzyme/issues/123/comments","events_url":"https://api.github.com/repos/airbnb/enzyme/issues/123/events","html_url":"https://github.com/airbnb/enzyme/issues/123","id":126933930,"number":123,"title":"require makes mocha crash when used in `describeWithDOM`","user":{"login":"hourliert","id":7560406,"avatar_url":"https://avatars.githubusercontent.com/u/7560406?v=3","gravatar_id":"","url":"https://api.github.com/users/hourliert","html_url":"https://github.com/hourliert","followers_url":"https://api.github.com/users/hourliert/followers","following_url":"https://api.github.com/users/hourliert/following{/other_user}","gists_url":"https://api.github.com/users/hourliert/gists{/gist_id}","starred_url":"https://api.github.com/users/hourliert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hourliert/subscriptions","organizations_url":"https://api.github.com/users/hourliert/orgs","repos_url":"https://api.github.com/users/hourliert/repos","events_url":"https://api.github.com/users/hourliert/events{/privacy}","received_events_url":"https://api.github.com/users/hourliert/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-15T18:52:33Z","updated_at":"2016-01-15T18:58:02Z","closed_at":null,"body":"Hi,\r\n\r\nI have a very weird issue happening when requiring a module in a `describeWithDOM` block.\r\n\r\nWhen I am mocking a dependency with `mockery` I need to require my module (which using the mock) after the mock registration.\r\nIf I do this in a `describeWithDOM` block mocha exits without saying anything.\r\n\r\nHere a sample that makes mocha crash:\r\n\r\n```javascript\r\n  describeWithDOM('With DOM', () => {\r\n    beforeEach(() => {\r\n      mockery.enable({\r\n        warnOnReplace: false,\r\n        warnOnUnregistered: false,\r\n        useCleanCache: true,\r\n      });\r\n    });\r\n\r\n    afterEach(() => {\r\n      mockery.disable();\r\n    });\r\n\r\n    it('should call the signout method', () => {\r\n      const spy = sinon.spy();\r\n      mockery.registerMock('../../actions/session', {\r\n        signout: spy,\r\n      });\r\n\r\n      const LogoutPage = require('../LogoutPage');\r\n      \r\n      expect(spy).to.have.not.been.called();\r\n      mount((\r\n        <LogoutPage />\r\n      ));\r\n      expect(spy).to.have.been.called();\r\n\r\n      mockery.deregisterMock('../../actions/session');\r\n    });\r\n  });\r\n```\r\n\r\nEven if my file `../LogoutPage.js` is extremely simple:\r\n```javascript\r\nexport default {\r\n  here: true,\r\n};\r\n```\r\n`require` makes mocha crash. \r\n\r\nI am using:\r\n```\r\n$ node --version\r\nv5.4.1\r\n$ npm --version\r\n3.3.12\r\n```\r\n\r\nA workaround is to reinstall jsdom with `npm install jsdom`.\r\n\r\nI am not sure if this issue is more related to enzyme, mocha or jsdom.\r\n\r\nThanks in advance."},"comment":{"url":"https://api.github.com/repos/airbnb/enzyme/issues/comments/172053508","html_url":"https://github.com/airbnb/enzyme/issues/123#issuecomment-172053508","issue_url":"https://api.github.com/repos/airbnb/enzyme/issues/123","id":172053508,"user":{"login":"hourliert","id":7560406,"avatar_url":"https://avatars.githubusercontent.com/u/7560406?v=3","gravatar_id":"","url":"https://api.github.com/users/hourliert","html_url":"https://github.com/hourliert","followers_url":"https://api.github.com/users/hourliert/followers","following_url":"https://api.github.com/users/hourliert/following{/other_user}","gists_url":"https://api.github.com/users/hourliert/gists{/gist_id}","starred_url":"https://api.github.com/users/hourliert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hourliert/subscriptions","organizations_url":"https://api.github.com/users/hourliert/orgs","repos_url":"https://api.github.com/users/hourliert/repos","events_url":"https://api.github.com/users/hourliert/events{/privacy}","received_events_url":"https://api.github.com/users/hourliert/received_events","type":"User","site_admin":false},"created_at":"2016-01-15T18:58:02Z","updated_at":"2016-01-15T18:58:02Z","body":"That's the problem. Mocha crashes without saying anything. No exception, no stack trace.\r\nI tried to debug it with node-inspector (with `node-debug /node_modules/mocha/bin/_mocha --compilers js:babel-core/register --require babel-polyfill ./src/containers/LogoutPage/__tests__/LogoutPage-test.js`) but it doesn't show anything.\r\n\r\nHere is a typical output of a crash:\r\n```\r\n$ ./node_modules/mocha/bin/_mocha --compilers js:babel-core/register --require babel-polyfill ./src/containers/LogoutPage/__tests__/LogoutPage-test.js\r\n\r\n\r\n  LogoutPage\r\n    (uses jsdom)\r\n      With DOM\r\n```"}}