[英]What is causing the MaxListenersExceededWarning warning in web3js test code
I've testing code for a contract in ethereum我已经测试了以太坊合约的代码
const assert = require("assert");
const ganache = require("ganache-cli");
const Web3 = require("web3");
const web3 = new Web3(ganache.provider());
const { abi, evm } = require("../compile");
let accounts;
let inbox;
beforeEach(async () => {
// Get a list of all accounts
accounts = await web3.eth.getAccounts();
// Use one of those accounts to deploy the contract
inbox = await new web3.eth.Contract(abi)
.deploy({
data: evm.bytecode.object,
arguments: ["Hi there!"]
})
.send({ from: accounts[0], gas: "1000000" });
});
describe("Inbox", () => {
it("deploys a contract", () => {
console.log(accounts);
console.log(inbox);
assert.ok(inbox.options.address);
});
});
This is showing the following warning这显示以下警告
(node:52888) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 data listeners added. Use emitter.setMaxListeners() to increase limit
What is the probable reason for this and how to resolve it?造成这种情况的可能原因是什么以及如何解决?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.