xixiaofinland / sf.nvim

17 stars 5 forks source link

run APEX tests with coverage included by default #76

Closed ognjen-vuceljic closed 20 hours ago

ognjen-vuceljic commented 3 weeks ago

@xixiaofinland

Hello,

first of all, many thanks for this amazing plugin! It is really helpful, and it makes Salesforce development so much easier.

I've noticed that APEX test commands from the plugin (run current test from cursor, run all tests from file...) run with no -c(--code-coverage) flag included.

I think that including -c flag (either by default, or as an additional parameter) will be useful, as it can clearly show the necessary coverage details (percentage, uncovered lines...).

There is a cC neovim keymap mentioned in tests.lua file (if I am not mistaken), but since I am a bit new to lua, I didn't quite understand if that means we already have a way to include code coverage details for our APEX tests commands.

Thank you!

xixiaofinland commented 3 weeks ago

@ognjen-vuceljic Thanks for trying this plugin out!

Running tests with coverage was implemented in the past. However, the coverage information often overflowed the window, requiring me to scroll to find the needed details. For clarity, I removed this feature from the plugin.

I'm happy to add them back as an additional keybinding. For example, tt v.s. tT (run current test without or with -c).

This will be a feature to implmenet whenever I get time.

xixiaofinland commented 2 days ago

Added tA and tT for showing code coverage in the test result. Please test. @ognjen-vuceljic

https://github.com/xixiaofinland/sf.nvim/blob/8c3414a7fd1756ec4f8f79782afdaf3d9a903ad3/lua/sf/config.lua#L256

https://github.com/xixiaofinland/sf.nvim/blob/8c3414a7fd1756ec4f8f79782afdaf3d9a903ad3/lua/sf/config.lua#L254

ognjen-vuceljic commented 2 days ago

Thank you very much @xixiaofinland , seems to work pretty well!

One quick question from my side:

image

I'd like to make it a little bit bigger, if possible, as -c parameter shows more details which require scrolling (more details is absolutely fine, just wondering if there is an option to make the floating window bigger).

Thanks for your hard work on this plugin!

xixiaofinland commented 1 day ago

One reason I didn't include code coverage information in the test response is exactly that it tends to be too long to fit into the current small terminal window.

While there is an internal terminal configuration, it is intentionally not exposed or documented. At the moment, you can manually adjust the width and height proportionally.

https://github.com/xixiaofinland/sf.nvim/blob/4733676aa944fc6a31d8b03037c9755de560e81c/lua/sf/term/raw_term.lua#L184

For example, change height from default 0.4 to 0,8, it looks like below. Image 008

Personally I never enjoy the term window too big, but I also understand that users have different needs. It now might make sense to allow the term configuration in the setup. However, this setting will apply to all commands you send to it rather than only "code coverage" ones. Is this ok?

I can make a new change to expose the term setting. There is no harm anyway.

ognjen-vuceljic commented 1 day ago

Thank you @xixiaofinland

This is just my personal preference. I appreciate and understand that different developers can feel differently about term size and functionalities :)

Happy to see this great plugin getting even better!

xixiaofinland commented 20 hours ago

Thank you for submitting the issue to share your feedback. I'll close this now and inform you once the new opened issue is resolved.