Angular-cli: generating route must add all dependencies to .spec file

Created on 6 May 2016  路  7Comments  路  Source: angular/angular-cli

with the 0.1.0 version I added new route so cli generated a component setup route. but if I run 'ng test' I get errors. I added ROUTE_PROVIDERS to .spec file but that didn't help:

Error: Platforms have to be created via createPlatform!

Now, what are platforms? oh...

1 (urgent) bufix

Most helpful comment

Any updates for rc2/rc3? I still get the error:

ORIGINAL EXCEPTION: Platforms have to be created via `createPlatform`!

The provided solution does not work anymore:

import {ROUTER_FAKE_PROVIDERS} from '@angular/router/testing';

[ts] Cannot find module '@angular/router/testing'.

All 7 comments

Did you get anywhere with this?

Never mind i did @alvipeo, in your spec file you need to use

import {ROUTER_FAKE_PROVIDERS} from '@angular/router/testing';

and use that provider

@JohnCashmore Thank you, that works for me

I'm closing this issue as obsolete, because we've recently both disabled route generation and also simplified tests across the board.

I still get this error with this setup:

    "@angular/common": "2.0.0-rc.2",
    "@angular/compiler": "2.0.0-rc.2",
    "@angular/core": "2.0.0-rc.2",
    "@angular/http": "2.0.0-rc.2",
    "@angular/platform-browser": "2.0.0-rc.2",
    "@angular/platform-browser-dynamic": "2.0.0-rc.2",
    "@angular/router": "3.0.0-alpha.7",
    "@angular/router-deprecated": "2.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.2",

I've also tried rc3 -- same output.
What I am doing wrong?

Any updates for rc2/rc3? I still get the error:

ORIGINAL EXCEPTION: Platforms have to be created via `createPlatform`!

The provided solution does not work anymore:

import {ROUTER_FAKE_PROVIDERS} from '@angular/router/testing';

[ts] Cannot find module '@angular/router/testing'.

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gotschmarcel picture gotschmarcel  路  3Comments

rwillmer picture rwillmer  路  3Comments

donaldallen picture donaldallen  路  3Comments

sysmat picture sysmat  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments