ReferenceError: describe is not defined
See original GitHub issueHello,
I’m currently using mocha v2.3.4, chai, and es6 with babel 6 and running in node v5.3.0.
This is my test script that I run with npm:
mocha --compilers js:babel-core/register --require ./test/test_helper.js --recursive
I have mocha globally installed, but whenever I run the test script I get the following output in my terminal:
ReferenceError: describe is not defined
Does anyone have any Ideas for why this may be happening?
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
node.js - ReferenceError: describe is not defined NodeJs
Assuming you are testing via mocha , you have to run your tests using the mocha command instead of the node executable.
Read more >"ReferenceError: describe is not defined" on next build #34249
"ReferenceError: describe is not defined" on next build. ... { type: 'ReferenceError' } error Command failed with exit code 1.
Read more >Test Runner/Debugger ReferenceError: describe is not defined
Test produces a ReferenceError saying 'describe is not defined'. It is as if the test runner no longer recognized that mocha is installed...
Read more >Jest reference error 'describe' is not defined when running ...
js build. I am struggling to get a next build completing without the following error being thrown: > Build error occurred { ReferenceError:...
Read more >Browser tdd: describe is not defined; bdd is ok - Google Groups
Weird situation: set up yeoman with backbone generator yo backbone with mocha.setup("bdd") the tests run with mocha.setup("tdd") getting ReferenceError: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
mochais a wrapper aroundnode._mochais the “real” executable. tryts-babel-node _mocha <mocha options>I would like to open the same issue again. I’m upgrading an existing node project to Typescript. I’m receiving the same error when trying to run mocha for the following project specs:
I have all the
@typesneeded installed (mocha, chai, node, supertest, etc) and adding the@typesdirectory to thetypeRootsof the TS compiler options in.tsconfig.json. This way I don’t have to doimport "mocha"at the beginning of my testI have also installed
ts-babel-nodewhich sits on top ofts-nodeto transpile ES6 to ES5 in Node Typescript projects. This is working fine, however, it’s unable to recognizedescribeduring runtime only. The compiler is referencing the@types/mocha'sdescribe()definition but not when I run the tests..babelrcis defined tooRunning the main app with
ts-babel-node src/server.tsruns fineRunning tests with
mocha -r ts-babel-node/bin/ts-babel-node test/test.tsfails in reading thedescribe()method.I also tried running
mocha --compilers js:ts-babel-node/bin/ts-babel-node test/test.tsbut with no luck.
Any tips would be appreciated