{"action":"closed","issue":{"url":"https://api.github.com/repos/HichamBI/Angular-testing-webpack-mocha-chai-sinon/issues/2","repository_url":"https://api.github.com/repos/HichamBI/Angular-testing-webpack-mocha-chai-sinon","labels_url":"https://api.github.com/repos/HichamBI/Angular-testing-webpack-mocha-chai-sinon/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/HichamBI/Angular-testing-webpack-mocha-chai-sinon/issues/2/comments","events_url":"https://api.github.com/repos/HichamBI/Angular-testing-webpack-mocha-chai-sinon/issues/2/events","html_url":"https://github.com/HichamBI/Angular-testing-webpack-mocha-chai-sinon/issues/2","id":229175656,"number":2,"title":"support for `async` for node/jsdom testing","user":{"login":"DanielSchaffer","id":334487,"avatar_url":"https://avatars2.githubusercontent.com/u/334487?v=3","gravatar_id":"","url":"https://api.github.com/users/DanielSchaffer","html_url":"https://github.com/DanielSchaffer","followers_url":"https://api.github.com/users/DanielSchaffer/followers","following_url":"https://api.github.com/users/DanielSchaffer/following{/other_user}","gists_url":"https://api.github.com/users/DanielSchaffer/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielSchaffer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielSchaffer/subscriptions","organizations_url":"https://api.github.com/users/DanielSchaffer/orgs","repos_url":"https://api.github.com/users/DanielSchaffer/repos","events_url":"https://api.github.com/users/DanielSchaffer/events{/privacy}","received_events_url":"https://api.github.com/users/DanielSchaffer/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-05-16T21:33:24Z","updated_at":"2017-05-19T13:31:36Z","closed_at":"2017-05-19T13:31:36Z","body":"I've used your configuration to set up testing for my library, which requires using an asynchronous `beforeEach` (using `async` from `@angular/core/testing`). While everything works great using the browser-based testing (e.g. running `npm run test:server`), when I try to run the headless testing (`npm run test`), it fails with the error `Error: Expected to be running in 'ProxyZone', but it was not found.`\r\n\r\nYou should be able to reproduce by simply wrapping the first `beforeEach` in your `book-form.component.spec.ts` in the `async` helper:\r\n\r\n```\r\n    beforeEach(async(() => {\r\n        TestBed.configureTestingModule({\r\n            imports: [FormsModule],\r\n            declarations: [BookFormComponent],\r\n        }).compileComponents();\r\n    }));\r\n```\r\n\r\nI've tried a number of things to see if I could get it to work:\r\n* Added `require('zone.js/dist/mocha-patch')` to the rest of the require statements in `mocha-node-test-shim.js` -> results in `window is not defined` error in `mocha-patch`.\r\n* Moved `require('zone.js/dist/mocha-patch')` to after the JSDOM setup -> results in `Missing mocha.js` error in `mocha-patch`.\r\n* Moved `require('zone.js/dist/mocha-patch')` to after JSDOM *and* TestBed setup -> same as previous\r\n* Various other iterations of reordering the `require` statements and JSDOM setup, manually putting the `Mocha` object on the `global` and `global.window` objects all failed as well.\r\n\r\nI know from reading the exchanges in [@angular/angular/11230](https://github.com/angular/angular/issues/11230) that you and others had been struggling with this issue, but I haven't been able to find a way to make it work. Any ideas?"}}
{"actor":{"display_login":"HichamBI"}}