Add runnable support for Deno.test (#34593)

example of detected code:
```ts
Deno.test("t", () => {
  console.log("Hello, World!");
});

Deno.test(function azaz() {
  console.log("Hello, World!");
});
```

I can't build zed locally so I didn't test this, but I think the code is
straightforward enough, hopefully someone else can verify it

Closes #ISSUE

Release Notes:

- N/A
This commit is contained in:
Bedis Nbiba 2025-07-29 00:45:41 +01:00 committed by GitHub
parent 109eddafd0
commit d2ef287791
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 74 additions and 1 deletions

View file

@ -1,4 +1,4 @@
; Add support for (node:test, bun:test and Jest) runnable
; Add support for (node:test, bun:test, Jest and Deno.test) runnable
; Function expression that has `it`, `test` or `describe` as the function name
(
(call_expression
@ -44,3 +44,42 @@
(#set! tag js-test)
)
; Add support for Deno.test with string names
(
(call_expression
function: (member_expression
object: (identifier) @_namespace
property: (property_identifier) @_method
)
(#eq? @_namespace "Deno")
(#eq? @_method "test")
arguments: (
arguments . [
(string (string_fragment) @run @DENO_TEST_NAME)
(identifier) @run @DENO_TEST_NAME
]
)
) @_js-test
(#set! tag js-test)
)
; Add support for Deno.test with named function expressions
(
(call_expression
function: (member_expression
object: (identifier) @_namespace
property: (property_identifier) @_method
)
(#eq? @_namespace "Deno")
(#eq? @_method "test")
arguments: (
arguments . (function_expression
name: (identifier) @run @DENO_TEST_NAME
)
)
) @_js-test
(#set! tag js-test)
)