From 75f92241aa451c895886206d18292c23c8312dc6 Mon Sep 17 00:00:00 2001 From: Kris Urbas <605420+krzysu@users.noreply.github.com> Date: Wed, 6 Nov 2024 11:18:44 +0100 Subject: [PATCH] last failing test --- .github/workflows/build.yml | 571 +++++++++--------- .../web3-account-abstraction/package.json | 2 +- packages/web3-core/package.json | 2 +- packages/web3-errors/package.json | 2 +- packages/web3-eth-abi/package.json | 2 +- packages/web3-eth-accounts/package.json | 2 +- packages/web3-eth-contract/package.json | 2 +- .../test/integration/contract_deploy.test.ts | 20 +- packages/web3-eth-ens/package.json | 2 +- packages/web3-eth/package.json | 2 +- packages/web3-providers-ws/package.json | 2 +- packages/web3/package.json | 2 +- 12 files changed, 301 insertions(+), 310 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9840d738dcc..b8c0f6647fd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,178 +28,179 @@ jobs: - run: yarn build:cjs - uses: actions/cache/save@v4 with: - path: ./ - key: web3-${{ matrix.node }}-${{github.sha}} + path: ./ + key: web3-${{ matrix.node }}-${{github.sha}} - # build-esm: - # name: Build ESM - # needs: build - # runs-on: ubuntu-latest - # steps: - # - uses: actions/setup-node@v4 - # with: - # node-version: 18 - # - uses: actions/cache/restore@v4 - # with: - # path: ./ - # key: web3-18-${{github.sha}} - # - run: yarn build:esm - # build-types: - # name: Build Types - # needs: build - # runs-on: ubuntu-latest - # steps: - # - uses: actions/setup-node@v4 - # with: - # node-version: 18 - # - uses: actions/cache/restore@v4 - # with: - # path: ./ - # key: web3-18-${{github.sha}} - # - run: yarn build:types - # lint: - # name: Lint - # needs: build - # runs-on: ubuntu-latest - # steps: - # - uses: actions/setup-node@v4 - # with: - # node-version: 18 - # - uses: actions/cache/restore@v4 - # with: - # path: ./ - # key: web3-18-${{github.sha}} - # - run: npx ts-node scripts/init.ts - # - name: Restore eslint caches - # uses: actions/cache/restore@v4 - # with: - # path: | - # packages/web3/.eslintcache - # packages/web3-core/.eslintcache - # packages/web3-eth/.eslintcache - # packages/web3-eth-abi/.eslintcache - # packages/web3-eth-accounts/.eslintcache - # packages/web3-eth-contract/.eslintcache - # packages/web3-eth-ens/.eslintcache - # packages/web3-eth-iban/.eslintcache - # packages/web3-eth-personal/.eslintcache - # packages/web3-net/.eslintcache - # packages/web3-providers-http/.eslintcache - # packages/web3-providers-ws/.eslintcache - # packages/web3-rpc-methods/.eslintcache - # packages/web3-types/.eslintcache - # packages/web3-utils/.eslintcache - # packages/web3-validator/.eslintcache - # tools/web3-plugin-example/.eslintcache - # key: ${{ runner.os }}-eslintcache + build-esm: + name: Build ESM + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v4 + with: + node-version: 18 + - uses: actions/cache/restore@v4 + with: + path: ./ + key: web3-18-${{github.sha}} + - run: yarn build:esm + build-types: + name: Build Types + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v4 + with: + node-version: 18 + - uses: actions/cache/restore@v4 + with: + path: ./ + key: web3-18-${{github.sha}} + - run: yarn build:types + lint: + name: Lint + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v4 + with: + node-version: 18 + - uses: actions/cache/restore@v4 + with: + path: ./ + key: web3-18-${{github.sha}} + - run: npx ts-node scripts/init.ts + - name: Restore eslint caches + uses: actions/cache/restore@v4 + with: + path: | + packages/web3/.eslintcache + packages/web3-core/.eslintcache + packages/web3-eth/.eslintcache + packages/web3-eth-abi/.eslintcache + packages/web3-eth-accounts/.eslintcache + packages/web3-eth-contract/.eslintcache + packages/web3-eth-ens/.eslintcache + packages/web3-eth-iban/.eslintcache + packages/web3-eth-personal/.eslintcache + packages/web3-net/.eslintcache + packages/web3-providers-http/.eslintcache + packages/web3-providers-ws/.eslintcache + packages/web3-rpc-methods/.eslintcache + packages/web3-types/.eslintcache + packages/web3-utils/.eslintcache + packages/web3-validator/.eslintcache + tools/web3-plugin-example/.eslintcache + key: ${{ runner.os }}-eslintcache - # - run: yarn lint - # - run: gh cache delete "${{ runner.os }}-eslintcache" - # if: github.event_name == 'push' && github.ref == 'refs/heads/4.x' - # env: - # GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - run: yarn lint + - run: gh cache delete "${{ runner.os }}-eslintcache" + if: github.event_name == 'push' && github.ref == 'refs/heads/4.x' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # - name: Save eslint caches - # if: github.event_name == 'push' && github.ref == 'refs/heads/4.x' - # uses: actions/cache/save@v4 - # with: - # path: | - # packages/web3/.eslintcache - # packages/web3-core/.eslintcache - # packages/web3-eth/.eslintcache - # packages/web3-eth-abi/.eslintcache - # packages/web3-eth-accounts/.eslintcache - # packages/web3-eth-contract/.eslintcache - # packages/web3-eth-ens/.eslintcache - # packages/web3-eth-iban/.eslintcache - # packages/web3-eth-personal/.eslintcache - # packages/web3-net/.eslintcache - # packages/web3-providers-http/.eslintcache - # packages/web3-providers-ws/.eslintcache - # packages/web3-rpc-methods/.eslintcache - # packages/web3-types/.eslintcache - # packages/web3-utils/.eslintcache - # packages/web3-validator/.eslintcache - # tools/web3-plugin-example/.eslintcache - # key: ${{ runner.os }}-eslintcache + - name: Save eslint caches + if: github.event_name == 'push' && github.ref == 'refs/heads/4.x' + uses: actions/cache/save@v4 + with: + path: | + packages/web3/.eslintcache + packages/web3-core/.eslintcache + packages/web3-eth/.eslintcache + packages/web3-eth-abi/.eslintcache + packages/web3-eth-accounts/.eslintcache + packages/web3-eth-contract/.eslintcache + packages/web3-eth-ens/.eslintcache + packages/web3-eth-iban/.eslintcache + packages/web3-eth-personal/.eslintcache + packages/web3-net/.eslintcache + packages/web3-providers-http/.eslintcache + packages/web3-providers-ws/.eslintcache + packages/web3-rpc-methods/.eslintcache + packages/web3-types/.eslintcache + packages/web3-utils/.eslintcache + packages/web3-validator/.eslintcache + tools/web3-plugin-example/.eslintcache + key: ${{ runner.os }}-eslintcache - # build-web: - # name: Build Web - # needs: build - # runs-on: ubuntu-latest - # steps: - # - uses: actions/setup-node@v4 - # with: - # node-version: 18 - # - uses: actions/cache/restore@v4 - # with: - # path: ./ - # key: web3-18-${{github.sha}} - # - name: Restore default branch stats - # if: github.event_name != 'push' - # uses: actions/cache/restore@v4 - # with: - # path: packages/web3/dist/4.x.json - # key: web3-bundle-stats-4x-${{github.event.pull_request.base.sha}} - # - run: yarn build:web:analyze - # env: - # STATS_FILE: ${{ github.ref_name }}.json - # - name: Compare bundle stats - # uses: github/webpack-bundlesize-compare-action@v1.8.2 - # continue-on-error: true - # with: - # github-token: ${{ secrets.GITHUB_TOKEN }} - # current-stats-json-path: "packages/web3/dist/${{ github.ref_name }}.json" - # base-stats-json-path: "packages/web3/dist/4.x.json" - # - name: Cache default branch stats - # uses: actions/cache/save@v4 - # if: github.event_name == 'push' && github.ref == 'refs/heads/4.x' - # with: - # path: packages/web3/dist/${{ github.ref_name }}.json - # key: web3-bundle-stats-4x-${{github.sha}} + build-web: + name: Build Web + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v4 + with: + node-version: 18 + - uses: actions/cache/restore@v4 + with: + path: ./ + key: web3-18-${{github.sha}} + - name: Restore default branch stats + if: github.event_name != 'push' + uses: actions/cache/restore@v4 + with: + path: packages/web3/dist/4.x.json + key: web3-bundle-stats-4x-${{github.event.pull_request.base.sha}} + - run: yarn build:web:analyze + env: + STATS_FILE: ${{ github.ref_name }}.json + - name: Compare bundle stats + uses: github/webpack-bundlesize-compare-action@v1.8.2 + continue-on-error: true + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + current-stats-json-path: "packages/web3/dist/${{ github.ref_name }}.json" + base-stats-json-path: "packages/web3/dist/4.x.json" + - name: Cache default branch stats + uses: actions/cache/save@v4 + if: github.event_name == 'push' && github.ref == 'refs/heads/4.x' + with: + path: packages/web3/dist/${{ github.ref_name }}.json + key: web3-bundle-stats-4x-${{github.sha}} - # unit: - # name: Unit Tests - # needs: build - # runs-on: ubuntu-latest - # strategy: - # matrix: - # node: ['18', '20.17.0'] - # steps: - # - uses: actions/setup-node@v4 - # with: - # architecture: x64 - # node-version: ${{ matrix.node }} - # - uses: actions/cache/restore@v4 - # with: - # path: ./ - # key: web3-${{ matrix.node }}-${{github.sha}} - # - run: yarn test:unit - # continue-on-error: ${{ matrix.node == '20.17.0' }} - # - name: Upload coverage to Codecov - # uses: codecov/codecov-action@v3 - # with: - # flags: UnitTests - # token: ${{ secrets.CODECOV_TOKEN }} - # if: ${{ matrix.node == 18 }} - integration-hardhat: - name: Integration hardhat + unit: + name: Unit Tests needs: build runs-on: ubuntu-latest strategy: - fail-fast: false + matrix: + node: ['18', '20.17.0'] steps: - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: 18 + architecture: x64 + node-version: ${{ matrix.node }} - uses: actions/cache/restore@v4 with: - path: ./ - key: web3-18-${{github.sha}} - - run: npx hardhat node & - - run: yarn test:e2e:hardhat:http - shell: bash + path: ./ + key: web3-${{ matrix.node }}-${{github.sha}} + - run: yarn test:unit + continue-on-error: ${{ matrix.node == '20.17.0' }} + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + flags: UnitTests + token: ${{ secrets.CODECOV_TOKEN }} + if: ${{ matrix.node == 18 }} + + integration-hardhat: + name: Integration hardhat + needs: build + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/setup-node@v3 + with: + node-version: 18 + - uses: actions/cache/restore@v4 + with: + path: ./ + key: web3-18-${{github.sha}} + - run: npx hardhat node & + - run: yarn test:e2e:hardhat:http + shell: bash e2e-geth: name: Integration # (geth with HTTP, IPC & WS) @@ -211,132 +212,132 @@ jobs: strategy: fail-fast: false matrix: - mode: ['ipc', 'ws', 'http'] + mode: [ 'ipc', 'ws', 'http' ] steps: - - uses: actions/setup-node@v4 - with: - node-version: 18 - - uses: actions/cache/restore@v4 - with: - path: ./ - key: web3-18-${{github.sha}} - - run: yarn test:e2e:geth:${{ matrix.mode }} - shell: bash + - uses: actions/setup-node@v4 + with: + node-version: 18 + - uses: actions/cache/restore@v4 + with: + path: ./ + key: web3-18-${{github.sha}} + - run: yarn test:e2e:geth:${{ matrix.mode }} + shell: bash - # e2e-browsers: - # name: End-to-End hardhat:ws - # needs: build - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # browser: ['electron', 'chrome', 'firefox'] - # steps: - # - uses: actions/setup-node@v3 - # with: - # node-version: 18 - # - uses: browser-actions/setup-firefox@latest - # if: matrix.browser == 'firefox' - # - uses: actions/cache/restore@v4 - # with: - # path: ./ - # key: web3-18-${{github.sha}} - # - run: npx hardhat node & - # - run: npm install --no-package-lock --no-save --force cypress - # - name: Cypress run - # uses: cypress-io/github-action@v4 - # with: - # install: false - # command: yarn test:e2e:hardhat:ws:${{ matrix.browser }} - # cache-key: node-v18-on-${{ matrix.browser }}-hash-${{ hashFiles('yarn.lock') }} + e2e-browsers: + name: End-to-End hardhat:ws + needs: build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + browser: ['electron', 'chrome', 'firefox'] + steps: + - uses: actions/setup-node@v3 + with: + node-version: 18 + - uses: browser-actions/setup-firefox@latest + if: matrix.browser == 'firefox' + - uses: actions/cache/restore@v4 + with: + path: ./ + key: web3-18-${{github.sha}} + - run: npx hardhat node & + - run: npm install --no-package-lock --no-save --force cypress + - name: Cypress run + uses: cypress-io/github-action@v4 + with: + install: false + command: yarn test:e2e:hardhat:ws:${{ matrix.browser }} + cache-key: node-v18-on-${{ matrix.browser }}-hash-${{ hashFiles('yarn.lock') }} - # deploy-docs: - # name: Docs CloudFlare Deploy - # needs: build - # runs-on: ubuntu-latest - # permissions: - # contents: read - # deployments: write - # steps: - # - uses: actions/checkout@v4 - # - uses: actions/setup-node@v4 - # with: - # cache: yarn - # node-version: '18' - # - uses: actions/cache/restore@v4 - # with: - # path: ./ - # key: web3-18-${{github.sha}} - # - run: yarn install --ignore-scripts - # - run: yarn build:cjs - # - run: yarn run build:docs - # - name: Publish to Cloudflare Pages - # uses: cloudflare/pages-action@v1 - # with: - # apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - # accountId: 2238a825c5aca59233eab1f221f7aefb - # projectName: web3-js-docs - # directory: ./docs/build - # gitHubToken: ${{ secrets.GITHUB_TOKEN }} - # benchmark: - # name: Benchmark Tests - # needs: build - # runs-on: ubuntu-latest - # steps: - # - uses: actions/setup-node@v4 - # with: - # node-version: 18 - # - uses: actions/cache/restore@v4 - # with: - # path: ./ - # key: web3-18-${{github.sha}} - # # @octokit/core not supported on node 16, so I can't add it to the package.json - # - run: npm install --no-package-lock --no-save --force @octokit/core@5.1.0 - # - name: Restore main branch benchmark data - # uses: actions/cache/restore@v4 - # with: - # path: web3-benchmark-main.json - # key: ${{ runner.os }}-web3-benchmark-main.json - # - run: yarn test:benchmark - # - name: Compare benchmark result and make comment - # uses: benchmark-action/github-action-benchmark@v1 - # with: - # # What benchmark tool the output.txt came from - # tool: 'benchmarkjs' - # # Where the output from the benchmark tool is stored - # output-file-path: benchmark-data.txt - # # Where the previous data file is stored - # external-data-json-path: web3-benchmark-main.json - # # Workflow will fail when an alert happens - # fail-on-alert: false - # # GitHub API token to make a commit comment - # github-token: ${{ secrets.GITHUB_TOKEN }} - # # Enable alert commit comment - # comment-always: true - # save-data-file: false - # # copy comment from commit to Pull Request - # - run: node scripts/copyCommitCommentToPrComment.js ${{ secrets.GITHUB_TOKEN }} ${{github.event.pull_request.head.sha}} ${{github.event.number}} - # - name: Compare benchmark result and fail if threshold is reached - # uses: benchmark-action/github-action-benchmark@v1 - # with: - # # What benchmark tool the output.txt came from - # tool: 'benchmarkjs' - # # Where the output from the benchmark tool is stored - # output-file-path: benchmark-data.txt - # # Where the previous data file is stored - # external-data-json-path: web3-benchmark-main.json - # # Workflow will fail when an alert happens - # fail-on-alert: true - # # Enable alert commit comment - # alert-threshold: '200%' - # comment-always: false - # - run: gh cache delete "${{ runner.os }}-web3-benchmark-main.json" - # if: github.event_name == 'push' && github.ref == 'refs/heads/4.x' - # env: - # GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # - name: Save main branch benchmark data - # uses: actions/cache/save@v4 - # if: github.event_name == 'push' && github.ref == 'refs/heads/4.x' - # with: - # path: web3-benchmark-main.json - # key: ${{ runner.os }}-web3-benchmark-main.json + deploy-docs: + name: Docs CloudFlare Deploy + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + deployments: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + cache: yarn + node-version: '18' + - uses: actions/cache/restore@v4 + with: + path: ./ + key: web3-18-${{github.sha}} + - run: yarn install --ignore-scripts + - run: yarn build:cjs + - run: yarn run build:docs + - name: Publish to Cloudflare Pages + uses: cloudflare/pages-action@v1 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: 2238a825c5aca59233eab1f221f7aefb + projectName: web3-js-docs + directory: ./docs/build + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + benchmark: + name: Benchmark Tests + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v4 + with: + node-version: 18 + - uses: actions/cache/restore@v4 + with: + path: ./ + key: web3-18-${{github.sha}} + # @octokit/core not supported on node 16, so I can't add it to the package.json + - run: npm install --no-package-lock --no-save --force @octokit/core@5.1.0 + - name: Restore main branch benchmark data + uses: actions/cache/restore@v4 + with: + path: web3-benchmark-main.json + key: ${{ runner.os }}-web3-benchmark-main.json + - run: yarn test:benchmark + - name: Compare benchmark result and make comment + uses: benchmark-action/github-action-benchmark@v1 + with: + # What benchmark tool the output.txt came from + tool: 'benchmarkjs' + # Where the output from the benchmark tool is stored + output-file-path: benchmark-data.txt + # Where the previous data file is stored + external-data-json-path: web3-benchmark-main.json + # Workflow will fail when an alert happens + fail-on-alert: false + # GitHub API token to make a commit comment + github-token: ${{ secrets.GITHUB_TOKEN }} + # Enable alert commit comment + comment-always: true + save-data-file: false + # copy comment from commit to Pull Request + - run: node scripts/copyCommitCommentToPrComment.js ${{ secrets.GITHUB_TOKEN }} ${{github.event.pull_request.head.sha}} ${{github.event.number}} + - name: Compare benchmark result and fail if threshold is reached + uses: benchmark-action/github-action-benchmark@v1 + with: + # What benchmark tool the output.txt came from + tool: 'benchmarkjs' + # Where the output from the benchmark tool is stored + output-file-path: benchmark-data.txt + # Where the previous data file is stored + external-data-json-path: web3-benchmark-main.json + # Workflow will fail when an alert happens + fail-on-alert: true + # Enable alert commit comment + alert-threshold: '200%' + comment-always: false + - run: gh cache delete "${{ runner.os }}-web3-benchmark-main.json" + if: github.event_name == 'push' && github.ref == 'refs/heads/4.x' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Save main branch benchmark data + uses: actions/cache/save@v4 + if: github.event_name == 'push' && github.ref == 'refs/heads/4.x' + with: + path: web3-benchmark-main.json + key: ${{ runner.os }}-web3-benchmark-main.json diff --git a/packages/web3-account-abstraction/package.json b/packages/web3-account-abstraction/package.json index da8b89c1e35..efbaa27231c 100644 --- a/packages/web3-account-abstraction/package.json +++ b/packages/web3-account-abstraction/package.json @@ -39,7 +39,7 @@ "test:ci": "jest --coverage=true --coverage-reporters=json --verbose", "test:watch": "npm test -- --watch", "test:unit": "jest --config=./test/unit/jest.config.js", - "test:integration": "exit 0" + "test:integration": "jest --config=./test/integration/jest.config.js --passWithNoTests" }, "devDependencies": { "@types/jest": "^28.1.6", diff --git a/packages/web3-core/package.json b/packages/web3-core/package.json index 7a4038176aa..67cebb09009 100644 --- a/packages/web3-core/package.json +++ b/packages/web3-core/package.json @@ -39,7 +39,7 @@ "test:ci": "jest --coverage=true --coverage-reporters=json --verbose", "test:watch": "npm test -- --watch", "test:unit": "jest --config=./test/unit/jest.config.js", - "test:integration": "exit 0" + "test:integration": "jest --config=./test/integration/jest.config.js --passWithNoTests" }, "dependencies": { "web3-errors": "^1.3.0", diff --git a/packages/web3-errors/package.json b/packages/web3-errors/package.json index bf3728c6d80..c20818ca8a2 100644 --- a/packages/web3-errors/package.json +++ b/packages/web3-errors/package.json @@ -38,7 +38,7 @@ "test:ci": "jest --coverage=true --coverage-reporters=json --verbose", "test:watch": "npm test -- --watch", "test:unit": "jest --config=./test/unit/jest.config.js", - "test:integration": "exit 0" + "test:integration": "jest --config=./test/integration/jest.config.js --passWithNoTests" }, "dependencies": { "web3-types": "^1.7.0" diff --git a/packages/web3-eth-abi/package.json b/packages/web3-eth-abi/package.json index b8e15c1d7db..71ad43e1bf8 100644 --- a/packages/web3-eth-abi/package.json +++ b/packages/web3-eth-abi/package.json @@ -39,7 +39,7 @@ "test:ci": "jest --coverage=true --coverage-reporters=json --verbose", "test:watch": "npm test -- --watch", "test:unit": "jest --config=./test/unit/jest.config.js", - "test:integration": "exit 0" + "test:integration": "jest --config=./test/integration/jest.config.js --passWithNoTests" }, "dependencies": { "abitype": "0.7.1", diff --git a/packages/web3-eth-accounts/package.json b/packages/web3-eth-accounts/package.json index bdea82fbc21..cc411137242 100644 --- a/packages/web3-eth-accounts/package.json +++ b/packages/web3-eth-accounts/package.json @@ -39,7 +39,7 @@ "test:ci": "jest --coverage=true --coverage-reporters=json --verbose", "test:watch": "npm test -- --watch", "test:unit": "jest --config=./test/unit/jest.config.js", - "test:integration": "exit 0" + "test:integration": "jest --config=./test/integration/jest.config.js" }, "devDependencies": { "@types/jest": "^28.1.6", diff --git a/packages/web3-eth-contract/package.json b/packages/web3-eth-contract/package.json index 0cd539d966b..20b368174c8 100644 --- a/packages/web3-eth-contract/package.json +++ b/packages/web3-eth-contract/package.json @@ -39,7 +39,7 @@ "test:ci": "jest --coverage=true --coverage-reporters=json --verbose", "test:watch": "npm test -- --watch", "test:unit": "jest --config=./test/unit/jest.config.js", - "test:integration": "jest --config=./test/integration/jest.config.js --runInBand --detectOpenHandles", + "test:integration": "jest --config=./test/integration/jest.config.js --runInBand", "test:e2e:electron": "npx cypress run --headless --browser electron --env grep='ignore',invert=true", "test:e2e:chrome": "npx cypress run --headless --browser chrome --env grep='ignore',invert=true", "test:e2e:firefox": "npx cypress run --headless --browser firefox --env grep='ignore',invert=true" diff --git a/packages/web3-eth-contract/test/integration/contract_deploy.test.ts b/packages/web3-eth-contract/test/integration/contract_deploy.test.ts index 76cfbafcb46..e4833882e94 100644 --- a/packages/web3-eth-contract/test/integration/contract_deploy.test.ts +++ b/packages/web3-eth-contract/test/integration/contract_deploy.test.ts @@ -17,13 +17,11 @@ along with web3.js. If not, see . import { Web3Eth } from 'web3-eth'; import { FMT_BYTES, FMT_NUMBER } from 'web3-types'; import { Contract, createContractAddress } from '../../src'; -import { sleep } from '../shared_fixtures/utils'; import { ERC721TokenAbi, ERC721TokenBytecode } from '../shared_fixtures/build/ERC721Token'; import { GreeterBytecode, GreeterAbi } from '../shared_fixtures/build/Greeter'; import { DeployRevertAbi, DeployRevertBytecode } from '../shared_fixtures/build/DeployRevert'; import { getSystemTestProvider, - isWs, createTempAccount, createNewAccount, signTxAndSendEIP2930, @@ -245,26 +243,18 @@ describe('contract', () => { it('should emit the "confirmation" event', async () => { const confirmationHandler = jest.fn(); - contract.setConfig({ transactionConfirmationBlocks: 1 }); - await contract + contract.setConfig({ transactionConfirmationBlocks: 2 }); + + const promiEvent = contract .deploy(deployOptions) .send(sendOptions) .on('confirmation', confirmationHandler); - // Wait for some time to allow the transaction to be processed - await sleep(500); - - // Deploy once again to trigger block mining to trigger confirmation - // We can send any other transaction as well - await contract.deploy(deployOptions).send(sendOptions); + // Deploy the contract + await promiEvent; await sendFewSampleTxs(3); - // Wait for some fraction of time to trigger the handler - // On http we use polling to get confirmation, so wait a bit longer - await sleep(isWs ? 500 : 2000); - - // eslint-disable-next-line jest/no-standalone-expect expect(confirmationHandler).toHaveBeenCalled(); }); diff --git a/packages/web3-eth-ens/package.json b/packages/web3-eth-ens/package.json index c85f1bc6e25..e18474e0140 100644 --- a/packages/web3-eth-ens/package.json +++ b/packages/web3-eth-ens/package.json @@ -39,7 +39,7 @@ "test:ci": "jest --coverage=true --coverage-reporters=json --verbose", "test:watch": "npm test -- --watch", "test:unit": "jest --config=./test/unit/jest.config.js", - "test:integration": "exit 0", + "test:integration": "jest --config=./test/integration/jest.config.js", "ens:download:registry": "curl -L -o test/fixtures/ens/registry.json 'https://api.etherscan.io/api?module=contract&action=getabi&address=0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e'", "ens:download:reverse_registrar": "curl -L -o test/fixtures/ens/reverse_registrar.json 'https://api.etherscan.io/api?module=contract&action=getabi&address=0x084b1c3c81545d370f3634392de611caabff8148'" }, diff --git a/packages/web3-eth/package.json b/packages/web3-eth/package.json index f03b1b7dd4d..6cd93768a6b 100644 --- a/packages/web3-eth/package.json +++ b/packages/web3-eth/package.json @@ -40,7 +40,7 @@ "test:e2e:sepolia": "jest --config=./test/e2e/jest.config.js --forceExit", "test:watch": "npm test -- --watch", "test:unit": "jest --config=./test/unit/jest.config.js", - "test:integration": "exit 0", + "test:integration": "jest --config=./test/integration/jest.config.js --runInBand", "test:coverage:integration": "jest --config=./test/integration/jest.config.js --runInBand --forceExit --coverage=true --coverage-reporters=text", "test:e2e:electron": "npx cypress run --headless --browser electron", "test:e2e:chrome": "npx cypress run --headless --browser chrome", diff --git a/packages/web3-providers-ws/package.json b/packages/web3-providers-ws/package.json index 8ba5db94e2e..49595cc21df 100644 --- a/packages/web3-providers-ws/package.json +++ b/packages/web3-providers-ws/package.json @@ -39,7 +39,7 @@ "test:ci": "jest --coverage=true --coverage-reporters=json --verbose", "test:watch": "npm test -- --watch", "test:unit": "jest --config=./test/unit/jest.config.js", - "test:integration": "exit 0" + "test:integration": "jest --config=./test/integration/jest.config.js" }, "devDependencies": { "@types/express": "^4.17.13", diff --git a/packages/web3/package.json b/packages/web3/package.json index d214d931888..06565aeb4a3 100644 --- a/packages/web3/package.json +++ b/packages/web3/package.json @@ -52,7 +52,7 @@ "test:ci": "jest --coverage=true --coverage-reporters=json --verbose", "test:watch": "npm test -- --watch", "test:unit": "jest --config=./test/unit/jest.config.js", - "test:integration": "exit 0", + "test:integration": "jest --config=./test/integration/jest.config.js --forceExit", "test:integration:stress": "jest --config=./test/stress/jest.config.js --forceExit", "test:blackbox:hardhat:http": "./scripts/black_box_test.sh hardhat http", "test:blackbox:hardhat:ws": "./scripts/black_box_test.sh hardhat ws",