1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00
metamask-extension/test/e2e/ganache.js
PeterYinusa ebeb2668ea
E2e mocking (#13640)
* mock gas price api

* fix error

* full url

* remove duplicated packages

* full url

* customise mock per test

* customise mock per test

* enable mocking

* enable mocking

* enable mocking by default

* duplicated packages

* update mockttp

* pass through

* pass through
2022-02-16 14:21:41 +00:00

31 lines
658 B
JavaScript

const ganache = require('ganache');
const defaultOptions = {
blockTime: 2,
network_id: 1337,
mnemonic:
'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent',
port: 8545,
vmErrorsOnRPCResponse: false,
hardfork: 'muirGlacier',
quiet: true,
};
class Ganache {
async start(opts) {
const options = { ...defaultOptions, ...opts };
const { port } = options;
this._server = ganache.server(options);
await this._server.listen(port);
}
async quit() {
if (!this._server) {
throw new Error('Server not running yet');
}
await this._server.close();
}
}
module.exports = Ganache;