JavaScript JavaScript Unit Testing Improving Our Tests Covering Edge Cases

Dehn Hunsworth
Dehn Hunsworth
7,189 Points

describe not defined..

I downloaded the files for this section and opened using VScode(workspaces do not work for me). When i try to run the player_test.js as it is i get an error describe undefined.

node test/player_test.js
C:\Users\The Huns\Desktop\Web-Dev\Team Treehouse\unitTesting\section 3\test\player_test.js:3
describe('PLAYER METHODS', function () {

ReferenceError: describe is not defined
    at Object.<anonymous> (C:\Users\The Huns\Desktop\Web-Dev\Team Treehouse\unitTesting\section 3\test\player_test.js:3:1)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)

and ideas? Thanks!

2 Answers

Did you install dependencies? Pretty sure describe is a mocha specific function. If you have npm its pretty easy to run an install in console for all the package.json files.

Hope that helps,


Dehn Hunsworth
Dehn Hunsworth
7,189 Points

yeah ran npm install to grab all of the dependencies. they show in the node_modules driectory

Not sure then, I haven't used Mocha in a little while. This link had some good solutions, I'm not sure which would fix it though

good luck!