-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decorators in test fail to compile #46
Comments
Another Example that fails to be mapped with the same message is this one: @Component({
template: `<input [appPasswordToggle]="passwordVisible"/>`
})
class TestComponent {
passwordVisible : boolean = false;
}
describe('PasswordToggleDirective', () => {
let fixture: ComponentFixture<TestComponent>;
beforeEach(() => {
fixture = TestBed.configureTestingModule({
declarations: [PasswordToggleDirective, TestComponent]
}).createComponent(TestComponent);
fixture.detectChanges();
});
it('should be type text when set true, type password when set to false', () => {
const parameters = [
{ visible: true, expectedType: 'text'},
{ visible: false, expectedType: 'password'},
]
parameters.forEach((parameter)=>{
fixture.componentInstance.passwordVisible = parameter.visible;
fixture.detectChanges();
const input = fixture.debugElement.query(By.css('input'));
const type = input.nativeElement.getAttribute('type');
expect(type).toBe(parameter.expectedType);
})
});
}); |
The "karmaTestExplorer.enabledSupplementalParserPlugins": [ "decorators-legacy" ] Is that a solution you think would work well for your case? Any other proposals you think would be worth considering? |
Having decorators in angular tests is quite common at least at my side. I could live with the suggested solution as it will be open to other plugins. |
Ok, perhaps it makes sense to enable it by default. Do you know if |
I don't know, sorry. |
Try out the fix in the beta branch to confirm if it resolves the issue. You can use the vsix from the CI build, or build it yourself from the |
It did parse the tests with decorators successfully. |
Released in v0.7.4 |
Describe the Bug
When I use a decorator in a test, it fails to map the file.
[TestLocator]: Failed to get tests from spec file /home/thomas/projects/schulung/bulletin-board/src/app/registration/user-registration/password-toggle/password-toggle.directive.spec.ts: SyntaxError: This experimental syntax requires enabling one of the following parser plugin(s): "decorators", "decorators-legacy". (5:0)
Steps to Reproduce the Behavior
Describe the Expected Behavior
U expect the test to be mapped.
The text was updated successfully, but these errors were encountered: