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

Handle the unknown-op status from test commands. #1365

Merged
merged 1 commit into from
Nov 12, 2021

Conversation

marcomorain
Copy link
Contributor

Calva currently fails silently when the test commands fail due to the
unknown-op status. Here we handle that error and show a warning message
when it occurs. This doesn't address the root cause of the issue, but it
will help users to understand the problem.

This will help to debug #1269

Ping @PEZ, @bpringe

@marcomorain marcomorain force-pushed the better-test-error-handling branch from 8762921 to 76491bd Compare October 27, 2021 11:40
@marcomorain
Copy link
Contributor Author

image

@marcomorain
Copy link
Contributor Author

This PR needs work before it can be merged – when the test command fails the new REPL prompt is not printed (as seen in the screenshot)

@marcomorain
Copy link
Contributor Author

Aha, the calls to await session.test will throw, which jumps over the call to outputWindow.appendPrompt()

@marcomorain marcomorain force-pushed the better-test-error-handling branch from 76491bd to 6cb9ea7 Compare October 27, 2021 19:15
@marcomorain
Copy link
Contributor Author

@PEZ this should be good to review now.

@marcomorain
Copy link
Contributor Author

image

I've moved the error message into the REPL output, rather than the VS Code warning pane.

@PEZ
Copy link
Collaborator

PEZ commented Oct 27, 2021

Thanks!

LGTM. Have you had a look, @bpringe?

@bpringe
Copy link
Member

bpringe commented Oct 28, 2021

@marcomorain Thanks for this PR.

I installed the vsix and when I run this simple test using the Run Current Test command the repl seems to either freeze or stop printing things.

(ns test-lein.core-test
  (:require [clojure.test :as test]
            [test-lein.core :refer :all]))

(test/deftest a-test
  (test/testing "Some test"
    (test/is (= 1 1))))

I just get this message with nothing else:

; Running test: a-test…

Then I can't evaluate anything else, even if I run the command to interrupt evaluations. At least, I'm not seeing any results printed. Using the latest Calva version, this scenario works as expected.

@marcomorain
Copy link
Contributor Author

@bpringe thanks for that – I was only testing the negative case when I was running this, and never tested actually running tests 🤦

Is there a way to run a test like yours in CI?

@marcomorain marcomorain force-pushed the better-test-error-handling branch from 6cb9ea7 to 5c844d2 Compare October 28, 2021 20:36
Calva currently fails silently when the test commands fail due to the
unknown-op status. Here we handle that error and show a warning message
when it occurs. This doesn't address the root cause of the issue, but it
will help users to understand the problem.

This will help to debug BetterThanTomorrow#1269
@marcomorain marcomorain force-pushed the better-test-error-handling branch from 5c844d2 to 0ab7fd8 Compare October 28, 2021 20:42
@marcomorain
Copy link
Contributor Author

This is ready for review again 🙏

@bpringe
Copy link
Member

bpringe commented Oct 29, 2021

Is there a way to run a test like yours in CI?

What do you mean, exactly?

I tested the VSIX and it seems good to me!

@marcomorain
Copy link
Contributor Author

marcomorain commented Oct 29, 2021

What do you mean, exactly?

I mean, is there a way that we write an integration test of that starts Calva, connects to a REPL server, evaluates some source, and runs a test?

@bpringe
Copy link
Member

bpringe commented Oct 30, 2021

@marcomorain Oh, it may be possible. I'm not sure how easy it would be to involve a repl in integration tests, though.

@PEZ
Copy link
Collaborator

PEZ commented Nov 12, 2021

It would be a super awesome addition to be able to run tests like those in CI! Please open an issue about it. And a PR is of course super duper welcome. We have an integration test setup that we run in CI. It only starts VS Code and checks that Calva loads. (Or some such). That's where we would hook this test in, most probably.

@PEZ PEZ merged commit 6056c63 into BetterThanTomorrow:dev Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants