Skip to main content

Module testing

Module testing 

Source
Expand description

Scaffolds temporary projects and in-process daemons for integration testing against language servers.

Enable with the testing feature flag:

aether-lspd = { version = "...", features = ["testing"] }

§Projects

Projects are TestWorkspaces, so they share its file, write, path, and path_string helpers and are cleaned up when dropped.

  • cargo_project(name) – A Cargo project with Cargo.toml and src/main.rs.
  • node_project(name) – A Node.js/TypeScript project with package.json, tsconfig.json, src/index.ts, and TypeScript 7 installed locally with npm install.
  • file_uri(path) – The LSP file:// URI for a path.

§Daemons

  • TestDaemon – An in-process daemon with deterministic shutdown. Its socket accepts connections as soon as spawn returns. TestDaemon::builder overrides the request, diagnostics and settle timeouts.
  • configure_fake_server – Points a language at the shared fake language server. The fake server holds diagnostics for files containing // hold-diagnostics until it receives a fake/releaseDiagnostics request, and reports itself as loading while the workspace root holds a .fake-loading file, until a fake/finishLoading request.

§Example

use aether_lspd::testing::{cargo_project, file_uri};

let project = cargo_project("my-test");
project.write("src/lib.rs", "pub fn hello() -> &'static str { \"hi\" }");
let uri = file_uri(&project.path("src/lib.rs"));

Structs§

TestDaemon
An in-process daemon with explicit configuration and deterministic shutdown.
TestDaemonBuilder
Configures a TestDaemon before it starts. Unset timeouts match the production daemon.
TestGate
TestWorkspace

Enums§

TestDaemonError
TestPoint

Functions§

cargo_project
configure_fake_server⚠
Configure one language to use the shared fake Python server in the current test process.
file_uri
node_project