I just updated RC3 to RC4 and now i get this error in my tests:
Error: overrideDirective is not supported in this implementation of TestComponentBuilder
In TestComponentBuilder
inside @angular/core@2.0.0-rc.4/testing/test_component_builder.js
i can see this declaration of the method
TestComponentBuilder.prototype.overrideDirective = function(componentType, from, to) {
throw new Error('overrideDirective is not supported in this implementation of TestComponentBuilder.');
};
So now the question is: how do i override a directive?
Ok so it seems that they deliberatevely removed the feature without replacing it with something else as stated in this issue
So the only solution i found is to use a strange OverridingTestComponentBuilder
that suddenly appeared in compiler/testing
.
This is not ideal as from RC4 TestComponentBuilder
should be imported from @angular/core/testing
but it's a temporary fix waiting for them to sort this out.
Once you import the class you can use it just like you'd use TestComponentBuilder
import { OverridingTestComponentBuilder } from '@angular/compiler/testing'
beforeEach(inject([OverridingTestComponentBuilder], _tcb => {
tcb = _tcb
}));
And all the override* methods should work nicely.