mirror of
https://github.com/kbwo/testing-language-server.git
synced 2025-07-17 16:34:59 +00:00
![]() This commit introduces a new test adapter for the RSpec testing framework and includes general code cleanup. RSpec Adapter Features: - Implements the `Runner` trait for RSpec. - Uses `tree-sitter-ruby` for test discovery from `*_spec.rb` files, identifying `describe`, `context`, and `it` blocks. - Executes RSpec tests using the `rspec -f json` command and parses the JSON output to generate diagnostics for failed tests. - Detects RSpec workspaces by looking for `Gemfile` or `.rspec` files. - Includes a demo RSpec project (`demo/rspec_project`) for testing. - Adds integration tests (`crates/adapter/tests/rspec_test.rs`) covering workspace detection, test discovery, and diagnostic parsing. Cleanup and Fixes: - I refactored the RSpec adapter to be fully synchronous, resolving previous compilation issues with the `Runner` trait. - I removed unused imports and dead code in the RSpec adapter files. - I ensured the `crates/adapter/src/runner/phpunit.rs` uses the correct tree-sitter PHP language function, confirming a previous fix. - I verified that the entire project builds successfully using `cargo build --all-targets`. - I confirmed all RSpec-specific tests pass. Pre-existing test failures in Jest, Node, and Vitest adapters remain and are noted as out of scope for this change. The implementation adheres to the synchronous nature of the `Runner` trait, ensuring correct integration with the existing adapter framework. |
||
---|---|---|
.. | ||
.helix | ||
.vim | ||
.vscode | ||
deno | ||
go | ||
jest | ||
node-test | ||
phpunit | ||
rspec_project | ||
rust | ||
vitest | ||
.testingls.toml | ||
README.md |
Using nvim-lspconfig
The specification is not stable, so you need to set it yourself. Once the spec is stable, I will send a PR to nvim-lspconfig
.
local lspconfig = require('lspconfig')
local configs = require('lspconfig.configs')
local util = require "lspconfig/util"
configs.testing_ls = {
default_config = {
cmd = { "testing-language-server" },
filetypes = { "rust" },
root_dir = util.root_pattern(".git", "Cargo.toml"),
init_options = {
enable = true,
fileTypes = {"rust"},
adapterCommand = {
rust = {
{
path = "testing-ls-adapter",
extra_arg = { "--test-kind=cargo-test", "--workspace" },
include = { "/demo/**/src/**/*.rs"},
exclude = { "/**/target/**"},
}
}
},
enableWorkspaceDiagnostics = true,
trace = {
server = "verbose"
}
}
},
docs = {
description = [[
https://github.com/kbwo/testing-language-server
Language Server for real-time testing.
]],
},
}
lspconfig.testing_ls.setup{}