-
Notifications
You must be signed in to change notification settings - Fork 144
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
Testing code lens for wrapped test method #572
Comments
@dsherret you are closer to the direction of the test API at the moment, can you think of a clean way to detect this in the AST? |
For the same file it would be not too bad to get it working in some constrained scenarios, but it would be a bit of work to get it working across files. A workaround right now might be to instead just wrap the test definition creation or the function rather than the entire call: Deno.test(wrapped({
name: "some test",
fn: () => {
},
});
Deno.test("some test", wrapped(() => {
})); |
That doesn't even sound like a work-around, that seems like a much better overall solution. There will always be a limit of what we can detect from the AST, even the destructuring only works within a file. I can't really see a drawback to that solution. |
I'm using tincan for writing tests, which uses a Jest-like api. |
@kitsonk @dsherret , any thoughts about revisiting this? There are lots of alternative testing paradigms and frameworks. Some sort of code lens API or wrapper recognition signal would be quite helpful to encourage the ecosystem. Currently, the code lens doesn't recognize the BDD example tests included in std 0.143.0 (https://github.com/denoland/deno_std/blob/0.143.0/testing/bdd_examples/user_flat_test.ts). |
Is your feature request related to a problem? Please describe.
As Deno has declined to extend their test API with hooks such as before/after, in some cases it is needed to extend this capability by wrapping the test method. As has been done in test_suite.
However, when doing so the extension fails to detect the new wrapped method as a test and doesn't provide code lens to allow tests to be run individually.
(line 10 has no
Run test
despite being recognized by Deno)Describe the solution you'd like
Either a special syntax/annotation/type to mark a certain function as equivalent to
Deno.test
or tapping into Deno's test detection and possibly using stack trace at the time of test registration to find indirectly registered tests.The text was updated successfully, but these errors were encountered: