-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --only
flag for running test.only
tests
#1472
Comments
To be exact, AVA won't switch into exclusive mode until the first |
For the record, the new Now, if we'll end up with functionality as Mark says, where Maybe it's a stupid idea, but why can't we just run a glob against all recognised test files and look for any What do you think? |
We did consider this previously. There's many ways of using AVA though, and scanning for the occurrence of
Yes, that is the behavior. The solution is for you to be able to specify that you're running Perhaps you might have some time to help us out here?
Sounds like the new |
I'm back after 1.5 years, still using ava, unit tests are getting out of control, it's very difficult to work on a feature by isolating it in one of test files. This feature is a must-have. |
@revelt perhaps you might have some time to help us out here? |
Maybe it's an inefficient way but I think I have an MVP of this feature implemented on my local fork. I haven't wired up CLI flag This gives actually two new features:
Second feature helps to deal with large program's unit tests, to concentrate on a particular test file and "nail it", without polluting the terminal with already implemented features from other test files. Both The file read below maybe could be async and findTestFiles() {
return handlePaths(this.files, this.extensions, this.excludePatterns, Object.assign({
cwd: this.cwd,
expandDirectories: false,
nodir: false
}, this.globCaches)).then(filesArr => {
if (Array.isArray(filesArr) && filesArr.length > 1) {
for (let i = filesArr.length; i--;) {
const filesContents = fs.readFileSync(filesArr[i], "utf8");
if (
filesContents.includes(".only(") || filesContents.includes("avaonly")
) {
return [filesArr[i]]
}
}
return filesArr;
}
return filesArr
});
} The addition is |
@revelt the problem with looking for substrings is that any other API you're using in your test file that happens to match the substring causes AVA to ignore all other files. |
Is this still opened? We could generate a hash key from the title (which is unique), so that one can do the following: see my pull request #2196 NOTE: All the test runner framework does not have that "hash title" concept... |
From #1467 (comment)
#1467 makes
test.only()
not be exclusive with multiple test files, so would be nice to have this flag.The text was updated successfully, but these errors were encountered: