ethers.js/tests
2017-11-19 22:26:41 -05:00
..
dist First attempt at PhantomJS test cases. 2017-10-22 17:47:17 -04:00
make-tests Added ABI v2 coder to Interface (still experimental in Solidity though). 2017-11-06 19:35:18 -05:00
tests Added ABI v2 coder to Interface (still experimental in Solidity though). 2017-11-06 19:35:18 -05:00
browser-fs.js First attempt at PhantomJS test cases. 2017-10-22 17:47:17 -04:00
browser.js Added all test cases for PhantomJS. 2017-10-22 17:56:01 -04:00
Gruntfile.js First attempt at PhantomJS test cases. 2017-10-22 17:47:17 -04:00
package.json First attempt at PhantomJS test cases. 2017-10-22 17:47:17 -04:00
README.md Added message signing to Wallet. 2017-10-19 02:52:55 -04:00
run-providers.js Added Rinkeby and Kovan support. 2017-10-25 19:59:54 -04:00
run-testrpc.js Less strict parsing for loose providers. 2017-10-27 17:03:26 -04:00
test-account.js Fix in test-accounts for case-sensitive file systems. 2017-10-21 04:03:51 -04:00
test-contract-interface.js Added ABI v2 coder to Interface (still experimental in Solidity though). 2017-11-06 19:35:18 -05:00
test-contract.json Less strict parsing for loose providers. 2017-10-27 17:03:26 -04:00
test-hdnode.js First attempt at PhantomJS test cases. 2017-10-22 17:47:17 -04:00
test-providers.js Merge branch 'master' of github.com:ethers-io/ethers.js 2017-11-19 22:26:41 -05:00
test-utils.js Migrated most test cases to mocha and added pre-generated gzipped test suite. 2017-10-18 21:28:45 -04:00
test-wallet.js First attempt at PhantomJS test cases. 2017-10-22 17:47:17 -04:00
test.html Removed shims from PhantomJS tests. 2017-11-09 03:14:48 -05:00
utils.js Migrated most test cases to mocha and added pre-generated gzipped test suite. 2017-10-18 21:28:45 -04:00

Ethers Test Suite

There are a lot of test cases, and it can take a while for them to all run.

Please be patient.

Running Tests

Node.js:

# Test everything
> npm test


# Test just one specific package

# Test the Solidity ABI coder
# - See tests/contract-interface.json.gz
> ./node_modules/.bin/mocha test-contract-interface.js

# Test HD Wallet derivations
# - See tests/hdnode.json.gz
> ./node_modules/.bin/mocha test-hdnode.js

# Test general utilities
# - See tests/namehash.json.gz
# - See tests/rlp-coder.json.gz
# - See tests/units.json.gz
> ./node_modules/.bin/mocha test-utils.js

# Test accounts and addresses
# - See tests/accounts.json.gz
> ./node_modules/.bin/mocha test-account.js

# Test encrypting/decrypting JSON wallets and transaction parsing/signing
# - See tests/transactions.json.gz
# - See tests/wallets.json.gz
> ./node_modules/.bin/mocha --timeout 100000 test-wallet.js


# This test case has not yet been migrated to mocha
> nodeunit run-provider.js

Test Cases

The testcases take up a large amount of space, so they are gzipped in the tests/ folder. See ./utils.js for saving and loading.

To dump a test case from the terminal, you can use:

/Users/ethers> cat ./tests/accounts.json.gz | gunzip

Building Testcases

Each suite of testcases is produced from a variety of sources. Many include a specific set of test vecotrs as well as procedurally generated tests using known correct implementations.

The contract-interface test cases are created by selecting a (deterministically) random set of types and values, a solidity contract is then created to represent a contract with the correct return types and values, which is then compiled and deployed to a local Ethereum node, then executed once mined.

As a result, genearting the test cases can take quite some time. So, they are generated using a separate set of files found in make-tests.

  • make-accounts
  • make-contract-interface
  • make-hdnode
  • makr-rlpcoder
  • make-transaction
  • make-wallets

Additional Test Vectors:

  • make-tests/test-mnemonics -- The trezor test vectors for BIP39
  • make-tests/test-wallets -- Sample JSON Wallets (crowdsale and Geth)

All generated JSON test files are then placed gzipped in tests with the extension '.json.gz'.

Adding Test Cases

For any patch, feature upgrade or pull request of any sort, there must be relevant test cases added and all test cases must pass.

If you report a bug and provide test cases, it will get attention sooner.