-
Notifications
You must be signed in to change notification settings - Fork 885
Expose testing utilities (helper.ts) in a d.ts file and in npm package #532
Comments
This is definitely a useful feature and we do want to expose testing utilities for custom rules. I think the easiest way to do this would be to refactor our testing utilities into a Thoughts @gscshoyru, @ashwinr? |
I feel a little strange exposing test code in the main repository -- but eslint does it, and the fact that we have pluggable rules is meant to be a feature. So I think that your idea makes sense. Except: I think we might want to split the testlib typings out into another d.ts file, since those types/functionality should only be available in tests. |
+1 for exposing the typings separately. although that makes our build a little more complicated... |
This is being implemented in #900. With that PR we're just going to do the straightforward thing and leave the typings where they are, accessible to users like this: // names of these exports might change
import {runTest, consoleTestResultHandler} from "tslint/lib/test";
const didAllTestsPass = consoleTestResultHandler(runTest("path/to/my/testing/dir/"));
if (!didAllTestsPass) {
process.exit(1);
} |
Also, the |
Can this be closed then? |
I have written several custom tslint rules.
I have some ad-hoc testing utilities written to test them, but I would rather just reuse the framework for testing rules that is defined in the tslint source code. It would make it easier for me to test my own rules and also easier to port back to the main source code and submit as pull requests.
What I /think/ I need is:
Please note: I may not know what I want technically. From a feature standpoint... I just want my tests to look exactly like your tests!
The text was updated successfully, but these errors were encountered: