-
Notifications
You must be signed in to change notification settings - Fork 627
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
Discussion: run specific test - test.only #214
Comments
In addition i'm also using the jest cli parameter
This is nice to debug. Also in a homemade framework we added something like glob on spec names. For example:
|
Test cli is waiting on import(), would be able glob on filename and test. |
@hayd once the |
An alternative to the /** Defines options for controlling execution details of a test suite. */
export interface RunOptions {
parallel?: boolean;
only?: RegExp;
skip?: RegExp;
} Semantics That would allow test case filtering like: runTests({ only: /caseA|caseB/ });
runTests({ only: /caseA|caseB/, skip: /caseC/ });
runIfMain(import.meta, { only: /caseA|caseB/ });
runIfMain(import.meta, { skip: /caseC/ }); This filtering approach is already implemented in Characteristics
What y'all think about this? |
Is the regexp pattern checking the filename of the import? If so it's ok for me and we can glob it too like @hayd suggested |
There's a filter regex already, having runTests look at a named --filter arg, and passing it as the filter, seems reasonable to me. i.e. so can do |
@chiefbiiko your solution still requires to go to entry point of tests and place a filter. My initial idea was to just append We might consider adding test.skipIf(Deno.platform === "win", function myTest() { ... }) |
Could be nice doing something like this in tests scripts : Test.skipIf(expression, () => {
Test(function testToBeSkippedIf() {
})
Test(function testToBeSkippedIf2() {
})
}) |
One alternative is skip() that raises a SkipTestError which we catch/handle in runTests. So code would be:
Edit: can do |
@bartlomieju @zekth @hayd @chiefbiiko what's decision about this one? I'd like to do this |
Based on my own experience of using It would be really good if using |
I don't think it's a good idea to exit with a non zero error code because in some cases you want to use |
I got some test that is failing and I'd want to debug it, so when I run my test suite I want to focus some tests without needing to comment out my
test.ts
file. It boosts productivity significantly and would be nice to have it in standard lib.This pattern is common in Node.js testing frameworks:
test.only
describe.only/it.only
test.only/it.only/fit
Proposed API:
test.only(t: TestDefinition | TestFunction): void
- when there's at least one usage of this method only those test cases are run duringrunTests
EDIT: Things to consider:
filter
in testing module?The text was updated successfully, but these errors were encountered: