Added TSX test runnables (#12922)

Fix #12884

Release Notes:

- Added runnable tests for TSX files.

---
Runnable tests can be customized via `tsx-test` tag

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
This commit is contained in:
Chung Wei Leong
2024-06-12 11:02:24 +02:00
committed by GitHub
co-authored by Piotr Osiewicz
parent b82350979f
commit ec95a33d8c
3 changed files with 17 additions and 2 deletions
+2 -1
View File
@@ -141,7 +141,8 @@ pub fn init(
vec![
Arc::new(typescript::TypeScriptLspAdapter::new(node_runtime.clone())),
Arc::new(vtsls::VtslsLspAdapter::new(node_runtime.clone()))
]
],
typescript_task_context()
);
language!(
"typescript",
+14
View File
@@ -0,0 +1,14 @@
; Add support for (node:test, bun:test and Jest) runnable
; Function expression that has `it`, `test` or `describe` as the function name
(
(call_expression
function: (_) @_name
(#any-of? @_name "it" "test" "describe")
arguments: (
arguments . (string
(string_fragment) @run
)
)
) @_tsx-test
(#set! tag tsx-test)
)
+1 -1
View File
@@ -37,7 +37,7 @@ pub(super) fn typescript_task_context() -> ContextProviderWithTasks {
VariableName::Symbol.template_value(),
VariableName::File.template_value(),
],
tags: vec!["ts-test".into(), "js-test".into()],
tags: vec!["ts-test".into(), "js-test".into(), "tsx-test".into()],
..TaskTemplate::default()
},
TaskTemplate {