Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(typescript): add neotest-jest support #1189

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions lua/astrocommunity/pack/typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This plugin pack does the following:
- Adds [nvim-vtsls](https://github.com/yioneko/nvim-vtsls) for language specific tooling
- Adds [package-info.nvim](https://github.com/vuki656/package-info.nvim) for project package management
- Adds [nvim-lsp-file-operations](https://github.com/antosha417/nvim-lsp-file-operations) to handles file imports on rename or move within neo-tree
- Adds [neotest-jest](https://github.com/nvim-neotest/neotest-jest) to ease the test running if `neotest` is installed

## How do I disable Eslint format on save?

Expand All @@ -26,3 +27,23 @@ return {
},
}
```

## How do I customize `neotest-jest`?

To customize the `neotest-jest` plugin, you need to configure it like you would with any other plugin,
but with a small twist: add a `config` key with an empty function. This step is necessary to prevent
`lazy` from attempting to call a non-existent `require("neotest-jest").setup()` function, as this plugin
doesn’t use that setup method.

> Learn more about the spec setup used by `lazy` [here](https://lazy.folke.io/spec#spec-setup).

```lua
---@type LazySpec
return {
"nvim-neotest/neotest-jest",
config = function() end, -- You need to add this line!
opts = function(_, opts)
-- Add your opts
end,
}
```
mehalter marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 9 additions & 0 deletions lua/astrocommunity/pack/typescript/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,13 @@ return {
},
},
},
{
"nvim-neotest/neotest",
optional = true,
dependencies = { "nvim-neotest/neotest-jest" },
mehalter marked this conversation as resolved.
Show resolved Hide resolved
opts = function(_, opts)
if not opts.adapters then opts.adapters = {} end
table.insert(opts.adapters, require "neotest-jest"(require("astrocore").plugin_opts "neotest-jest"))
end,
},
}
Loading