You're gonna need this if you want to pass "Authentication with Socket.IO" challenge

You're gonna need this if you want to pass "Authentication with Socket.IO" challenge
0

#1

Hi everyone,

If you’re working in this challenge of “Advanced Node and Express”, you need to know something: If you’ve done the challenge, you’re 100% certain it works as expected and the tests keep failing and driving you nuts… You’ve got to “cheat” a little bit. Well, not cheating at all, of course; it’s just there are bugs in the tests’ code at the moment.

  1. passportSocketIo is properly required. You’re expected to require passport.socketio package, but due to a typo in the test, your code won’t pass. So, require the package as you usually do and, somewhere in your server.js, make sure you have this commented line:
    // passportSockerIo = require "passportSocketIo"; (without the parenthesis).
    Passed! :ballot_box_with_check:

  2. passportSocketIo is a dependency. Another typo in this test. Requires a little more work to do.
    2.1. Create a new file in the root directory. Name it whatever you want, like “TO-PASS-TEST-2”.
    2.2. Edit the file with this contents: { "dependencies": {"passportSocketIo": "0.0.0"}}
    2.3. Edit line 66 on freeCodeCamp/fcctesting.js and change the string ‘/package.json’ with ‘/TO-PASS-TEST-2’ or whatever name you gave the file.
    Passed! :ballot_box_with_check:

And the third and last test works fine as long as your code does.

So, as you can see, this is not cheating because the tests won’t pass at the moment. The first one because they forgot adding the parenthesis and the second one because the package name is passport.socketio instead of_passportSocketIo_ . Hopefully, soon you won’t need this fix anymore.

Hope it helps!

Edit: Also, you’re going to need cors as a dependency, require it and use the middleware right before calling fccTesting function. Otherwise you won’t even see the tests, only error error error.


#2

Good sir or ma’am,

Thank you. I love you. FCC is the most incredible free learning resource I have ever encountered on this planet, but at the end of the day they’re just volunteers sharing what they’ve learned so more people benefit. I hope everyone who finds this thread understands that this is the right way to honor those volunteers (and all the ones on the forums that got us through it, and the ones who coded Express and Node and Javascript and all the modules in the first place): When you solve a hard problem first, turn around and share the answer.

(Obviously this solution worked for me).