Issue tracker tests failing but no console errors/api failures

Issue tracker tests failing and no console errors/api failures.

My code

PFA for failing tests.

I referred to Tests written by fcc to crosscheck my network responses and everything looks fine.

I set test-timeout=7000 ,if the tests are timed out,I should atleast see a console error right,but the console is clean.

Can anyone help me to debug this scenario?
Many thanks!

I forked it and tried the tests. Everything passed except the 14 functional tests, but the browser console (chrome) had an frame-runner.js:98 Error: expected { status: 'unavailable' } to be an array error. I believe it probably has to do with the functional tests (which also pass when run).

The only thing that comes to mind is that you have your test data in a separate file in your test directory and the file test-runner.js tries to load every JS file in that directory as tests for mocha to run and that file does not contain tests. Try just moving the test data into the test file and removing the data file. Maybe.

I moved testData.js from tests/ but still those tests are failing with no console errors!

I used Mongoose in my code - v2 but it still fails with one test and no console errors.

Unfortunately, not all errors will error to the browser console. And they will only be in the server console if you print them there. What I find curious is that every time I run the tests, the following appears in the server console:

> npm run start

> fcc-issue-tracker@1.0.0 start /home/runner/boilerplate-project-issuetracker-2
> node server.js

Listening on port undefined

I changed this part of routes/fcctesting.js

  app.get('/_api/get-tests', cors(), function(req, res, next){
    console.log("over here");
    if(!error && process.env.NODE_ENV === 'test') return next();
    res.json({status: 'unavailable'});

since the unavailable matches the aforementioned browser error and confirmed that this is where the problem lies. Setting process.env.NODE_ENV correctly in the secrets fixed the problem.

Basically, now I have two versions:

Using Mongodb only - Code

It Works for Jeremy:

Thank you @jeremy.a.gray functional tests will also pass if we set NODE_ENV=test.
But I still see the errors when I run .I was not able to figure it out why it is happening.

Failed tests

  • Time to First Byte:
    • GET: max=3.5s
    • PUT: max=3.2s
    • DELETE: max=3.2s
  • It prints nothing in browser console.
  • It prints undefined in server console while fetching tests written by camper.(it’s no issue)

Using Mongoose - Code

Failed tests

  • Time to First Byte:
    • GET : max=1.2s
  • It prints nothing in browser console.
  • It prints undefined in server console same as above.(no worries)

I would like to know the time limit for these tests .
And Any help/next-steps is much appreciated.

So, using your original project, I forked it and all but the functional tests fCC test passed. When I set NODE_ENV secret to test, all fCC tests passed, with the satisfying checkmark and everything. I didn’t change anything else on the project. That was yesterday.

Today, I get the GET error you have in the second version and it times out (everything else passes). I think at this point it’s fairly clear the code works, it just needs to work faster. So you can try to streamline this GET route or you can run your test off hours when fCC, MongoDB, and are not busy (you could use the conveniently scheduled US holiday weekend when everyone here is watching fireworks).

The real kicker is when I try your second project (no fork, just running it), it passes everything (just now). That would seem to indicate something on your end but I could not speculate what that would be and I don’t like the idea anyway (I’m using a recent version of chrome btw).

I would try to refactor things for more efficient lookups and processing and I think that will solve the problem. It could be that your browser is timing out and not the servers.

1 Like

I deployed both projects on Heroku and one with Mongoose passed all tests.
TTFB (Mongoose): max .8s
TTFB (Mongodb): max 3.2s

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.