сегодня утром я модернизировал угловой 2.1.0 проект 2.3.1, и с тех пор 5 из моих 86 тестов неудачно со следующей ошибкой:Покушения присвоить ReadOnly свойства после обновления Углового до 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; },
Я действительно не знаю, как устранить это.
У меня такая же проблема. Не знаю, как отладить этот. – Prathap