summaryrefslogtreecommitdiff
path: root/cli/lsp/testing/definitions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/lsp/testing/definitions.rs')
-rw-r--r--cli/lsp/testing/definitions.rs29
1 files changed, 16 insertions, 13 deletions
diff --git a/cli/lsp/testing/definitions.rs b/cli/lsp/testing/definitions.rs
index 69baf053e..f23411852 100644
--- a/cli/lsp/testing/definitions.rs
+++ b/cli/lsp/testing/definitions.rs
@@ -10,6 +10,7 @@ use crate::tools::test::TestDescription;
use crate::tools::test::TestStepDescription;
use crate::util::checksum;
+use deno_core::error::AnyError;
use deno_core::ModuleSpecifier;
use lsp::Range;
use std::collections::HashMap;
@@ -144,21 +145,23 @@ impl TestModule {
pub fn as_replace_notification(
&self,
maybe_root_uri: Option<&ModuleSpecifier>,
- ) -> TestingNotification {
+ ) -> Result<TestingNotification, AnyError> {
let label = self.label(maybe_root_uri);
- TestingNotification::Module(lsp_custom::TestModuleNotificationParams {
- text_document: lsp::TextDocumentIdentifier {
- uri: url_to_uri(&self.specifier),
+ Ok(TestingNotification::Module(
+ lsp_custom::TestModuleNotificationParams {
+ text_document: lsp::TextDocumentIdentifier {
+ uri: url_to_uri(&self.specifier)?,
+ },
+ kind: lsp_custom::TestModuleNotificationKind::Replace,
+ label,
+ tests: self
+ .defs
+ .iter()
+ .filter(|(_, def)| def.parent_id.is_none())
+ .map(|(id, _)| self.get_test_data(id))
+ .collect(),
},
- kind: lsp_custom::TestModuleNotificationKind::Replace,
- label,
- tests: self
- .defs
- .iter()
- .filter(|(_, def)| def.parent_id.is_none())
- .map(|(id, _)| self.get_test_data(id))
- .collect(),
- })
+ ))
}
pub fn label(&self, maybe_root_uri: Option<&ModuleSpecifier>) -> String {