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

Allow --test against a glob pattern of directories #2064

Closed
JoshuaKGoldberg opened this issue Jan 18, 2017 · 5 comments · Fixed by singapore/lint-condo#223
Closed

Allow --test against a glob pattern of directories #2064

JoshuaKGoldberg opened this issue Jan 18, 2017 · 5 comments · Fixed by singapore/lint-condo#223

Comments

@JoshuaKGoldberg
Copy link
Contributor

Instead of yarn test:rules to run them all, or manually modifying ruleTestRunner.js to change what's running, it'd be nice to quickly run yarn test:rules -- no-floating-promises/*.

It could be done pretty easily in ruleTestRunner.ts with:

// Abridged for ease of reading
const paths = process.argv[2] || "**";
glob.sync(`test/rules/${paths}/tslint.json`)
@mohsen1
Copy link
Contributor

mohsen1 commented Jan 18, 2017

You can use tslint CLI to test a specific rule. See --test flag in help. If you are making changes to tslint itself, you can compile and use the new compiled CLI

@JoshuaKGoldberg
Copy link
Contributor Author

JoshuaKGoldberg commented Jan 18, 2017

making changes to tslint

@mohsen1 yes, that's what I'm doing now. I'd like to sporadically run test:rules on specific .lint files without having to recompile the CLI.

@JoshuaKGoldberg
Copy link
Contributor Author

To be a little more elaborate - --test only runs against one directory.

C:\Code\tslint>tslint --test test/rules/no-floating-promises/**
C:\Code\tslint\lib\configuration.js:114
            throw new Error("Could not find config file at: " + path.resolve(suppliedConfigFilePath));
            ^

Error: Could not find config file at: C:\Code\tslint\test\rules\no-floating-promises\**\tslint.json

It would be nice to have a little more control and be able to test multiple directories. Perhaps letting --test run against multiple directories would accomplish the same thing...

@nchen63
Copy link
Contributor

nchen63 commented Jan 18, 2017

I have a slight preference for --test that works against more than 1 directory

@JoshuaKGoldberg JoshuaKGoldberg changed the title Option to run only specific rules tests? Allow --test against a glob pattern of directories Jan 19, 2017
@JoshuaKGoldberg
Copy link
Contributor Author

That makes sense, they're basically the same. Updated the title.

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

Successfully merging a pull request may close this issue.

3 participants