Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,

Dylan

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

https://stackoverflow.com/questions/47398837/describe-is-not-defined-when-running-my-test

good luck!