question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Several Major Issues: Challenges Not Passing, Dependencies Out of Date, More...

See original GitHub issue

Describe your problem and how to reproduce it:

Quality Assurance and Testing with Chai - Run Functional Tests using a Headless Browser:

Link: https://www.freecodecamp.org/learn/information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser

Issue 1: Tests not passing (Major)

The Headless Browser challenges are not passing. I tried replacing my code with the Solution on the Hint page, and it’s not working. For some reason, however, “You should assert that the headless browser request succeeded.” is passing. All 29 tests are passing.

Relevant Information

My logs when I run the test: https://gist.github.com/krisb1220/a76a7db2ae66adf3f60ba5caa9bcb097#file-log-txt

My 2_functional_tests.js file: https://gist.github.com/krisb1220/a76a7db2ae66adf3f60ba5caa9bcb097#file-2_functional_tests-js

My project: https://glitch.com/edit/#!/krisb-fcc-information-quality

Issue 2: Outdated Packages (Minor)

Packages are out of date

Quality Assurance and Testing with Chai - Run Functional Tests using a Headless Browser II:

Link: https://www.freecodecamp.org/learn/information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-using-a-headless-browser-ii

Issue 1: Tests not passing (Major)

Same as above; except no tests are passing, even though all tests are passing.

Relevant information:

SEE ABOVE – SAME AS ABOVE.

Exercise Tracker Project

Issue 1: Outdated Mongoose/Mongo (Major)

Mongoose is outdated. It doesn’t allow you to connect using the normal connection method as taught in the cirriculum. The package.json needs to be changed to the following: https://github.com/krisb1220/boilerplate-project-exercisetracker/blob/glitch/package.json

I’ve added a PR to the boilerplate repo that changes the Package.json and fixes this issue. https://github.com/freeCodeCamp/boilerplate-project-exercisetracker/pull/24

Issue 2: Outdated Node Version (Major)

The Node version is heavily outdated. It’s running Node 6. async and await keywords are not able to be used - along with all other ES6 features. I’ve created a Package.json that fixes the issue. I’ve also gone ahead and created an entirely new Glitch template that fixes the issue.

Issue 3: Unclear Instructions 1 (Minor)

Although this isn’t a huge issue, it’s a requirement that the “duration” variable from response after posting to /api/exercise/add is required to be an integer.

Issue 4: Unclear instructions 2 (Minor)

image

The third requirement states that “User object needs to be returned with the added exercise”. This is not the case. From the instructions, it appears that it’s required to return the full user object as you would on the /api/exercise/log page. What needs to be returned is a summary object with the users username, their _id, as well as the exercise data. The returned object should look like the below:

{
"username":"krisb1220",
"_id":"5eba18ae93e4aa5b2434991f",
"description":"coded",
"duration":20,
"date":"Thu May 14 2020"
}

Issue 3: Code breaks server.js (Major)

Also, on the Exercise Tracker project, the following code breaks the server if users do not place their endpoints before it. See my pull request on the boilerplate repo, as I’ve clarified this with comments:


// Not found middleware
app.use((req, res, next) => {
  return next({status: 404, message: 'not found'})
})

// Error Handling middleware
app.use((err, req, res, next) => {
  let errCode, errMessage

  if (err.errors) {
    // mongoose validation error
    errCode = 400 // bad request
    const keys = Object.keys(err.errors)
    // report the first validation error
    errMessage = err.errors[keys[0]].message
  } else {
    // generic or custom error
    errCode = err.status || 500
    errMessage = err.message || 'Internal Server Error'
  }
  res.status(errCode).type('txt')
    .send(errMessage)
})

Fixes

Repo: https://github.com/krisb1220/boilerplate-project-exercisetracker/tree/glitch (NOT MASTER BRANCH, GLITCH BRANCH) — Pull request on the original repo has been submitted

Project Page: https://glitch.com/~freecodecamp-exercise-tracker-project

Project Code Page: https://glitch.com/edit/#!/freecodecamp-exercise-tracker-project

Advanced Node and Express - Implement the Serialization of a Passport User

https://www.freecodecamp.org/learn/information-security-and-quality-assurance/advanced-node-and-express/implement-the-serialization-of-a-passport-user

Issue 1: Deprecated Connection Method (Major)

The MongoDB connection method shown in the instructions has been deprecated. The challenge doesn’t currently pass using the non-deprecated option. I simply used the non-deprecated option to pass the challenge and changed it after, but some users may not realize this is an option.

Proper Connection Method:

const MongoClient = require('mongodb').MongoClient;
const MongoOptions = {useUnifiedTopology: true, useNewUrlParser:true};
const Client = new MongoClient(process.env.DATABASE, MongoOptions);

Client.connect((err, db)=>{
  if(err) console.error(err);
  else console.log("connected to databse");
})

Method Shown (Deprecated, soon to be removed)

mongo.connect(process.env.DATABASE, (err, db) => {
  if(err) {
    console.log('Database error: ' + err);
  } else {
    console.log('Successful database connection');

    //serialization and app.listen
  }
});

Advanced Node and Express - Create New Middleware (MAJOR) [Edited]

Issue 1: Challenge only passes if you change the index.pug template’s <title> attribute to Home Page. Thanks to @magnus195 for pointing this out to me 😃

Tell us about your browser and operating system:

  • Browser Name: Chrome
  • Browser Version: “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36”
  • Operating System: Windows 10

If possible, add a screenshot here (you can drag and drop, png, jpg, gif, etc. in this box):

image

image

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
neenjawcommented, Jun 1, 2020

Just came here to write this issue up as well. This a good summary of the issues I have found with the exercises on glitch, so much that I decided to write them locally and use ngrok to tunnel them externally to be tested.

But to reiterate the biggest points that need some touching up:

  • outdated node version (glitch supports to ver. 12.0.0), node package versions
  • outdated mongo/mongoose connection conventions that don’t align with the mongo atlas URI
    • lots of remnants of the old mlab connection details
  • each boilerplate has lots of extra boilerplate
    • an example is the error handling middleware in the exercise tracker boilerplate.
  • inconsistent boiler plate
    • things are defined in several ways, while this may convey how unopinionated expressjs is, it may be detrimental to students developing a style from reading examples
  • microservice problems are generally poorly specified for return values and format.

I am willing to help with these things if it can be triaged and pointed out where best to contribute by a more senior contributor

0reactions
scissorsneedfoodtoocommented, Aug 24, 2021

All of the points mentioned above, along with some others, should be fixed with the PRs in my last comment.

Thanks again everyone for your valuable feedback, and for helping us improve the backend curriculum.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Ensure That Your Dependencies Are Up to Date
Consequences of keeping outdated dependencies · Security Vulnerabilities · Reduced Performance · Coupled Processes in Apps · Overhead Work · Expanded ...
Read more >
Dependency Management: Why is it important? - Rick's Cloud
Security: One issue with using dependencies is that you'll be exposing your software to vulnerabilities and risks. If you're not constantly ...
Read more >
Best practices for managing Java dependencies - Snyk
In this article, I'll give you some advice and best practices for dealing with Java dependencies in your project.
Read more >
Dependency Management: 3 Tips to Keep You Sane | Mend
Another reason outdated dependencies aren't updated is due to a fear of breaking the build. Dependency management is hard, and applications ...
Read more >
How to Keep Your App Dependencies Up-To-Date?
One aspect of software development is often overlooked: maintaining dependencies. It raises two huge issues: security and performance, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found