antonmi / espec

Elixir Behaviour Driven Development
Other
808 stars 62 forks source link

Run ExUnit and Espec at the same time #299

Open lorenzosinisi opened 4 years ago

lorenzosinisi commented 4 years ago

Hello @antonmi , what is the best way to run ExUnit tests with an app that also has espec files?

I am trying to figure it out because I am working on an application which has one exunit file (an planning to add more) and some espec files. What is the best way to configure and run them both? or even with different commands?

I tried the following:

mix cmd --app app_name mix test file_name_test.exs but of course no success as it compains about ExUnit not being started

antonmi commented 4 years ago

Hey @lorenzosinisi ! ESpec itself also has both exunit and espec tests. What I do (locally and in CI) is just running two commands: ‘mix test’ and ‘mix espec’. See ‘.travis.yml’ file.

lorenzosinisi commented 4 years ago

aright, thank you :) I was looking for a way to run both but maybe an alias would do the trick here

alec-c4 commented 1 year ago

Hey @antonmi! Is it possible to replace exunit with espec?

antonmi commented 1 year ago

Hey @alec-c4 ! Not sure, if I got your question. ESpec is an alternative test framework for Elixir. You can rewrite your tests using ESpec. You can do the transition gradually, using both exunit and espec.

alec-c4 commented 1 year ago

@antonmi I'll try to explain. If you've worked with Ruby on Rails before, you maybe know that you can create an application with key

  -T, [--skip-test], [--no-skip-test]                        # Skip test files

Which allows you to create app without tests, then use rspec with. Unfortunately, there are no similar option in Phoenix, so we are unable to create project without ex_unit and to use espec instead. That's why I'm askin' 'bout complete replacement of exunit with espec

antonmi commented 1 year ago

@alec-c4 ! Got it. Yeah, phoenix creates default configs for ExUnit, however it doesn't force you to use ExUnit. Just delete test folder and setup ESpec