Mocha installation issues

I am attempting to work on the Content Creators Contracting project in the create a back end app with javascript career path. https://www.codecademy.com/paths/create-a-back-end-app-with-javascript/tracks/bapi-javascript-conditionals-and-functions/modules/developing-javascript-apps-locally/informationals/bapi-p0-content-creators

The instructions for this project are AWFUL. Due to the mention of testing and of Mocha and Chai in the article directly preceding this project, I followed the link (that codecademy provided) to the documentation, and went down to the “getting started” section and began installing mocha myself. https://mochajs.org/ I have run npm install mocha, and I even opened a test file and added the code it told me to, the next step has me baffled.

it says “Back in the terminal” and gives you a file path, but the last part of that file path isnt actually a directory, its just a file, so you can’t navigate into it in the terminal??? And what is it they are wanting me to do? How am I supposed to code in the terminal where code is indented and on different lines? I am absolutely befuddled as to what they are asking me to do. I am assuming they want me to add code to the file, but how am I supposed to do that from the terminal? And why wasn’t that just included in that file already? it mentions a package.json file as well, is that the file one director up or do I make it? These instructions are so unclear!!!

speaking of unclear instructions, am I even supposed to be installing this manually? According to this post about the project Content Creator Contracting Project Help - How to start
running npm install from the root directory of the project gives you everything you need, aside from clear instructions, of course. So if I have already manually installed mocha using npm install mocha, do I need to somehow delete that before running npm install on the project file? I’m pretty much ready to throw my laptop out of my window with the amount of questions and confusion this project has created. For example, there are mocha files in the npm file deep within the file system that exists within the users/myname etc etc. My project file exists on my c drive, outside of the users directory, is that going to cause a problem when I try running mocha on a file that exists in a different scope? If I need to delete the first installation in order to install using npm install on the project directory how do I even do that?

I don’t know what’s MochaJS, but I do know how npm works up to some extent. What I have figured out, Mocha is a JavaScript library. To run and implement the library features you need to go into your project folder using your terminal and run npm init (this initializes a package.json file in you project directory) if you don’t have a package.json created, else you can directly punch inside the terminal, this command: npm install mocha. This installs Mocha locally, i.e available just to your current project (irrespective, you will still have to run this command after npm init, if the dependency to mocha isn’t present). If you want it to be available across all your projects, you can go for the --global flag while punching the command for installing Mocha.

Once, you have done the above, you can create a new JavaScript file within your directory and type/paste whatever code you wanna run in integration with Mocha. Save your file. Then go to your package.json folder and create a test script within that, as shown below:

Capture

Scripts are basically development and production commands which you will probably run to see the desired output of your scripts.

Once done, go to your terminal and type the command npm test:

2

The command initiated whatever was declared as the “test” value in your scripts (in this case mocha)

As visible in the above image you will get the desired compiled result in response to whatever Mocha code you have written.
And don’t throw your laptop out of the window!