{"id":20060643,"url":"https://github.com/oasisprotocol/web3-tests","last_synced_at":"2026-05-31T20:31:36.927Z","repository":{"id":46265969,"uuid":"411632301","full_name":"oasisprotocol/web3-tests","owner":"oasisprotocol","description":null,"archived":false,"fork":false,"pushed_at":"2022-02-07T13:11:31.000Z","size":6710,"stargazers_count":1,"open_issues_count":3,"forks_count":1,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-03-02T10:14:20.949Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oasisprotocol.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-29T10:39:42.000Z","updated_at":"2021-11-10T10:03:52.000Z","dependencies_parsed_at":"2022-09-09T03:01:51.495Z","dependency_job_id":null,"html_url":"https://github.com/oasisprotocol/web3-tests","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/oasisprotocol/web3-tests","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oasisprotocol%2Fweb3-tests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oasisprotocol%2Fweb3-tests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oasisprotocol%2Fweb3-tests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oasisprotocol%2Fweb3-tests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oasisprotocol","download_url":"https://codeload.github.com/oasisprotocol/web3-tests/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oasisprotocol%2Fweb3-tests/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33748607,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T13:16:10.377Z","updated_at":"2026-05-31T20:31:36.910Z","avatar_url":"https://github.com/oasisprotocol.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Guide to Oasis Web3's tests and CI\n\n## Note\n\nOriginally, the tests in this repository were forked from https://github.com/ChainSafe/web3.js.\n\nWeb3 is used in Node.js and browser contexts to interact with a wide variety of clients. Its tests\ntry to cover as much of this domain as possible.\n\nIf you're looking for a fixture, test pattern or common execution context to validate a change, you should be able find it in the existing test suite. (Caveats include Parity / Quorum clients and MetaMask specific tests.)\n\n## Required Tests\n\nThese should pass for PRs to merge:\n\n| Test type | npm command | Example | Description | CI Only |\n| --------- | --------------- | ------ | ----------- | ----- |\n| unit | test | [eth.accounts.sign.js][1] | For discrete pieces of logic |\n| integration | test:e2e:clients | [e2e.contract.events.js][2] | Tests using geth and ganache-cli, (insta-mining and interval mining.) Easy to write and good for modeling complex use-cases |\n| browser | test:e2e:browsers | | The integration tests run in a headless browser using web3.min.js (browserified, vs. ganache-cli) |\n| typescript | dtslint | -- | TS type definitions tests |\n| dependencies  | depcheck | -- | Verifies every dependency is listed correctly in the module package |\n| bundle | test:e2e:min | [e2e.minified.js][3] | Verifies minified bundle loads in a headless browser *without* being webpacked / browserified | :white_check_mark: |\n| cdn | test:e2e:cdn | [e2e.cdn.sh][4]| Visual inspection check: publishes an (un-webpacked) site that uses web3.min.js at https://web3-staging.netlify.app/ | :white_check_mark: |\n| windows | -- | [e2e.windows.sh][5] | Verifies Web3 installs on Windows OS / Node 12 and can connect to Infura over wss and https | :white_check_mark: |\n\n\n## Optional Tests\n\nCI also has tests that install Web3's state at an arbitrary commit in an external real-world project and run *their* unit tests with it. This strategy is borrowed from ethereum/solidity which checks latest Solidity against OpenZeppelin and others to keep abreast of how local changes might affect critical projects downstream from them.\n\nExamples include:\n+ [e2e.mosaic.sh][8]: ~300 unit tests for [a Solidity project built with Buidler \u0026 @truffle/contract][9]\n+ [e2e.ganache.core.sh][9]: ~600 unit tests for [a widely used JS testrpc][11]\n\nThese tests are \"allowed failures\". They're:\n+ a pre-publication sanity check that discovers how Web3 performs in the wild\n+ useful for catching problems which are difficult to anticipate\n+ exposed to failure for reasons outside of Web3's control, ex: when fixes here surface bugs in the target.\n\n## Implementation Details\n\n**Code coverage**\n\nCoverage is measured by aggregating the results of tests run in the `unit_and_e2e_clients`\nCI job.\n\n**Tests which use an Ethereum client**\n\nThe npm script `test:e2e:clients` greps all tests with an `[ @E2E ]` tag\nin their mocha test description and runs them against:\n+ ganache-cli\n+ geth stable (POA, single instance, instamining)\n+ geth stable (POA, single instance, mining at 2s intervals)\n\nThese tests are grouped in files prefixed by \"e2e\", ex: `test/e2e.method.call.js`.\n\nAdditionally, there are conventional unit tests postfixed `.ganache.js` which spin up a ganache\nserver programatically within mocha. This pattern is useful if you want to\ncontrol client configuration for a specific case, test against multiple independent providers, etc.\n\n**\"Real world\" tests**\n\nThe tests which install Web3's current state in an external real-world project and\nrun their unit tests accomplish this by publishing the monorepo to an ephemeral private\nnpm registry which is spun up in CI using [verdaccio][14]. (Implementation details can\nbe seen in [scripts/e2e.npm.publish.sh][15])\n\nThe real world target is then cloned and npm or yarn are used to replace its existing\nWeb3 version with the version published to the the private registry. A simple example can be seen at\n[scripts/e2e.ganache.core.sh][10].\n\nIn practice, complex projects can have many versions of Web3 nested in their dependency tree.\nIt's important to coerce all of them to the virtually published package's version for the test to be valid.\nThis can be done with [scripts/js/resolutions.js][18] which modifies the target's\n`package.json` to take advantage of Yarn's [selective dependency resolutions][17].\nAn example of its use can be seen at [scripts/e2e.mosaic.sh][8].\n\n[14]: https://verdaccio.org/docs/en/installation\n[15]: https://github.com/ethereum/web3.js/blob/1.x/scripts/e2e.npm.publish.sh\n[17]: https://classic.yarnpkg.com/en/docs/selective-version-resolutions/\n[18]: https://github.com/ethereum/web3.js/blob/1.x/scripts/js/resolutions.js\n\n[8]: https://github.com/ethereum/web3.js/blob/1.x/scripts/e2e.mosaic.sh\n[9]: https://github.com/cgewecke/mosaic-1\n[10]: https://github.com/ethereum/web3.js/blob/1.x/scripts/e2e.ganache.core.sh\n[11]: https://github.com/trufflesuite/ganache-core\n\n[1]: https://github.com/ethereum/web3.js/blob/1.x/test/eth.accounts.sign.js\n[2]: https://github.com/ethereum/web3.js/blob/1.x/test/e2e.contract.events.js\n[3]: https://github.com/ethereum/web3.js/blob/1.x/test/e2e.minified.js\n[4]: https://github.com/ethereum/web3.js/blob/1.x/scripts/e2e.cdn.sh\n[5]: https://github.com/ethereum/web3.js/blob/1.x/scripts/e2e.windows.sh\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foasisprotocol%2Fweb3-tests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foasisprotocol%2Fweb3-tests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foasisprotocol%2Fweb3-tests/lists"}