0

My tests where running well but not when I run yarn hardhat test, I get the error below.

Error

An unexpected error occurred:

TypeError: describe is not a function
    at Object.<anonymous> (/Users/k_frankline/projects/ICO/test/ico.js:8:7)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at /Users/k_frankline/projects/ICO/node_modules/hardhat/node_modules/mocha/lib/mocha.js:414:36
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/Users/k_frankline/projects/ICO/node_modules/hardhat/node_modules/mocha/lib/mocha.js:411:14)
error Command failed with exit code 1.

I think it's a dependency issue. I have tried different versions of mocha but nothing works.

What could be the issue?

Package.json

{
  "name": "ico",
  "version": "1.0.0",
  "main": "index.js",
  "repository": "https://github.com/kihiuFrank/ICO.git",
  "author": "kihiuFrank <[email protected]>",
  "license": "MIT",
  "devDependencies": {
    "@nomicfoundation/hardhat-chai-matchers": "^1.0.4",
    "@nomicfoundation/hardhat-network-helpers": "^1.0.0",
    "@nomicfoundation/hardhat-toolbox": "^2.0.0",
    "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13",
    "@nomiclabs/hardhat-etherscan": "^3.0.0",
    "@openzeppelin/contracts": "^4.8.0",
    "@pinata/sdk": "^1.1.23",
    "@typechain/ethers-v5": "^10.1.0",
    "@typechain/hardhat": "^6.1.2",
    "@types/mocha": "^9.1.0",
    "base64-sol": "^1.1.0",
    "chai": "^4.3.4",
    "ethers": "^5.5.3",
    "hardhat": "^2.14.0",
    "hardhat-deploy": "^0.9.29",
    "hardhat-gas-reporter": "^1.0.7",
    "path": "^0.12.7",
    "solidity-coverage": "^0.8.2",
    "ts-node": ">=8.0.0",
    "typechain": "^8.1.0",
    "typescript": ">=4.5.0"
  },
  "dependencies": {
    "dotenv": "^16.0.3"
  }
}

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.