Several Major Issues: Challenges Not Passing, Dependencies Out of Date, More...
See original GitHub issueDescribe your problem and how to reproduce it:
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:
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)
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
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):
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (5 by maintainers)
Top GitHub Comments
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:
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
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.