Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Running Mix test does not run from project root #42

Closed
killtheliterate opened this issue May 26, 2016 · 8 comments
Closed

Running Mix test does not run from project root #42

killtheliterate opened this issue May 26, 2016 · 8 comments

Comments

@killtheliterate
Copy link

Steps to reproduce:

  • Generate a project with mix
  • Open a test file in test
  • Run :Mix test

Expected outcome is the test should run.


I may not be using alchemist.vim right 馃槃, opening this issue to clarify or see if it can be fixed.

@aerosol
Copy link

aerosol commented May 27, 2016

If you open a test file with vim test/foo_test.exs that behaviour is expected. You can use for example vim-rooter if you want to alter the default vim behaviour regarding cwd handling. My 2 cents is this should not be alchemist.vim's concern.

@slashmili
Copy link
Owner

@killtheliterate it works for me, I'm not sure why it doesn't work in your box, can you do something like this with your project and past the response here:

milad@laptop-2 ~/d/ex_guard (master)> ls -l
total 88
...
-rw-r--r--   1 milad  staff  1163 May  3 22:35 mix.exs
-rw-r--r--   1 milad  staff   179 Mar 20 02:26 mix.lock
...
milad@laptop-2 ~/d/ex_guard (master)> vim -c ":Mix test"

...................
error connecting to VAL (No such file or directory)
..
error connecting to VAL (No such file or directory)
.

Finished in 0.1 seconds (0.1s on load, 0.06s on tests)
22 tests, 0 failures

One extra note, Mix command only defined if you don't have any other Mix plugin

@killtheliterate
Copy link
Author

@slashmili I think this may be a problem with netrw or something. If I have a file open that lives in the project root, like mix.exs, then :Mix test runs, no problem. If I then open a file that lives in lib, thats when alchemist mentions that it cannot find a mix file.

If I have mix.exs open, and then use either netrw or :e lib/foo.ex to open another file, :Mix test breaks in that scenario as well.

I'll examine my neovim config to see if there is something thats changing directory on file open.

@slashmili
Copy link
Owner

Could you record the cases that you mention with asciinema.org

@killtheliterate
Copy link
Author

@slashmili
asciicast

@slashmili
Copy link
Owner

I see.

Looks like there is something wrong with your vim settings, I did the same thing here : https://asciinema.org/a/40ob1mhx8dcgwb404xf6k5xkj

@killtheliterate
Copy link
Author

I'll try fiddling around to see if I can get it working as expected. For reference, here is my .vimrc

@killtheliterate
Copy link
Author

Heh, I had set autochdir for... some reason. Removing that makes :Mix test behave as expected.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants