Skip to content

Updated from version 1.0.4 to 1.3.0-beta.1 'ng test' issue with RxJS operators #7041

@kuncevic

Description

@kuncevic
  • [ x] bug report

Versions.

@angular/cli: 1.3.0-beta.1
node: 7.8.0
os: win32 x64
@angular/animations: 4.1.3
@angular/common: 4.1.3
@angular/compiler: 4.1.3
@angular/core: 4.1.3
@angular/flex-layout: 2.0.0-rc.1
@angular/forms: 4.1.3
@angular/http: 4.1.3
@angular/material: 2.0.0-beta.3
@angular/platform-browser: 4.1.3
@angular/platform-browser-dynamic: 4.1.3
@angular/router: 4.1.3
@angular/cli: 1.3.0-beta.1
@angular/compiler-cli: 4.1.3

webpack-bundle-analyzer: "2.8.3", 
webpack: "3.1.0", 
@ngtools/webpack: "1.6.0-beta.1"

RxJS: 5.3.0

Repro steps.

Add file with rxjs operators rxjs-operators.ts that I am importing in my core.module (then in gets imported in to app.module):

import 'rxjs/add/observable/throw';
import 'rxjs/add/observable/interval';

import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/operator/skip';
import 'rxjs/add/operator/take';

The log given by the failure.

When running ng test it is throwing an errors with 1.3.0-beta.1, that didn't hepend with cli 1.0.4:

ERROR in c:/Projects/work/test/src/app/core/services/time.service.ts (9,36): Property 'interval' does not exist on type 'typeof Observable'.
ERROR in c:/Projects/work/test/src/app/features/rules/rule-edit/rule-edit.component.ts (60,14): Property 'take' does not exist on type 'Observable<Direction[]>'.
ERROR in c:/Projects/work/test/src/app/features/reports/powerbi/powerbi.component.ts (48,10): Property 'take' does not exist on type 'Observable<Site>'.
ERROR in c:/Projects/work/test/src/app/core/redux/effects/rounding-rule.ts (39,10): Property 'mergeMap' does not exist on type 'Actions'.
ERROR in c:/Projects/work/test/src/app/features/rules/rule-edit/rule-edit.component.ts (60,14): Property 'take' does not exist on type 'Observable<Direction[]>'.
ERROR in c:/Projects/work/test/src/app/core/services/time.service.ts (9,36): Property 'interval' does not exist on type 'typeof Observable'.
ERROR in c:/Projects/work/test/src/app/features/reports/powerbi/powerbi.component.ts (48,10): Property 'take' does not exist on type 'Observable<Site>'.
ERROR in c:/Projects/work/test/src/app/core/redux/effects/rounding-rule.ts (39,10): Property 'mergeMap' does not exist on type 'Actions'.

Desired functionality.

'ng test' should not throw any errors as above.

Mention any other details that might be useful.

ng serve works just fine and having no errors during run time.

UPDATE:

time.service.ts looking like that:

@Injectable()
export class TimeService {
  public currentTime: Observable<Date>;

  constructor() {
    this.currentTime =  Observable.interval(1000).map(x => new Date()).share();
  }
}

By referencing import './../rxjs-operators'; in time.service.ts I got all errors fixed (that is strange, the issue was related to multiple files, not only to time.service.ts file), again, that is strange because all the rest errors related to other files just magically dissipated... but no other code file was changed except time.service.ts

Then for test I just commented/remove my import './../rxjs-operators'; in time.service.ts now I got only two errors now, not 8 errors as I got initially, before modifying time.service.ts file:

ERROR in c:/Projects/work/test/src/app/core/services/time.service.ts (10,36): Property 'interval' does not exist on type 'typeof Observable'.
ERROR in c:/Projects/work/test/src/app/core/services/time.service.ts (10,36): Property 'interval' does not exist on type 'typeof Observable'.

I was restarting the ng test after each change in time.service.ts non other file nor npm module was being changed.

So for now I am just keeping import './../rxjs-operators'; within time.service.ts but really wana know what was changed in cli so it causing such an issue and is there a proper fix for that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions