Set up the Environment Challenge failing

Tell us what’s happening:
None of the tests are passing. I pulled up the assertions for this challenge, and it looks like it should be passing all four. Here are a list of the assertions:


  1. text: Socket.IO is a dependency
    • testString: getUserInput => $.get(getUserInput('url')+ '/_api/package.json') .then(data => { var packJson = JSON.parse(data);, '', 'Your project should list "" as a dependency'); }, xhr => { throw new Error(xhr.statusText); })
  2. text: You should correctly require and instantiate <code></code> as <code>io</code>.
    • testString: getUserInput => $.get(getUserInput('url')+ '/_api/server.js').then(data => {assert.match(data, /io.*=.*require.*('|")'|").*http/gi, 'You should correctly require and instantiate as io.');}, xhr => { throw new Error(xhr.statusText); })
  3. text: Socket.IO should be listening for connections
    • testString: getUserInput => $.get(getUserInput('url')+ '/_api/server.js') .then(data => { assert.match(data, /io.on.*('|")connection('|").*socket/gi, 'io should listen for "connection" and socket should be the 2nd arguments variable'); }, xhr => { throw new Error(xhr.statusText); })
  4. text: Your client should connect to your server
    • testString: getUserInput => $.get(getUserInput('url')+ '/public/client.js') .then(data => { assert.match(data, /socket.*=.*io/gi, 'Your client should be connection to server with the connection defined as socket'); }, xhr => { throw new Error(xhr.statusText); })

Your code so far

Here is a link to my project. Below, I go through each assertion:

  1. first assertion:, '', 'Your project should list "" as a dependency');. if we pull up, under the dependencies object, I have "": "^2.3.0" so that assertion should pass based on that criteria.
  2. second assertion: assert.match(data, /io.*=.*require.*('|")'|").*http/gi, 'You should correctly require and instantiate as io.');. So if we pull up, we see const io = require('')(http); should allow that assertion to pass
  3. third assertion: assert.match(data, /io.on.*('|")connection('|").*socket/gi, 'io should listen for "connection" and socket should be the 2nd arguments variable');. In the same file as the second assertion, the statement io.on('connection', socket=>console.log('A user has connected')); should allow this assertion to pass.
  4. fourth assertion: assert.match(data, /socket.*=.*io/gi, 'Your client should be connection to server with the connection defined as socket');. In the file, the statement var socket = io(); should allow this assertion to pass

Despite the fact that all four assertions seem to be satisfied, all four are failing.

FYI I have tested the login feature, and the login and logout are working correctly. I did decide to personalize it by adding a FB login option as well as include req.session.destroy() in the /logout get callback, and adjusted some of the data that was stored in the DB (prompted by the fact that the original statement to grab the email address was throwing an error). The fact is that the object that was being called during authentication wasn’t including the emails field. I corrected the authentication process to be able to grab the email address (if available) and am using babel-node rather than node to allow for the optional chaining proposal in ES6 (the null propogation operator, i.e. the object?.property syntax). I don’t think; however, that any of that should be affecting the assertions, as stated in the challenge’s github file.

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36.

Challenge: undefined

Link to the challenge:



The last tests, when You start to use, are a little buggy, but they can be passed. There is a closed discussion on github regarding this problem.

I copy/paste the answer I gave on github:

Most of them pass, but there are some things missing:

  • I’ve found that using double quotes is problematic for the tests to pass, so use single quotes
  • You must require and use cors, otherwise the projects will not pass:
const app = express();
const cors = require('cors');
  • There are problems with formatting. For example, when prettier formats the code, if the lines are too long, it splits the lines, which may cause problems. I had the following problem:
// The following is beautified by prettier:

// But the test won't pass unless it's on the same line

Most problems can be solved by doing exactly what the challenge says, without even formatting the code.


@skaparate Thank you! ^^ I only needed to add app.use(cors()) to the fcctesting.js file to get it to pass.


Adding the two lines for cors worked for me. Thanks!

However, though I can pass the tests, I cannot authenticate through Github. The challenge says:

Now try loading up your app and authenticate and you should see in your server console ‘A user has connected’!

This doesn’t work for me. There was no mention so far in this set of exercises about setting up Github. We did do that in a previous set. Am I supposed to do that now? (Of course, it didn’t mention setting up .env, but I assumed that step.)

Happy to help :slight_smile:.

No, you don’t need to create a new GitHub API Key, but you do need to use one, so you could use the one from the previous challenge (and for all future challenges that require it).

Thanks. I found this post detailing the steps needed to get the new, cloned app up and running. Setup for new Boilerplate

1 Like