angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng test SyntaxError: Functions cannot be declared in a nested block in strict mode

Open Oleg1969 opened this issue 9 years ago • 6 comments

Please provide us with the following information:

OS?

Mac OS

Versions.

1.0.0-beta.22-1

Repro steps.

run ng test

The log given by the failure.

PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR SyntaxError: Functions cannot be declared in a nested block in strict mode at webpack:///Users/..../applications/myapp/~/@angular/compiler/src/jit/compiler.js:265:0 <- src/test.ts:51172

Mention any other details that might be useful.

Use "karma-phantomjs-launcher": "^1.0.2" browsers: ['PhantomJS'] Angular 2 , v 2.3.0


Thanks! We'll be in touch soon.

Oleg1969 avatar Dec 08 '16 17:12 Oleg1969

I would guess this is a coding error rather than a problem with the CLI. Does ng test run if you disable/comment out all your spec files?

mattdistefano avatar Dec 08 '16 18:12 mattdistefano

Yes I did, I disabled all tests as my first step. Same error. In addition it works if I use browsers: ['Chrome'] in karma.conf.js if I switch to browsers: ['PhantomJS'] it does not

Oleg1969 avatar Dec 08 '16 18:12 Oleg1969

Also it works fine with browsers: ['PhantomJS'] if I use Angular 2.2.4 (vs. 2.3.0). Looks like Angular 2.3.0 does not work with browsers: ['PhantomJS']

Oleg1969 avatar Dec 08 '16 18:12 Oleg1969

See the corresponding issue - https://github.com/angular/angular/issues/13301 .

DorianGrey avatar Dec 08 '16 19:12 DorianGrey

Closing as this is not a CLI specific issue, but an issue with Angular and PhantomJS. See https://github.com/angular/angular/issues/13301

hansl avatar Dec 08 '16 20:12 hansl

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.