Hello,
I am doing the Issue Tracker Project, I got a problem that I cannot run the test script by 'npm run test ’ as instructed in the project instruction(I uncomment NODE_ENV in .env file). I am using Glitch for this project, and when I run ‘npm run test’ in the terminal, I will get error message like showed below:
I would appreciate if anyone can have a look and give me a hint about how to correctly run the test script , or tell me if there is any problem with my functional tests,
Hey there. I wonder what is this error is created for? In this part of code let error;
app.get(’/_api/get-tests’, cors(), function(req, res, next){
console.log(error);
if(!error && process.env.NODE_ENV === ‘test’) return next();
res.json({status: ‘unavailable’});
},
I found that the line if(!error && process.env.NODE_ENV === ‘test’) return next(); is the main problem for me to pass Unit and Functional tests on different chalenges (where i always got {status: ‘unavailable’}). But if i just remove the !error from condition, all the tests starts to pass properly. I’m not sure where the problem is.
Well, for me neither actually. But what i found, when i uncomment NODE_ENV=test, i can start tests on Repl.it and it works good, but at the same time i couldn’t pass FCC tests at all, even if i just pass them through before change NODE_ENV. But when i coomen it back, i can pass through FCC tests and cannot pass through Functional tests. And the only way when it works just right is when i remove !error. There somthing happening with api-requests i think, but i don’t know how this error could brake something while its value is always undefined and never changes.