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

Run ExUnit and Espec at the same time #299

Open
lorenzosinisi opened this issue Jun 10, 2020 · 6 comments
Open

Run ExUnit and Espec at the same time #299

lorenzosinisi opened this issue Jun 10, 2020 · 6 comments

Comments

@lorenzosinisi
Copy link

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
Copy link
Owner

antonmi commented Jun 10, 2020

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
Copy link
Author

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

@alec-c4
Copy link

alec-c4 commented Jan 19, 2023

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

@antonmi
Copy link
Owner

antonmi commented Jan 20, 2023

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
Copy link

alec-c4 commented Jan 20, 2023

@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
Copy link
Owner

antonmi commented Jan 20, 2023

@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

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

No branches or pull requests

3 participants