You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up on #111, this code we use for mocking pipes in unit tests throws TypeError: Cannot read property 'text' of undefined at node_modules/codelyzer/pipeNamingRule.js:98:44:
exportfunctionmockPipe(name: string): any{
@Pipe({ name })classMockPipeimplementsPipeTransform{transform(input: any): any{returninput;}}returnMockPipe;}
Instead of throwing, maybe the rule can ignore variables in the decorator?
// could be ignored by codelyzer
@Pipe({ name })classDynamicPipe{ ... }// could be ignored by codelyzer
@Pipe({name: variableName})classDynamicPipe{ ... }// should be checked by codelyzer
@Pipe({name: 'some-name'})classRegularPipe{ ... }
Alternatively, a meaningful error message (like in #111) mentioning the file in question would be better than throwing.
To clarify: The same code works and does not break codelyzer when rewritten like this:
exportfunctionmockPipe(name: string): any{returnPipe({ name })(classMockPipe{transform(input: any): any{returninput;}});}
However, knowing that this file is the culprit instead of getting a 'property of undefined' error thrown would be preferrable. This is the method that throws since it is called with a property without an initializer.
Follow-up on #111, this code we use for mocking pipes in unit tests throws
TypeError: Cannot read property 'text' of undefined at node_modules/codelyzer/pipeNamingRule.js:98:44
:Instead of throwing, maybe the rule can ignore variables in the decorator?
Alternatively, a meaningful error message (like in #111) mentioning the file in question would be better than throwing.
[email protected]
[email protected]
[email protected]
Thanks for your great work!
The text was updated successfully, but these errors were encountered: