Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests & ESLint Improvements #7012

Merged
merged 25 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 72 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- run: yarn install --ignore-scripts
- run: npx ts-node scripts/init.ts
- run: yarn build:cjs
- uses: actions/cache/save@v3
- uses: actions/cache/save@v4
with:
path: ./
key: web3-${{ matrix.node }}-${{github.sha}}
Expand All @@ -39,7 +39,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/cache/restore@v3
- uses: actions/cache/restore@v4
with:
path: ./
key: web3-18-${{github.sha}}
Expand All @@ -52,7 +52,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/cache/restore@v3
- uses: actions/cache/restore@v4
with:
path: ./
key: web3-18-${{github.sha}}
Expand All @@ -65,12 +65,65 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/cache/restore@v3
- uses: actions/cache/restore@v4
with:
path: ./
key: web3-18-${{github.sha}}
- run: npx ts-node scripts/init.ts
# restore cache for each package from main branch
- name: Restore eslint caches
# if: github.event_name == 'push' && github.ref == 'refs/heads/4.x'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be uncommented?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no. we need to restore everytime when we check. remove comment

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 }}

- 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
Expand All @@ -80,13 +133,13 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/cache/restore@v3
- 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@v3
uses: actions/cache/restore@v4
with:
path: packages/web3/dist/4.x.json
key: web3-bundle-stats-4x-${{github.event.pull_request.base.sha}}
Expand All @@ -101,7 +154,7 @@ jobs:
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@v3
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
Expand All @@ -120,7 +173,7 @@ jobs:
with:
architecture: x64
node-version: ${{ matrix.node }}
- uses: actions/cache/restore@v3
- uses: actions/cache/restore@v4
with:
path: ./
key: web3-${{ matrix.node }}-${{github.sha}}
Expand All @@ -142,7 +195,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/cache/restore@v3
- uses: actions/cache/restore@v4
with:
path: ./
key: web3-18-${{github.sha}}
Expand All @@ -165,7 +218,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/cache/restore@v3
- uses: actions/cache/restore@v4
with:
path: ./
key: web3-18-${{github.sha}}
Expand All @@ -186,7 +239,7 @@ jobs:
node-version: 18
- uses: browser-actions/setup-firefox@latest
if: matrix.browser == 'firefox'
- uses: actions/cache/restore@v3
- uses: actions/cache/restore@v4
with:
path: ./
key: web3-18-${{github.sha}}
Expand All @@ -212,7 +265,7 @@ jobs:
with:
cache: yarn
node-version: '18'
- uses: actions/cache/restore@v3
- uses: actions/cache/restore@v4
with:
path: ./
key: web3-18-${{github.sha}}
Expand All @@ -235,14 +288,14 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/cache/restore@v3
- 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@v3
uses: actions/cache/restore@v4
with:
path: web3-benchmark-main.json
key: ${{ runner.os }}-web3-benchmark-main.json
Expand Down Expand Up @@ -279,8 +332,12 @@ jobs:
# 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@v3
uses: actions/cache/save@v4
if: github.event_name == 'push' && github.ref == 'refs/heads/4.x'
with:
path: web3-benchmark-main.json
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ packages/web3/.in3/

# benchmark results
benchmark-data.txt

.eslintcache
4 changes: 2 additions & 2 deletions packages/web3-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"build:esm": "tsc --build tsconfig.esm.json && echo '{\"type\": \"module\"}' > ./lib/esm/package.json",
"build:types": "tsc --build tsconfig.types.json",
"build:check": "node -e \"require('./lib')\"",
"lint": "eslint --ext .js,.ts .",
"lint": "eslint --cache --cache-strategy content --ext .ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"format": "prettier --write '**/*'",
"test": "jest --config=./test/unit/jest.config.js",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unneccesary extra space

Copy link
Contributor Author

@avkos avkos Apr 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in all packages

"test:coverage:integration": "jest --config=./test/integration/jest.config.js --passWithNoTests --coverage=true --coverage-reporters=text",
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
"test:watch": "npm test -- --watch",
Expand Down
4 changes: 2 additions & 2 deletions packages/web3-errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"build:esm": "tsc --build tsconfig.esm.json && echo '{\"type\": \"module\"}' > ./lib/esm/package.json",
"build:types": "tsc --build tsconfig.types.json",
"build:check": "node -e \"require('./lib')\"",
"lint": "eslint --ext .js,.ts .",
"lint": "eslint --cache --cache-strategy content --ext .ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"format": "prettier --write '**/*'",
"test": "jest --config=./test/unit/jest.config.js",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
"test:watch": "npm test -- --watch",
"test:unit": "jest --config=./test/unit/jest.config.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/web3-eth-abi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"build:esm": "tsc --build tsconfig.esm.json && echo '{\"type\": \"module\"}' > ./lib/esm/package.json",
"build:types": "tsc --build tsconfig.types.json",
"build:check": "node -e \"require('./lib')\"",
"lint": "eslint --ext .js,.ts .",
"lint": "eslint --cache --cache-strategy content --ext .ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"format": "prettier --write '**/*'",
"test": "jest --config=./test/unit/jest.config.js",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:integration": "jest --config=./test/integration/jest.config.js --passWithNoTests --coverage=true --coverage-reporters=text",
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
"test:watch": "npm test -- --watch",
Expand Down
4 changes: 2 additions & 2 deletions packages/web3-eth-accounts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"build:esm": "tsc --build tsconfig.esm.json && echo '{\"type\": \"module\"}' > ./lib/esm/package.json",
"build:types": "tsc --build tsconfig.types.json",
"build:check": "node -e \"require('./lib')\"",
"lint": "eslint --ext .js,.ts .",
"lint": "eslint --cache --cache-strategy content --ext .ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"format": "prettier --write '**/*'",
"test": "jest --config=./test/unit/jest.config.js",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:integration": "jest --config=./test/integration/jest.config.js --coverage=true --coverage-reporters=text",
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
"test:watch": "npm test -- --watch",
Expand Down
4 changes: 2 additions & 2 deletions packages/web3-eth-contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"build:esm": "tsc --build tsconfig.esm.json && echo '{\"type\": \"module\"}' > ./lib/esm/package.json",
"build:types": "tsc --build tsconfig.types.json",
"build:check": "node -e \"require('./lib')\"",
"lint": "eslint --ext .js,.ts .",
"lint": "eslint --cache --cache-strategy content --ext .ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"format": "prettier --write '**/*'",
"test": "jest --config=./test/unit/jest.config.js",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:integration": "jest --config=./test/integration/jest.config.js --runInBand --forceExit --coverage=true --coverage-reporters=text",
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
"test:watch": "npm test -- --watch",
Expand Down
4 changes: 2 additions & 2 deletions packages/web3-eth-ens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"build:esm": "tsc --build tsconfig.esm.json && echo '{\"type\": \"module\"}' > ./lib/esm/package.json",
"build:types": "tsc --build tsconfig.types.json",
"build:check": "node -e \"require('./lib')\"",
"lint": "eslint --ext .js,.ts .",
"lint": "eslint --cache --cache-strategy content --ext .ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"format": "prettier --write '**/*'",
"test": "jest --config=./test/unit/jest.config.js",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:integration": "jest --config=./test/integration/jest.config.js --coverage=true --coverage-reporters=text",
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
"test:watch": "npm test -- --watch",
Expand Down
4 changes: 2 additions & 2 deletions packages/web3-eth-iban/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"build:esm": "tsc --build tsconfig.esm.json && echo '{\"type\": \"module\"}' > ./lib/esm/package.json",
"build:types": "tsc --build tsconfig.types.json",
"build:check": "node -e \"require('./lib')\"",
"lint": "eslint --ext .js,.ts .",
"lint": "eslint --cache --cache-strategy content --ext .ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"format": "prettier --write '**/*'",
"test": "jest --config=./test/unit/jest.config.js",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:integration": "jest --config=./test/integration/jest.config.js --passWithNoTests --runInBand --coverage=true --coverage-reporters=text",
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
"test:watch": "npm test -- --watch",
Expand Down
4 changes: 2 additions & 2 deletions packages/web3-eth-personal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"build:esm": "tsc --build tsconfig.esm.json && echo '{\"type\": \"module\"}' > ./lib/esm/package.json",
"build:types": "tsc --build tsconfig.types.json",
"build:check": "node -e \"require('./lib')\"",
"lint": "eslint --ext .js,.ts .",
"lint": "eslint --cache --cache-strategy content --ext .ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"format": "prettier --write '**/*'",
"test": "jest --config=./test/unit/jest.config.js",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:integration": "jest --config=./test/integration/jest.config.js --coverage=true --coverage-reporters=text",
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
"test:watch": "npm test -- --watch",
Expand Down
4 changes: 2 additions & 2 deletions packages/web3-eth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"build:esm": "tsc --build tsconfig.esm.json && echo '{\"type\": \"module\"}' > ./lib/esm/package.json",
"build:types": "tsc --build tsconfig.types.json",
"build:check": "node -e \"require('./lib')\"",
"lint": "eslint --ext .js,.ts .",
"lint": "eslint --cache --cache-strategy content --ext .ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"format": "prettier --write '**/*'",
"test": "jest --config=./test/unit/jest.config.js",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
"test:e2e:mainnet": "jest --config=./test/e2e/jest.config.js --forceExit",
"test:e2e:sepolia": "jest --config=./test/e2e/jest.config.js --forceExit",
Expand Down
4 changes: 2 additions & 2 deletions packages/web3-net/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"build:esm": "tsc --build tsconfig.esm.json && echo '{\"type\": \"module\"}' > ./lib/esm/package.json",
"build:types": "tsc --build tsconfig.types.json",
"build:check": "node -e \"require('./lib')\"",
"lint": "eslint --ext .js,.ts .",
"lint": "eslint --cache --cache-strategy content --ext .ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"format": "prettier --write '**/*'",
"test": "jest --config=./test/unit/jest.config.js",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:integration": "jest --config=./test/integration/jest.config.js --passWithNoTests --coverage=true --coverage-reporters=text",
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
"test:watch": "npm test -- --watch",
Expand Down
4 changes: 2 additions & 2 deletions packages/web3-providers-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"build:esm": "tsc --build tsconfig.esm.json && echo '{\"type\": \"module\"}' > ./lib/esm/package.json",
"build:types": "tsc --build tsconfig.types.json",
"build:check": "node -e \"require('./lib')\"",
"lint": "eslint --ext .js,.ts .",
"lint": "eslint --cache --cache-strategy content --ext .ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"format": "prettier --write '**/*'",
"test": "jest --config=./test/unit/jest.config.js",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:integration": "jest --config=./test/integration/jest.config.js --coverage=true --coverage-reporters=text",
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
"test:watch": "npm test -- --watch",
Expand Down
4 changes: 2 additions & 2 deletions packages/web3-providers-ipc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"build:esm": "tsc --build tsconfig.esm.json && echo '{\"type\": \"module\"}' > ./lib/esm/package.json",
"build:types": "tsc --build tsconfig.types.json",
"build:check": "node -e \"require('./lib')\"",
"lint": "eslint --ext .js,.ts .",
"lint": "eslint --cache --cache-strategy content --ext .ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"format": "prettier --write '**/*'",
"test": "jest --config=./test/unit/jest.config.js",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:integration": "jest --config=./test/integration/jest.config.js --coverage=true --coverage-reporters=text",
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
"test:watch": "npm test -- --watch",
Expand Down
Loading
Loading