Init Framework

How to init framework

For Framework to operate properly you need to initialize it first. You can do it with provided init method.

init( basePath, options)

Initializes framework variables.

Arguments

NameTypeOptionalDescription
basePathstringpath to the folder holding all Cadence template files
optionsobjectoptions object to use during initialization

Options

NameTypeOptionalDescription
pkeyprivate key for service account

Usage

1
import path from "path"
2
import {init} from "@onflow/flow-js-testing"
3
4
describe("test setup", () => {
5
beforeEach(async () => {
6
const basePath = path.resolve(__dirname, "../cadence")
7
await init(basePath)
8
9
// alternatively you can pass specific port
10
// await init(basePath, {port: 8085})
11
})
12
})