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
{{ message }}
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
TSLint rule tests don't support testing rules that have failure messages that span over multiple lines.
This happens because when TSLint parses a .lint file for the expected failure messages, it always parses lines separately.
For example:
declare var foo;
~~~~~ [This is a multiline
error message]
TSLint will parse the failure message as "This is a multiline" instead of "This is a multiline error message".
ESLint
As far as I could tell, ESLint takes a different approach to rule unit tests, so this issue will be deprecated once #214 is solved.
Workaround
As a workaround, I had my rule take a "single-line" boolean argument. If this is set, the messages the rules generates get joined into a single line. The "single-line" argument is then set in the test TSLint configurations. When running the rule in "production", this boolean is not set, so the messages can preserve their line breaks.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
TSLint rule tests don't support testing rules that have failure messages that span over multiple lines.
This happens because when TSLint parses a
.lint
file for the expected failure messages, it always parses lines separately.For example:
TSLint will parse the failure message as "This is a multiline" instead of "This is a multiline error message".
ESLint
As far as I could tell, ESLint takes a different approach to rule unit tests, so this issue will be deprecated once #214 is solved.
Workaround
As a workaround, I had my rule take a
"single-line"
boolean argument. If this is set, the messages the rules generates get joined into a single line. The"single-line"
argument is then set in the test TSLint configurations. When running the rule in "production", this boolean is not set, so the messages can preserve their line breaks.The text was updated successfully, but these errors were encountered: