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

Load file command not loading changes since last file save on Windows #975

Closed
eu400000 opened this issue Jan 21, 2021 · 7 comments
Closed
Labels
bug Something isn't working evaluation

Comments

@eu400000
Copy link

-> Running a changed test (also for the other test commands) requires the .clj file with the tests to be saved before the updated test is recognized

Repro steps:

lein new app calva-test
Goto VSC and start the repl
"Run tests in current namespace" to run the default test
Changes the default test in core_test.clj (like change the 1 in a 2)
"Run tests in current namespace" to run the default test
-> test is still the old test

PS: The other command to run the test produce the same results.

As bringe indicated, a save should not be required.


dangercoder Yesterday at 3:38 PM
Does anyone else have issues with running tests through "Run tests in current namespace"? When I redefine my tests, calva doesn't understand that they have been updated.

8 replies

dangercoder 1 day ago
I also tried to reload the whole shebangs into the repl.
If I run the tests through the repl without Calva, things works fine though 🙂

bringe 1 day ago
Please create an issue with repro steps. I've not experienced this myself, but maybe it's a particular case, or something has broken.
👍
1

Eric Uitbeijerse 24 hours ago
@Dangercoder It still works fine for me, but I do have to save all the files after I update the tests (Ctrl-K S)

bringe 19 hours ago
It shouldn't require a file save, if it does there is a bug. For me, I can run a failing test, make it pass, not save the file, "run tests in current namespace" and it passes. (edited)

Eric Uitbeijerse 12 hours ago
Would be nice if it does not require a file save, that would save some time. I'll have another look at it later on and report back.
👍
1

dangercoder 2 hours ago
Tests understands the updates when I save the file manually

dangercoder 2 hours ago
Thanks for the tip @eric Uitbeijerse

bringe 1 hour ago
A save is not supposed to be necessary since the test command reloads the file, and is not necessary for me. An issue would be appreciated.

@Dangercoder
Copy link

Having the same issue, I haven't tried it on OSX yet.

Additional Context
Calva: Version 2.0.152
OS: Windows - Version 10.0.18363 Build 18363
The tests are written using clojure.test .
Works fine if I manually save the file or run the tests from the REPL.

@bpringe
Copy link
Member

bpringe commented Jan 22, 2021

@eu400000 You experienced this issue on Windows as well, correct?

@eu400000
Copy link
Author

@bpringe , correct (and sorry the late reply, I'm new to github and just noticed that these messages go to the wronf e-mail address).

@bpringe
Copy link
Member

bpringe commented Feb 1, 2021

Interesting thing I found: This actually seems to be an issue with the load-file command, at least on Windows. Before tests are run, the test ns is loaded in order to get the latest version of the tests. This seems to work on Linux. On Windows, I noticed that if you change any code in any ns, then load the file without saving it, then evaluate the changed code, you won't see the new changes.

With the below code in the core.clj file in a new lein app on Windows:

(def x "pass")

(comment
  x)

If x is defined as "pass" then I change it to "fail", run the load file command without saving the file, then evaluate x again, it still says "pass".

@PEZ, I'm going to look more into this, just pinging you in case you know off hand why this happens. I'm guessing this is a regression, but no telling how long it's been doing this.

@bpringe
Copy link
Member

bpringe commented Feb 1, 2021

Found the issue - it's a uri matching problem here:

const doc = vscode.workspace.textDocuments.find(document => document.uri.path === uri);

I'll fix it soon 😃.

@bpringe bpringe mentioned this issue Feb 1, 2021
23 tasks
@bpringe bpringe changed the title Run tests requires the.clj file with the test to be save before changes are recognized Load file command not loading changes since last file save on Windows Feb 1, 2021
@eu400000
Copy link
Author

eu400000 commented Feb 2, 2021

Aha, so I guess this also removes the need to save any changes in a .clj file before using 'Evaluate Current Form' Ctrl+Enter on Windows (I thought that was just a 'feature'). That will save some more clicks :-)

@bpringe
Copy link
Member

bpringe commented Feb 2, 2021

I was not aware that command was affected in this was as well, but hopefully this fixes it if so. 😄 FYI - there's also the setting "Eval on Save" which will evaluate the file on save. I used to use it but don't any more. You may find it useful though.

@PEZ PEZ closed this as completed in 1bc9b2d Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working evaluation
Projects
None yet
Development

No branches or pull requests

3 participants