mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-22 19:54:43 +02:00
plugins/neotest: add playwright adapter
This commit is contained in:
parent
4708aac141
commit
50038f6c8f
4 changed files with 57 additions and 2 deletions
|
@ -46,6 +46,10 @@
|
||||||
phpunit = {
|
phpunit = {
|
||||||
treesitter-parser = "php";
|
treesitter-parser = "php";
|
||||||
};
|
};
|
||||||
|
playwright = {
|
||||||
|
treesitter-parser = "typescript";
|
||||||
|
settingsSuffix = settingsLua: ".adapter(${settingsLua})";
|
||||||
|
};
|
||||||
plenary = {
|
plenary = {
|
||||||
treesitter-parser = "lua";
|
treesitter-parser = "lua";
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,7 +8,10 @@
|
||||||
with lib; let
|
with lib; let
|
||||||
supportedAdapters = import ./adapters-list.nix;
|
supportedAdapters = import ./adapters-list.nix;
|
||||||
|
|
||||||
mkAdapter = name: {treesitter-parser}: {
|
mkAdapter = name: {
|
||||||
|
treesitter-parser,
|
||||||
|
settingsSuffix ? settingsLua: "(${settingsLua})",
|
||||||
|
}: {
|
||||||
options.plugins.neotest.adapters.${name} = {
|
options.plugins.neotest.adapters.${name} = {
|
||||||
enable = mkEnableOption name;
|
enable = mkEnableOption name;
|
||||||
|
|
||||||
|
@ -37,7 +40,7 @@ with lib; let
|
||||||
settingsString =
|
settingsString =
|
||||||
optionalString
|
optionalString
|
||||||
(cfg.settings != {})
|
(cfg.settings != {})
|
||||||
"(${helpers.toLuaObject cfg.settings})";
|
(settingsSuffix (helpers.toLuaObject cfg.settings));
|
||||||
in [
|
in [
|
||||||
"require('neotest-${name}')${settingsString}"
|
"require('neotest-${name}')${settingsString}"
|
||||||
];
|
];
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
minitest.enable = true;
|
minitest.enable = true;
|
||||||
pest.enable = true;
|
pest.enable = true;
|
||||||
phpunit.enable = true;
|
phpunit.enable = true;
|
||||||
|
playwright.enable = true;
|
||||||
plenary.enable = true;
|
plenary.enable = true;
|
||||||
python.enable = true;
|
python.enable = true;
|
||||||
rspec.enable = true;
|
rspec.enable = true;
|
||||||
|
|
47
tests/test-sources/plugins/neotest/playwright.nix
Normal file
47
tests/test-sources/plugins/neotest/playwright.nix
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
{
|
||||||
|
example = {
|
||||||
|
plugins = {
|
||||||
|
treesitter.enable = true;
|
||||||
|
neotest = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
adapters.playwright = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings.options = {
|
||||||
|
persist_project_selection = false;
|
||||||
|
enable_dynamic_test_discovery = false;
|
||||||
|
preset = "none";
|
||||||
|
get_playwright_binary.__raw = ''
|
||||||
|
function()
|
||||||
|
return vim.loop.cwd() + "/node_modules/.bin/playwright"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
get_playwright_config.__raw = ''
|
||||||
|
function()
|
||||||
|
return vim.loop.cwd() + "/playwright.config.ts"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
get_cwd.__raw = ''
|
||||||
|
function()
|
||||||
|
return vim.loop.cwd()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
env = {};
|
||||||
|
extra_args = [];
|
||||||
|
filter_dir.__raw = ''
|
||||||
|
function(name, rel_path, root)
|
||||||
|
return name ~= "node_modules"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
is_test_file.__raw = ''
|
||||||
|
function(file_path)
|
||||||
|
return string.match(file_path, "my-project's-vitest-tests-folder")
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue