@polywrap/test-env-js
The @polywrap/test-env-js
package is a library of functions that facilitate end-to-end testing in JavaScript.
The package is based on the default infrastructure module described in
Configure Polywrap infrastructure pipeline.
#
Constants#
providersThe providers
object contains the URIs for the default infrastructure module's local Ethereum network provider and IPFS provider.
#
ensAddressesThe ensAddresses
object contains the Ethereum addresses of the default infrastructure module's locally-deployed ENS smart contracts.
#
Methods#
initTestEnvironmentThe initTestEnvironment
function starts a local test environment using the default infrastructure module.
It optionally accepts a path to a polywrap
CLI binary.
#
stopTestEnvironmentThe stopTestEnvironment
function tears down the local test environment (default infrastructure module) if one is running.
It optionally accepts a path to a polywrap
CLI binary.
#
buildWrapperThe buildWrapper
function builds the wrapper located at the given path wrapperAbsPath
.
#
buildAndDeployWrapperLike buildWrapper
, the buildAndDeployWrapper
function builds the wrapper located at the given path wrapperAbsPath
.
After building the wrapper, buildAndDeployWrapper
deploys it to IPFS using the given provider ipfsProvider
.
It next registers the ENS domain ensName
and points the domain to the IPFS deployment using the Ethereum provider ethereumProvider
.
If an ENS domain is not provided, a randomly selected human-readable ENS domain name is used.
The buildAndDeployWrapper
function returns a Promise containing the ENS domain and IPFS content hash of the wrapper deployment,
either of which can be used to invoke the wrapper.
#
runCLIThe runCLI
function can be used to run the polywrap
CLI programmatically.
It requires an array of command line arguments args
, which should include the CLI command to be run.
An alternative current working directory cwd
can be provided to change the context from which the CLI is invoked.
It also optionally accepts a path to a polywrap
CLI binary.
The optional map of environmental variables env
will be set before running the CLI.