Tell us what’s happening:
Hi,
I can pass all the tests using Replit, however i can’t pass functional_tests on local. it keeps giving me the error :
Uncaught AssertionError: expected 404 to equal 200
+ expected - actual
-404
+200
I inserted a “console.log(req)” into some of my routes in api.js. And I realized functional_tests are not hitting them. I moved my code into Replit, and it worked. I’ve completed and passed the challenge 100%. I had pushed it then I pulled my work from git into my VS Code enviroment. I touched nothing. The work passing on the Replit, still gives the same error on local. The same error for all the tests :
The current situation is:
If I make “NODE_ENV=test”, my Replit app doesn’t answer to even GET ‘/’ request.
If I remove “NODE_ENV=test”, then the Replit app works but no functional_tests as you can guess.
Ok, thanks, that works.
One point, which may be irrelevant to the issue you’re having, is that you have a sample.env file. In replit, you should store your environment variables in your secrets tab and ditch the sample.env file.
If you want to stop tests from running, it’s easier just to change the value of NODE_ENV to something different (e.g. testicles).
I’ll have a look and see if I can spot anything else which might be causing you issues, but change that first and see if it makes any difference.
I did it, I did it at the beginning. sample.env is irrelevant, nothing is using it, it just stays there. I have .env on my local environment and I have “secrets” in Replit.
Also, without .env file which has the DB string, nothing would work. My app passes everything except the functional_tests. Functional tests are not hitting the routes of my api.js.
Yes, I did it. I do it all the time. You don’t see it because it’s in .gitignore. It’s “.env” having DB=… and NODE_ENV=test. It is referenced in the source code as “process.env.key_name”. I’m saying you my app is passing all the tests, but the last test(functional_tests). It wouldn’t pass those tests if I had no DB string in .env file.