I'm writing a simple NodeJS (Node 9.4.0) server that's using web3 (1 beta)
to interact with Ethereum.
I've created a simple utility web3
as follows:
const Web3 = require('web3')
const url = process.env.WEB3_PROVIDER_URL || 'ws://localhost:8546'
const web3 = new Web3(Web3.givenProvider || url)
module.exports = web3
I've written a trivial mocha
(4.0) test as follows
const { expect } = require('chai')
const web3 = require('../../../src/utils/web3')
describe('web3', () => {
it('exists', () => {
expect(web3).to.exist
})
})
The test passes fine but mocha never exists unless I add the --exit
flag.
How can I close or otherwise cleanup web3
after my test so mocha exists correctly without the use of the --exit
flag?