Skip to content

Releases: near/near-workspaces-js

v0.6.1

15 Sep 13:51
Compare
Choose a tag to compare
  • 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...v0.6.1

v0.6.0

07 Sep 21:05
Compare
Choose a tag to compare

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 a call function and return the string of the error message.

Pass binary data to call

  • feat: allow Uint8Array as call args (#46) 405e417

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 that runner.run will wait until the runner is ready instead of relying on beforeAll. See tests for examples of this.
    This means you can now use test.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

  • docs: fix tests markdown rendering e1591a0
  • docs: link to tests f3b5fe6
  • docs: skip '.accountId' when possible 8c68f2e
  • docs: make 'describe' consistent 0a141ff

v0.5.2...v0.6.0

v0.5.2

25 Aug 00:31
Compare
Choose a tag to compare
  • docs: fix import statement copypasta 8cbf89f

v0.5.1...v0.5.2

v0.5.1

24 Aug 21:06
Compare
Choose a tag to compare

v0.5.0...v0.5.1

Goodbye `runtime` Hello `root`

24 Aug 21:03
Compare
Choose a tag to compare

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

13 Aug 16:23
Compare
Choose a tag to compare

Breaking Changes

  • feat: make call use options object and sign calls with a temporary key ( #17) 636a7e4

Fixes

  • fix: create random folder for server & use a port checker to assign port (#16) 0dc1571

v0.3.0...v0.4.0

v0.3.0

11 Aug 15:24
Compare
Choose a tag to compare

Breaking Changes

  • Runtime no longer passed as lone argument to functions for Runner.create or runner.run. For Runner.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 to NEAR_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:

near/near-workspaces@v0.2.0...v0.3.0

Point at Testnet

10 Aug 16:41
Compare
Choose a tag to compare

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:

  1. When creating your Runner, pass a config object as the first argument:

    const runner: Runner = await Runner.create(
      { network: 'testnet' },
      async (runtime: Runtime) => {  }
    )
  2. 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

near/near-workspaces@v0.1.3...v0.2.0