Repository navigation
Expand file tree
/
Copy pathplugin_sdk_node.rs
More file actions
57 lines (52 loc) · 2.09 KB
/
Copy pathplugin_sdk_node.rs
File metadata and controls
57 lines (52 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! End-to-end check of the official Node.js plugin SDK (`sdk/node`) against
//! Rust Core; the scenario is shared with the Java SDK in `plugin_sdk/mod.rs`.
//! The VCS scenario is in `plugin_sdk/vcs.rs`. Both run only when
//! `LITHE_PLUGIN_SDK_NODE` names a Node.js 20.3 or newer executable;
//! `shared/plugins/scripts/sdk-e2e.mjs` sets it.
mod plugin_sdk;
#[test]
fn the_node_sdk_registers_and_answers_color_decorations() {
let Some(node) = plugin_sdk::node_from_environment("Node color providers") else {
return;
};
let script = plugin_sdk::repository_path("sdk/node/examples/sample-build/backend/main.mjs");
// Node's command-line resolver cannot use Windows extended-length paths.
// The existing URI adapter gives it the equivalent ordinary native path.
let uri = lithe_document_uri::DocumentPathPlatform::Auto
.document_uri(&script.to_string_lossy())
.expect("sample URI");
let script = lithe_document_uri::file_path_from_uri(&uri);
plugin_sdk::colors::run("node", &node, &[script]);
}
#[test]
fn the_node_sdk_import_provider_reads_a_selected_source_through_core() {
let Some(node) = plugin_sdk::node_from_environment("the Node keymap provider") else {
return;
};
let script = plugin_sdk::repository_path("sdk/node/examples/sample-build/backend/main.mjs");
plugin_sdk::keymap::run(
"node-keymap",
&node,
&[script.to_string_lossy().into_owned()],
);
}
#[test]
fn the_node_sdk_sample_backend_serves_build_requests_and_plugin_functions() {
let Some(node) = plugin_sdk::node_from_environment("the Node.js SDK end-to-end check") else {
return;
};
plugin_sdk::run_sample_scenario(&plugin_sdk::Sample {
tool: "node",
runtime: node.clone(),
package: plugin_sdk::repository_path("sdk/node/examples/sample-build"),
node,
});
}
#[test]
fn the_node_sdk_sample_vcs_provider_answers_every_operation() {
let Some(node) = plugin_sdk::node_from_environment("the Node.js SDK VCS end-to-end check")
else {
return;
};
plugin_sdk::vcs::run_vcs_scenario(&node);
}