2.3.1

2017-01-13 3 views
9

करने कोणीय उन्नयन मैं आज सुबह 2.3.1 के लिए एक कोणीय 2.1.0 परियोजना उन्नत बनाया के बाद से संपत्ति केवल पढ़ने के लिए आवंटित करने के लिए प्रयास किया गया, और तब से मेरी 86 परीक्षण के 5 निम्न त्रुटि के साथ विफल:2.3.1

Failed: Attempted to assign to readonly property. [email protected]:///~/@angular/core/src/facade/errors.js:43:33 <- src/test.ts:12465:52

यहाँ सबसे सरल परीक्षण है कि विफल हो रहा है है:

/* tslint:disable:no-unused-variable */ 
import {async, ComponentFixture, TestBed} from '@angular/core/testing'; 
import {ProfileComponent} from './profile.component'; 
import {TranslateModule, TranslateService} from 'ng2-translate'; 
import {FormsModule} from '@angular/forms'; 
import {ProfileService} from '../profile.service'; 
import {ProfileServiceStub} from '../../../testing/profile-service-stub'; 
import {TranslateServiceStub} from '../../../testing/translate-service-stub'; 
import {NotificationsServiceStub} from '../../../testing/notifications-service-stub'; 
import {NotificationsService} from 'angular2-notifications'; 

describe('ProfileComponent',() => { 
    let component: ProfileComponent; 
    let fixture: ComponentFixture<ProfileComponent>; 
    const profileServiceStub = new ProfileServiceStub(5000); 

    beforeEach(async(() => { 
    TestBed.configureTestingModule({ 
     declarations: [ProfileComponent], 
     imports: [ 
     TranslateModule, FormsModule 
     ], 
     providers: [ 
     {provide: ProfileService, useValue: profileServiceStub}, 
     {provide: TranslateService, useClass: TranslateServiceStub}, 
     {provide: NotificationsService, useClass: NotificationsServiceStub} 
     ] 
    }).compileComponents(); 
    })); 

    beforeEach(() => { 
    fixture = TestBed.createComponent(ProfileComponent); 
    component = fixture.componentInstance; 
    fixture.detectChanges(); 
    }); 

    it('should create',() => { 
    expect(component).toBeTruthy(); 
    }); 
}); 

मैं जिस तरह से परीक्षण की स्थापना की है में किसी भी संरचनात्मक अंतर दिखाई नहीं देता है, तो मुझे लगता है कि यह कुछ मैं कर रहा हूँ के साथ कुछ है।

और जब मैं errors.js पर एक नजर है, दोषी लाइन इस तरह दिखता है:

set: function (message) { this._nativeError.message = message; }, 

मैं वास्तव में है कि के समाधान के तरीकों पता नहीं है।

+3

मेरे पास एक ही समस्या है। इस बात को डीबग करने के लिए कोई सुराग नहीं है। – Prathap

उत्तर

5

मुझे पता चला कि समस्या क्या थी। मैंने त्रुटियों.जेएस फ़ाइल में console.log() जोड़ा जहां त्रुटि रिपोर्ट की गई थी और मुझे संदर्भ के बारे में अधिक जानकारी मिली। असल में मैं उन परीक्षणों के लिए एक स्टब का उपयोग कर रहा था जो एक विशिष्ट EventEmitter को याद करते थे। इसने एक त्रुटि उत्पन्न की लेकिन त्रुटि रिपोर्टिंग में एक बग प्रतीत होता है जिसने कर्म को सही संदेश आउटपुट से रोका।

console.log() आपका मित्र

संबंधित मुद्दे

 संबंधित मुद्दे