Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Need way to specify min TS version for a test #2304

Closed
nchen63 opened this issue Mar 6, 2017 · 2 comments
Closed

Need way to specify min TS version for a test #2304

nchen63 opened this issue Mar 6, 2017 · 2 comments

Comments

@nchen63
Copy link
Contributor

nchen63 commented Mar 6, 2017

#2219 fails on ts 2.0.10 because spread isn't supported, so we need a way to disable tests for certain versions.

One way to do this might be to have a config setting that specifies the min version number. I think a more flexible approach would be to throw a special Error if an unsupported construct is detected when the rule is executed. These errors would cause the rule test runner to ignore that test. We would also need a way to ensure that the Error is expected, maybe a new property of the config file.

@adidahiya
Copy link
Contributor

maybe we just drop 2.0.10 in v5...

@ajafff
Copy link
Contributor

ajafff commented Mar 6, 2017

+1 for dropping ts 2.0, but the problem still remains for rules that use new language features / syntax

#2219 fails because typescript just doesn't properly parse code with object spread. I don't think the rule itself can do anything special with the AST to detect such cases. I also would not go the route of adding more stuff to the config file.

Rule tests already use their own syntax for expected failures. Why not simply add a directive with a semver selector at the top of the *.ts.lint file. Something like [typescript]: >=2.1.0 (which is actually fully compatible with the current syntax)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants