Releases: near/near-workspaces-js
v0.6.1
- fix: expose interfaces and make runner's constructor protected e63f9c4
- docs: fix & improve outdated README examples (#53) c3994ae
- feat: add Account, AccessKey, and Contract to Record type and add tests (#52) 1e0736a
- chore(tests): use setup file to set timeout once across files 70d9c58
- chore: add 'coverage' to .gitignore d02ee45
- fix: expose jsonrpc ffb26bd
v0.6.0
New Features
Caching on Testnet
Now each runner instance gets its own root account account that is cached. And each test gets its own subaccount. Then any accounts created in each run
method are deleted at the end of the run and refunded to the test account. The creation of the root accounts and their funding still use the helper URL. So if you experience any issues with rate limits, the caching should prevent you from needing to use the account creator after initial setup.
These cached accounts now live in the working directory as .near-credentials/runner/testnet/...json
, so be sure to add this to your .gitignore
.
captureError
will capture the error of acall
function and return the string of the error message.
Pass binary data to call
NEAR units!
near-units was added as a dependency allowing NEAR and Gas values to be parsed and printed in a human readable unit for easier comprehension. e.g. Gas.parse('50 TGas')
BREAKING CHANGEs
Runner.create
now returns an instance and keeps a promise internally so thatrunner.run
will wait until the runner is ready instead of relying onbeforeAll
. See tests for examples of this.
This means you can now usetest.concurrent
in jest to run all tests in a file concurrently instead of one after the other, which speeds up testing to the longest running test! For all testnet tests in this project saw an improvement from 270s down to 50s!- However, with great power comes great responsibility. While the internal state is independent for each state, any global state accessed by tests can have race conditions.
- New TransactionResult class returned by
call_raw
to get access to transaction details like logs, promises, intermediate results, and errors
Docs
v0.5.2
v0.5.1
Goodbye `runtime` Hello `root`
TL;DR, update your Runner.create
calls with:
- Runner.create(async ({runtime}) => {
+ Runner.create(async ({root}) => {
This also adds a new Transaction
class that can be used with createTransaction
; check it out in the fungible-token
tests. See #29 for details.
Full changes: v0.4.0...v0.5.0
Change Call Interface to allow signing with temporary key
Breaking Changes
Fixes
v0.3.0
Breaking Changes
-
Runtime
no longer passed as lone argument to functions forRunner.create
orrunner.run
. ForRunner.create
:const runner = await Runner.create(async ({ runtime }) => { const alice = await runtime.createAccount('alice') const contract = await runtime.createAndDeploy( 'contract-account-name', './path/to/compiled.wasm' ) return { alice, contract } })
And now the arguments that you returned will be passed to later calls to
runner.run
:runner.run(async ({ alice, contract }) => { alice.call(contract, …) })
-
RUNTIME_DEBUG
renamed toNEAR_RUNNER_DEBUG
Notable Commits
- docs: explain why testnet 17a6bf7
- fix: install near-sandbox if missing and add test (#11) 796eea0
- feat!: pass returned account args to runner.run 8776d89
Full changes:
Point at Testnet
You can now write tests once and run them both on a local Sandbox node as well as on NEAR's testnet test network. You can do this in two ways:
-
When creating your Runner, pass a config object as the first argument:
const runner: Runner = await Runner.create( { network: 'testnet' }, async (runtime: Runtime) => { … } )
-
Set the
NEAR_RUNNER_NETWORK
environment variable when running your tests:NEAR_RUNNER_NETWORK=testnet node test.js
For more info, see the README
Commits
- build: run yarn build a695579
- docs(readme): more testnet info 7e65114
- fix: files include all dist (#8) 4cc0533
- feat: support pointing at testnet (#5) 5e57233
- Merge pull request #6 from near/fix/suffix 0f01db4
- fix: don't need test.near suffix ec1f3a4
- fix gitattributes ignore dist folder ab9d085
- Merge pull request #4 from near/feat/patch_state 0a15f7c
- docs: clarify view/patch state tests 4ac43a6
- fix: borsh import and add test f18093d
- feat: add contract state and patch state bbbbb40
- fix typos 533934b