Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 5 Testing: Expected to be running in 'ProxyZone', but it was not found

Tags:

angular

I have created a new Angular 5 project using Angular cli. When I run the default test, I get the following error:

Error: Expected to be running in 'ProxyZone', but it was not found.
at Function.webpackJsonp.../../../../zone.js/dist/proxy.js.ProxyZoneSpec.assertPresent (http://localhost:9876/_karma_webpack_/webpack:/home/sukumar/workspace/bizAnalyst/partnerportal/node_modules/zone.js/dist/proxy.js:38:1)

How to rectify this issue?

P.S.: Angular version: 5.2.1

like image 428
suku Avatar asked Feb 14 '18 14:02

suku


2 Answers

I encountered this error message when I accidentally wrote fakeAsync into the wrong line:

WRONG:

describe('My Test', fakeAsync(() => {
  it('should work', () => {

RIGHT:

describe('My Test', () => {
  it('should work', fakeAsync(() => {
like image 65
bgerth Avatar answered Jan 01 '23 22:01

bgerth


Might possibly in some cases be caused by reduce_vars on uglifyjs... in our case with Angular 6 and Webpack 4 (and uglifyjs-webpack-plugin 2.0.1).

Unsure what other contributing factors there might be, just something a colleague found out when trying to narrow a similiar problem down when upgrading to webpack4.

like image 24
Jouni S. Avatar answered Jan 01 '23 22:01

Jouni S.