-
Hello, developmentChains.includes(network.name)
? describe.skip but there is the same in the deploy-fund-me.js, and it works fine! The next is the text error shown in the terminal... TypeError: Cannot read properties of undefined (reading 'includes')
at Object.<anonymous> (/home/kotysky/hh--fcc/hardhat-fund-me-fcc/test/staging/FundMe.staging.test.js:5:19)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at /home/kotysky/hh--fcc/hardhat-fund-me-fcc/node_modules/mocha/lib/mocha.js:414:36
at Array.forEach (<anonymous>)
at Mocha.loadFiles (/home/kotysky/hh--fcc/hardhat-fund-me-fcc/node_modules/mocha/lib/mocha.js:411:14) FundMe.staging.test.js const { ethers, network, deployments } = require("hardhat")
const { developmentChains } = require("../../helper-hardhat-config")
const { assert } = require("chai")
developmentChains.includes(network.name)
? describe.skip
: describe("FundMe", async () => {
let fundMe
let deployer
const sendValue = ethers.parseEther("0.1") // 1eth
beforeEach(async function () {
const accounts = await ethers.getSigners()
deployer = accounts[0]
const fundMeDeploy = await deployments.get("FundMe")
fundMe = await ethers.getContractAt(
fundMeDeploy.abi,
fundMeDeploy.address,
deployer
)
})
it("Allows people to fund and withdraw", async () => {
await fundMe.fund({ value: sendValue })
await fundMe.withdraw()
const endingBalance = await ethers.provider.getBalance(
fundMe.getAddress()
)
assert.equal(endingBalance.toString(), "0")
})
}) hardhat-config.js require("@nomicfoundation/hardhat-toolbox")
require("hardhat-deploy")
require("dotenv").config()
//require("@nomiclabs/hardhat-etherscan")
const SEPOLIA_RPC_URL = process.env.SEPOLIA_RPC_URL
const POLYGON_RPC_URL = process.env.POLYGON_RPC_URL
const MUMBAI_RPC_URL = process.env.MUMBAI_RPC_URL
const PRIVATE_KEY = process.env.PRIVATE_KEY
const COINMARKETCAP_API_KEY = process.env.COINMARKETCAP_API_KEY
const SEPOLIA_ETHERSCAN_API_KEY = process.env.SEPOLIA_ETHERSCAN_API_KEY
const MUMBAI_ETHERSCAN_API_KEY = process.env.MUMBAI_ETHERSCAN_API_KEY
module.exports = {
//solidity: "0.8.8",
solidity: {
compilers: [{ version: "0.8.8" }, { version: "0.6.6" }],
},
defaultNetwork: "hardhat",
networks: {
polygon: {
url: POLYGON_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 1442,
blockConfirmations: 6,
},
sepolia: {
url: SEPOLIA_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 11155111,
blockConfirmations: 6,
},
mumbai: {
url: MUMBAI_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 80001,
blockConfirmations: 6,
},
},
gasReporter: {
enabled: true,
outputFile: "gas-report.txt",
noColors: true,
currency: "USD",
coinmarketcap: COINMARKETCAP_API_KEY,
token: "ETH",
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
namedAccounts: {
deployer: {
default: 0,
},
users: {
default: 1,
},
},
} package.json {
"devDependencies": {
"@chainlink/contracts": "^0.7.1",
"@nomicfoundatiob/hardhat-ethers": "npm:hardhat-deploy-ethers",
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
"@nomicfoundation/hardhat-ethers": "^3.0.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox": "^3.0.0",
"@nomicfoundation/hardhat-verify": "^1.1.1",
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers",
"@typechain/ethers-v6": "^0.4.0",
"@typechain/hardhat": "^8.0.0",
"chai": "^4.2.0",
"ethers": "^6.7.1",
"hardhat": "^2.17.4",
"hardhat-deploy": "^0.11.37",
"hardhat-gas-reporter": "^1.0.8",
"solidity-coverage": "^0.8.0",
"typechain": "^8.1.0"
},
"dependencies": {
"dotenv": "^16.3.1"
}
} helper-hardhat-config.js const networkConfig = {
11155111: {
name: "sepolia",
ethUsdPriceFeed: "0x694AA1769357215DE4FAC081bf1f309aDC325306",
},
1442: {
name: "polygon",
ethUsdPriceFeed: "0x1a0Df40e0F195593d244Eb99E2Ad9Ba7f34C1076",
},
80001: {
name: "mumbai",
ethUsdPriceFeed: "0x0715A7794a1dc8e42615F059dD6e406A6594651A",
},
}
const developmentsChains = ["hardhat", "localhost"]
const DECIMALS = 8
const INITIAL_ANSWER = 200000000000
module.exports = {
networkConfig,
developmentsChains,
DECIMALS,
INITIAL_ANSWER,
}
```
|
Beta Was this translation helpful? Give feedback.
Answered by
alfaqi
Oct 7, 2023
Replies: 1 comment 1 reply
-
there is |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
kotysky
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
there is
s
additionaldevelopmentChains
inhelper-hardhat-config.js
filejust delete it