Imperial-Metric Converter unit tests timing out

Tell us what’s happening:

When I input npm run test to the console, my tests run as expected, but whenever I use npm start, my test suite times out. Strangely enough, adding logs to the console for each test allows the program to continue iterating through the test suite, but this is obviously a bandaid solution to something more deeper.

How do I fix this? I have no idea what the problem could be.

Your project link(s)

solution: https://replit.com/@noldpaffallaffa/boilerplate-project-metricimpconverter

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36

Challenge: Metric-Imperial Converter

Link to the challenge:

There’s one thing missing in the tests - call to callback function. Take a look at example: https://www.freecodecamp.org/learn/quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http

npm run test runs tests a bit differently than when they are run along server start, so that’s the reason why one is working fine.

1 Like