mocha ReferenceError: describe is not defined problem solving

mocha is nodejs develop more commonly used assertion library error if you directly mounted node startup mode will yield the following

  • Error message
    ReferenceError: describe is not defined
  • Solution
    should be used to start the test mocha, alternative ways, global or local installation mocha installation, start using npm script, as follows
    pacakge.json configuration
 
{
  "name": "zombie",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {},
  "scripts": {
    "start": "mocha app.js"
  },
  "devDependencies": {
    "mocha": "^7.1.0",
    "zombie": "^6.1.4"
  }
}

Explanation

The above is a matter of record, is actually a very short answer questions

Reference material

https://mochajs.org/#getting-started
https://github.com/mochajs/mocha
https://stackoverflow.com/questions/28400459/referenceerror-describe-is-not-defined-nodejs

Guess you like

Origin www.cnblogs.com/rongfengliang/p/12508739.html