Coder Social home page Coder Social logo

exunit.el's Introduction

exunit

https://melpa.org/packages/exunit-badge.svg

Provides commands to run ExUnit tests. The output is syntax highlighted and stacktraces are navigatable.

Setup

exunit is available in melpa and can be installed via package-install command.

(add-hook 'elixir-mode-hook 'exunit-mode)

;; Optionally configure `transient-default-level' to 5 to show extra switches
;; Or use `C-x l' to change the level of individual commands and switches
(setq transient-default-level 5) ;; default is 4

Currently, 2 extra switches are shown, --exclude and --include.

Commands

KeyboardDescription
C-c , aexunit-verify-all Run all the tests in the current project
C-c , uexunit-verify-all-in-umbrella Run all the tests in the current umbrella project
C-c , vexunit-verify Run all the tests in the current buffer, or the test file corresponding to the current buffer
C-c , sexunit-verify-single Run the test under the point
C-c , rexunit-rerun Re-run the last test invocation
C-c , texunit-toggle-file-and-test Toggle between a file and its tests in the current window
C-c , dexunit-debug Run the test under the point in IEx shell. Supports IEx.pry method for debugging.
C-c , 4 texunit-toggle-file-and-test-other-window Toggle between a file and its tests in other window

Invoking any of these commands with a prefix argument C-u will cause a prompt to be shown for additional arguments before the test(s) are run.

https://raw.githubusercontent.com/ananthakumaran/exunit.el/master/screenshots/sample.png

Run tests in a docker

For example, you can redefine an exunit-mix-command to the following to execute in backend service context:

(setq exunit-mix-command
      (lambda (args)
        (let* ((args (s-join " " args))
               (mix-command (concat "'mix test " args "'")))
          ;; Adjust to your needs
          (list "docker-compose" "exec" "backend" "sh" "-c" mix-command))))

exunit.el's People

Contributors

ananthakumaran avatar astery avatar aymanosman avatar j3rn avatar rranelli avatar smaximov avatar vinikira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

exunit.el's Issues

Add ability to compile and run tests inside Docker container

It would be great to be able to use exunit.el inside a Docker container.

Copying the idea from RSpec Mode, maybe exunit.el could have some parameters (such as exunit-use-docker-when-possible, exunit-docker-container, exunit-docker-command and exunit-docker-cwd) which would essentially turn the test commands prepended by docker exec -it <exunit-docker-container> bash -c "cd <exunit-docker-cwd> && <command_to_run_test> ".

What do you think?

Missing font face definitions from Alchemist, maybe port them in?

When using doom-themes, I was hitting an issue where the compilation buffer output was difficult to read. I was going to customize the font-lock values in the compilation buffer, but it appears that the buffer does not have any defined.

Looking at alchemist.el's implementation, it looks like it had several faces defined.

I am not an expert on defface and all that, so please correct me if I am mistaken on my approach to customizing the output.

Example

Screen Shot 2021-05-17 at 09 10 03

Screen Shot 2021-05-17 at 09 25 31

Stop the cursor from going purple when tests are run

In my environment with Spacemacs when I run the test, for example with exunit-verify the cursor turns purple. This seems to be related to the evil-mode state changing, but I'm not sure what is triggering that. Possibly something with the read-only trigger? Is there a way to stop the cursor/state from changing?

Add ability to re-run last test

It would be really nice to have a command like exunit-verify-rerun-last-test that would re-run the last test that was ran. Ideally for me this would re-run it from the same directory that it ran from previously and would be projectile aware (although that might be overkill).

Thanks for this project! It's very helpful.

ExUnit can't find the right Elixir install

I've got exunit.el installed in my emacs via DOOM and I'm having this issue every time I try to run the tests (or iex for that matter) in any buffer.

-*- mode: exunit-compilation; default-directory: "~/src/api/" -*-
ExUnit Compilation started at Thu Jun 23 11:16:36

mix test test/api/data/kafka_producer_test.exs
Could not start Hex. Try fetching a new version with "mix local.hex" or uninstalling it with "mix archive.uninstall hex.ez"
** (MatchError) no match of right hand side value: {:error, {:ssl, {'no such file or directory', 'ssl.app'}}}
    (hex 1.0.1) lib/hex.ex:5: Hex.start/0
    (mix 1.13.3) lib/mix/hex.ex:59: Mix.Hex.start/0
    (mix 1.13.3) lib/mix/dep/loader.ex:194: Mix.Dep.Loader.with_scm_and_app/4
    (mix 1.13.3) lib/mix/dep/loader.ex:147: Mix.Dep.Loader.to_dep/3
    (elixir 1.13.3) lib/enum.ex:1593: Enum."-map/2-lists^map/1-0-"/2
    (mix 1.13.3) lib/mix/dep/loader.ex:364: Mix.Dep.Loader.mix_children/2
    (mix 1.13.3) lib/mix/dep/loader.ex:18: Mix.Dep.Loader.children/0
    (mix 1.13.3) lib/mix/dep/converger.ex:57: Mix.Dep.Converger.all/4

ExUnit Compilation exited abnormally with code 1 at Thu Jun 23 11:16:37

This seems to me that exunit.el is not running in the context of the right shell (or maybe is being compiled without my shell env?) However, when I open eshell and run commands like elixir -v, iex -S mix, or mix test everything works just fine. Running (exunit-project-root) from eshell returns the right directory.

I'm sorta new to emacs so please let me know if I'm doing something horribly wrong or if this isn't the right way to go about solving this issue. Thank you for the package!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.