How to actually execute tests? (metric-imp converter project)

Hello, I am doing this project where we have to write our own tests and this might sound like a really stupid question, but how do I execute these tests that are written in the tests directory?
I already added a .env file with the necessary "NODE_ENV=“test”’ but other than that I am not sure what to do.
It would also be nice to hear if figuring all of this out is part of the exercise or not, since the course really doesn’t mention that part.
My own project can be found here:
Thanks in advance.

tests are executed by running the file in which you have written your test, like for example in your project the test file with name test-runner.js has to be executed separately to run the test against you node application

Ok, but nothing really happens if I do that.

Hello there,

If NODE_ENV=test is within your .env file, then the tests will automatically run, once the app is started. So, if you are using, then:

  1. Set the environment variable to test
  2. Click on the RUN button, and the console should display the output of the tests.

If you are struggling with the tests, it might be useful to repeat the Quality Assurance and Testing with Chai | section of the curriculum.

Hope this helps.

1 Like

Thanks, your comment was useful as always

Adding, “NODE_ENV=test” was indeed all that needed to be done, but since that’s not really mentioned anywhere and my tests had errors in them, I was quite unsure about it.
I still don’t get why or how the tests run but that doesn’t seem to be point of this exercise or course I think.

Anyway, thanks for your time, problem and project are solved.