avli / clojureVSCode

Clojure support for Visual Studio Code
https://avli.github.io/clojureVSCode/
MIT License
204 stars 34 forks source link

Add test results UI #104

Closed marcomorain closed 6 years ago

marcomorain commented 6 years ago

This PR add a test results window to the UI, and a new command to the command pallet to test the current namespace.

There is a lot of clean-up that needs to happen, but I wanted to open the PR to share what I have so far, if anyone else wants to help out.

This uses the new test UI added in the April release of VSCode.

cider_tests

avli commented 6 years ago

@marcomorain this is awesome – I know this feature is long awaited by many people! I'm gonna check the PR out soon and share some feedback. Also feel free to notify me as soon as you consider the feature to be production ready.

marcomorain commented 6 years ago

Thanks. The code is all written in the wrong file right now - it should come out into its own file ideally.

I’ve found it hard to find docs for the test commands in cider-nrepl.

marcomorain commented 6 years ago

@avli could you have a look at this and tell me what you think?

Current items that I think we could do:

  1. Add custom icons for the Test View for Namespace and Vars (pass or fail).
  2. We could show some sort of output under the vars in the tree view.
  3. When you run test the current namespace should we eval it first, and then test it?

At present though, I think this adds enough value to be useful as-is.

avli commented 6 years ago

@marcomorain sure I'll take a close look this week and share my thoughts with you then – don't want to haste for these changes are quite important.

avli commented 6 years ago

@marcomorain I've played a bit with this PR – so far so good 👍 Here are a few things I noticed:

  1. The extension doesn't discover new tests. I was ought to eval a test file first in order to make fresh tests to be discovered.
  2. When I click on a test name on the sidebar I'm not taken to the test implementation. Not sure if it is possible to do using the VSCode API.

Will proceed tomorrow.

marcomorain commented 6 years ago

No rush at all. Like you said, it’s important.

avli commented 6 years ago

@marcomorain I've played with the changes from this pull request for some time – everything looks good to me. One question: have you thought about making test results clickable, e.g. clicking a result jumps you to the test definition?

marcomorain commented 6 years ago

I’m going to install this now and check it out 👍

I’ll make test results clickable if you didn’t already.

avli commented 6 years ago

Yup, the version with unit test integration is in the marketplace :-)

By the way, I have checked the new VSCode API and TreeDataProvider in particular. It seems like there is no way right now to make elements clickable. I have also checked some other language extensions and they don't seem to provide this functionality eighter.

@marcomorain thank you for your efforts. It's a huge commitment and a big step forward for the extension.

marcomorain commented 6 years ago

You are very welcome

ToniIltanen commented 5 years ago

The test view container is not visible on the latest version of vscode, is this a known bug? An example with default lein new app foobar on the newest version of vscode. Also, when running "Clojure: Run all tests" - command, no tests are runned. Lein test works as it should.

image