Run and Debug TypeScript Unit Tests in Neovim

  Рет қаралды 18,004

Elijah Manor

Elijah Manor

Күн бұрын

In this video I show how to take LazyVim as a starting point and add support to run Jest and Vitest unit tests inside of Neovim with neotest. Then I add more config to support debugging a unit test.
You can find the config that I added in the following gist
gist.github.com/elijahmanor/b...
If you liked this video, please like and subscribe for further content.
You can also join as a member of this channel for special perks youtube.com/@elijahmanor/join
If you'd like to connect on social media, you can find me on Twitter / elijahmanor and Mastodon hachyderm.io/@elijahmanor and Bluesky bsky.app/profile/elijahmanor.com
00:00 Introduction
00:11 Add Jest Support
04:40 Add Vitest Support
06:00 Adding Debugging
08:44 Conclusion
#neovim #lazyvim #unittesting #debugging #jest #vitest

Пікірлер: 80
@ElijahManor
@ElijahManor 11 ай бұрын
You can find the config that I added in the following gist gist.github.com/elijahmanor/bac05af95e1536d88a43cbfcb66c1c1d If you liked this video, please like and subscribe for further content. You can also join as a member of this channel for special perks youtube.com/@elijahmanor/join If you'd like to connect on social media, you can find me on Twitter twitter.com/elijahmanor and Mastodon hachyderm.io/@elijahmanor and Bluesky bsky.app/profile/elijahmanor.com
@alextz4307
@alextz4307 7 ай бұрын
The gist seems not to be working. Every time I try to run `tr` inside a jest test I get the following error: E5108: Error executing lua: attempt to index field 'run' (a nil value)
@ascourter
@ascourter 11 ай бұрын
Great video! It makes a huge difference to see those test outputs in your editor instead of a separate terminal window.
@ElijahManor
@ElijahManor 11 ай бұрын
Yes it does! Thanks man
@MrRollhax
@MrRollhax 8 ай бұрын
Man, I was struggling to wrap my head around neovim config. Your videos have helped a ton. Thank you for all of these - I'm enjoying coding and tinkering again like I haven't since I was 14.
@ElijahManor
@ElijahManor 8 ай бұрын
YAY, glad my videos have helped some. Glad you are tinkering, I sure love being technical and making things. Thanks for sharing
@IainSimmons
@IainSimmons 11 ай бұрын
This is awesome, been waiting for it for a while. It was certainly worth the wait! Some part of me wished for a happy ending where you fixed the test and everything passed though! 😅
@ElijahManor
@ElijahManor 11 ай бұрын
You and me both! I didn't notice that until way after I recorded things and was well into the editing process. Oh well ;) Leaves some to the imagination I guess ha ha
@ErmandDurro
@ErmandDurro 11 ай бұрын
Great content as always. Love it that you included the debugging part as well 😀
@ElijahManor
@ElijahManor 11 ай бұрын
Yay, glad you liked it! And thanks as always for stopping by!
@macmanuelodumeru3708
@macmanuelodumeru3708 11 ай бұрын
Finally, Awesome as usual 🔥🔥🔥 I wonder what's up next
@ElijahManor
@ElijahManor 11 ай бұрын
As you might have noticed. I might switch things up a bit and try something a bit different, but still in the terminal world. Stay tuned :)
@theherk
@theherk 9 ай бұрын
These videos are superb. Very helpful. Instant sub.
@ducbinhpham3215
@ducbinhpham3215 11 ай бұрын
I've been waiting for this, thanks so much ^^
@ElijahManor
@ElijahManor 11 ай бұрын
You're very welcome!
@gustavofsantos
@gustavofsantos 11 ай бұрын
Thank you for this fantastic content!
@ElijahManor
@ElijahManor 11 ай бұрын
Glad you enjoy it!
@crowvampire
@crowvampire 4 ай бұрын
Great tool to debugging, usually I used vimspector until now, I will replaced by this haha, thank you for sharing 👍🏻
@sockthedev4904
@sockthedev4904 11 ай бұрын
Love your work 💜
@ElijahManor
@ElijahManor 11 ай бұрын
Thank you and for being a repeat viewer! 😊
@filipebraganca2558
@filipebraganca2558 11 ай бұрын
Nice way to debug!!! Thanks for sharing
@ElijahManor
@ElijahManor 11 ай бұрын
You bet! Thanks for watching and supporting with repeat visits :)
@kiyov09
@kiyov09 11 ай бұрын
Very good, as always! 🔥
@ElijahManor
@ElijahManor 11 ай бұрын
Thanks for coming back 🔥
@kiyov09
@kiyov09 11 ай бұрын
@@ElijahManor always man, your videos are gold.
@celsopatiri2846
@celsopatiri2846 11 ай бұрын
Awesome content
@ElijahManor
@ElijahManor 11 ай бұрын
Thank you so much! Glad you found value in it
@gugahoi
@gugahoi 11 ай бұрын
Thanks for sharing this video, neotest and the jest adapter are great. I was really hoping you'd cover the "watch" mode that neotest has. I have been unable to get that setup with the jest adapter unfortunately but I just feel like it's a superior workflow when you get instant test feedback that runs on save. Theoretically, neotest uses treesitter to work out impacted files and should run tests related to them but alas I have not been able to get it to work myself. Maybe you can give that a shot and if you're successful, a video would be incredibly useful!
@ElijahManor
@ElijahManor 11 ай бұрын
I did have it set up to do watch mode, but as you described it didn't seem to work as I expected it should. It would seem to know when a test was changed, but it would get confused as to which item needed the update. So, I decided to cut that from this video since it wasn't consistent, but yes, it would be nice to figure that out. I haven't yet
@prashanthshetty8337
@prashanthshetty8337 10 ай бұрын
Thank you! great video, what font is that you are using?
@andrewc8125
@andrewc8125 11 ай бұрын
Wow very nice!!
@ElijahManor
@ElijahManor 11 ай бұрын
Thank you! 😊
@underlog
@underlog 11 ай бұрын
Thanks!
@ElijahManor
@ElijahManor 11 ай бұрын
Oh wow, thank you so much!
@oloja__
@oloja__ 11 ай бұрын
nice tips right here. how’d you get the nodejs icon though
@djbessel
@djbessel 5 ай бұрын
This really helped me set up debugging in LazyVim, including tests and other node applications I can attach to. I'm still puzzled how to launch Chrome and debug frontend stuff, though. I can't get LazyVim to work with nvim-dap-vscode-js, and I'm wondering why it seems to set up adapters on its own instead of leveraging that plugin.
@brittager
@brittager 8 ай бұрын
Wonderful. Would it possible to also provide the link to the Github repo of the project you're using for the demos? If the project is not confidential. Because when you say "let's go to our ... (tailwind, typescript) project, people might not have a project fitting that requirement, thus making it harder to follow along. Just a suggestion for something to add to the description below the videos. Keep up the magnificent work
@raulvargasmunoz1314
@raulvargasmunoz1314 3 ай бұрын
Is it possible to only use the lazyvim.plugins.extras.test.core without install everything else? Great video btw.
@ducbinhpham3215
@ducbinhpham3215 11 ай бұрын
Hi, after an hour of modifying the config to accommodate for my big monorepo, I went to lunch thinking it probably won't work, I came back from lunch and It's working now, thanks you so so much. Now that I've got used to neovim, it''s hard to come back to vscode again because I keep having to reach for the mouse 🤣🤣🤣🤣
@ducbinhpham3215
@ducbinhpham3215 11 ай бұрын
I also called up my college to show what a dope setup I'm having hahaha 🤣🤣🤣
@ElijahManor
@ElijahManor 11 ай бұрын
Yay, that is awesome. Glad it worked out for you!
@ElijahManor
@ElijahManor 11 ай бұрын
Even cooler showing your setup with friends!
@VovaY
@VovaY 11 ай бұрын
Elijah, 🚀💪
@ElijahManor
@ElijahManor 11 ай бұрын
Thanks man! Good to see you again :)
@nikolica9999
@nikolica9999 11 ай бұрын
🎉
@ElijahManor
@ElijahManor 11 ай бұрын
Yay, thanks!
@bibblebabl
@bibblebabl 11 ай бұрын
Hey! Thanks for the video! Could you please remind what is the best reason to migrate to Neovim? What are the advantages of using it in comparison with VSCode e.g?
@rodrigomeireles5966
@rodrigomeireles5966 11 ай бұрын
Major point is it is highly customizable and offers first class support to modal editing. But at the end of the day VSCode has a lot of convenience built around and even an vim motions extension so it comes down to preference.
@npradeeptha
@npradeeptha 11 ай бұрын
Besides modal editing and based keybindings on the home row, one of the major reasons I switched was speed. Neovim is silly fast. It opens up instantly. If it gets into a bad state all it takes is like 2 seconds to close and re-open and ql to open up your last session. VS code on the other hand takes time based on all the plugins you have installed or configured and can get very sluggish if your machine is light on resources.
@ElijahManor
@ElijahManor 11 ай бұрын
Great question. I like the thoughts that TJ put together about developing your own PDE (Personal Development Environment). He has a video describing why one might want to use Neovim when there are plenty of other options around kzfaq.info/get/bejne/h7OGfK2ZqJ-6lZs.html
@npradeeptha
@npradeeptha 11 ай бұрын
@@ElijahManor This is a great reference video I haven't seen before. I am going to bookmark it and share when someone asks this question :)
@germansoto7107
@germansoto7107 11 ай бұрын
hi! could you make a video for setting up lazyvim to use java along with nvim dap? im having a lot of troubles setting it up
@Petar-...-Nikov
@Petar-...-Nikov 11 ай бұрын
Great content could you show similar for Rust setup and testing
@user-eg2jx8be9b
@user-eg2jx8be9b 9 ай бұрын
Thanks for this video ! i followed the steps one by one and when i debug (nearest) i get a DAP error. "Couldn't connect to localhost:{port} ECONNREFUESD" what am i missing?
@AngelDuranReynoso
@AngelDuranReynoso 8 ай бұрын
same problem, any solution?
@AngelDuranReynoso
@AngelDuranReynoso 8 ай бұрын
I tried exactly the same nvim configuration in a diff computer, and different project, and now it worked perfectly, tomorrow I will review environment packages versions and project configuration and see what is exactly the issue, stay tuned
@DimasCyriaco
@DimasCyriaco 6 ай бұрын
same problem here
@trancongminh2628
@trancongminh2628 3 ай бұрын
I'm really appreciate if there is any a kind of vim typescript nodejs debug config video?
@anjanshomodder6463
@anjanshomodder6463 11 ай бұрын
what plugin are you using for running nvim commands? 1:16
@ElijahManor
@ElijahManor 11 ай бұрын
That is the noice plugin github.com/folke/noice.nvim
@muhammadaneeqasif572
@muhammadaneeqasif572 11 ай бұрын
sir which font are you using
@ElijahManor
@ElijahManor 11 ай бұрын
I'm a big fan of the JetBrains Mono font!
@joaomarcos7545
@joaomarcos7545 3 ай бұрын
What is those all? 0:25 I don't have this and can't find anything about it
@brittager
@brittager 8 ай бұрын
There are some things I do no understand from the video. What do the following neotest-jest options do? ``` jestCommand = "npm test --", // why do we need the double dash ? jestConfigFile = "custom.jest.config.ts", // where do I find this file? What is it? What if I don't have it? env = { CI = true }, ```
@emko333
@emko333 11 ай бұрын
is it possible to do a conditional break point?
@ElijahManor
@ElijahManor 11 ай бұрын
The set_breakpoint method supports an optional condition that you can use... github.com/mfussenegger/nvim-dap/blob/master/doc/dap.txt#L684 You might do something like this... map({ "n", "dbc", ":lua require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: '))" })
@LinuxForLife
@LinuxForLife 11 ай бұрын
Already use it with Rust, Go and Astro-nvim but can't make it work with jest/typescript ... 😞😞😞
@LinkEX
@LinkEX 11 ай бұрын
You mean NeoVim, or the LazyVim setup in particular?
@LinuxForLife
@LinuxForLife 11 ай бұрын
@@LinkEX I work with Astro-Nvim and it already uses Lazy package. The setup seems OK ( no error reported) but nothing happen whe I use it or it shows "No test found" ...
@muhammadaneeqasif572
@muhammadaneeqasif572 11 ай бұрын
sir what font are you using
@ElijahManor
@ElijahManor 11 ай бұрын
Big JetBrains Mono fan! github.com/elijahmanor/dotfiles/blob/master/wezterm/.wezterm.lua#L14 github.com/elijahmanor/dotfiles/blob/master/kitty/.config/kitty/kitty.conf#L1 github.com/elijahmanor/dotfiles/blob/master/alacritty/.config/alacritty/alacritty.yml#L118 I have a video about Nerd Fonts if you are curious kzfaq.info/get/bejne/o7eUdcKcrd--nmw.html
@muzzamilraza3793
@muzzamilraza3793 10 ай бұрын
Make a video specifically for javascript debugging using node2 debugger
@Hackme-sf9lp
@Hackme-sf9lp 10 ай бұрын
Plz make a video on lazyvim copilot
@ElijahManor
@ElijahManor 10 ай бұрын
LazyVim now provides a extra import that sets up Copilot. In your `lua/config/lazy.lua` file, you can include the following import... require("lazy").setup({ spec = { { "LazyVim/LazyVim", import = "lazyvim.plugins" }, { import = "lazyvim.plugins.extras.coding.copilot" }, { import = "plugins" }, }, })
@brianfiszman3179
@brianfiszman3179 3 ай бұрын
i wish it was that straight forward but the neotest plugin SUCKS. I spent days trying different configurations and I go from one issue to the next. My biggest gripe right now are the false positives. It shows you that the test failed while the logs shows different. I fucking hated it with passion, I understand that its vim and that in a POSIX environment you are supposed to fix it yourself but why cant I just get to enjoy it instead of having to go back to VSCode to get my job done???
@jtucker87
@jtucker87 8 ай бұрын
Can you do this but for neotest-dotnet? I got it to kind of work for full files but not for running locally. No idea what I'm missing, the docs don't seems to mention anything else I need to add.
@AbdurrahmanHafez
@AbdurrahmanHafez 4 ай бұрын
Great video it worked with me in .spec.ts files but didn't work for .spec.tsx files .. any advice ?
@inteliconn995
@inteliconn995 11 ай бұрын
Thanks!
@ElijahManor
@ElijahManor 11 ай бұрын
No problem!
Zero to IDE with LazyVim
16:59
Elijah Manor
Рет қаралды 264 М.
From Vim To Zed
19:03
ThePrimeTime
Рет қаралды 199 М.
When Steve And His Dog Don'T Give Away To Each Other 😂️
00:21
BigSchool
Рет қаралды 11 МЛН
I Need Your Help..
00:33
Stokes Twins
Рет қаралды 160 МЛН
ХОТЯ БЫ КИНОДА 2 - официальный фильм
1:35:34
ХОТЯ БЫ В КИНО
Рет қаралды 2,8 МЛН
когда достали одноклассники!
00:49
БРУНО
Рет қаралды 4,1 МЛН
The HIDDEN Git Trick for Resolving Merge Conflicts
8:48
DevOps Toolbox
Рет қаралды 17 М.
DEBUG in Neovim. Like a BOSS.
9:44
DevOps Toolbox
Рет қаралды 45 М.
My Forever Dev Workflow
16:02
typecraft
Рет қаралды 64 М.
The Ultimate Database Control. Right WITHIN NEOVIM
9:35
DevOps Toolbox
Рет қаралды 50 М.
What the hell is Zellij?
8:00
typecraft
Рет қаралды 56 М.
Why I Cant Stand IDE's After Using VIM | Prime Reacts
17:51
ThePrimeTime
Рет қаралды 260 М.
simple neovim debugging setup (in 10 minutes)
9:36
TJ DeVries
Рет қаралды 22 М.
LazyVim: Linting and Formatting
9:26
Elijah Manor
Рет қаралды 39 М.
Why Neovim nerds are so obsessed with the terminal
6:44
Joshua Morony
Рет қаралды 73 М.
A UX Expert Fixes My Tmux
6:58
DevOps Toolbox
Рет қаралды 65 М.
How charged your battery?
0:14
V.A. show / Магика
Рет қаралды 3,8 МЛН
Apple watch hidden camera
0:34
_vector_
Рет қаралды 56 МЛН
Где раздвижные смартфоны ?
0:49
Не шарю!
Рет қаралды 580 М.