@coinbase/onchaintestkit
Version:
End-to-end testing toolkit for blockchain applications, powered by Playwright
31 lines (30 loc) • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NodeFixturesBuilder = void 0;
const test_1 = require("@playwright/test");
const LocalNodeManager_1 = require("./LocalNodeManager");
class NodeFixturesBuilder {
constructor(config = {}) {
this.config = config;
}
/**
* Creates a test fixture that manages a local Anvil node
* The node will be started before the test and stopped after
*/
build() {
return test_1.test.extend({
node: [
async ({}, use) => {
console.log("Starting node...");
const node = new LocalNodeManager_1.LocalNodeManager(this.config);
await node.start();
console.log("Node is ready");
await use(node);
await node.stop();
},
{ scope: "test", auto: true },
],
});
}
}
exports.NodeFixturesBuilder = NodeFixturesBuilder;