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

Fix unstable tests [DRAFT] #6857

Merged
merged 18 commits into from
Mar 7, 2024
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ jobs:
steps:
- uses: actions/setup-node@v4
with:
architecture: x64
node-version: ${{ matrix.node }}
- uses: actions/cache/restore@v3
with:
Expand Down
14 changes: 7 additions & 7 deletions packages/web3-core/test/config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
rootDir: '../..',
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/config/setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
},
verbose: false,
collectCoverage: false,
coverageReporters: ['json'],
Expand Down
12 changes: 6 additions & 6 deletions packages/web3-eth-abi/test/config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
rootDir: '../..',
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/config/setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
Expand Down
12 changes: 6 additions & 6 deletions packages/web3-eth-contract/test/config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
rootDir: '../..',
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/config/setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
Expand Down
12 changes: 6 additions & 6 deletions packages/web3-eth-personal/test/config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
rootDir: '../..',
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/config/setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
Expand Down
12 changes: 6 additions & 6 deletions packages/web3-net/test/config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
rootDir: '../..',
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/config/setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
Expand Down
12 changes: 6 additions & 6 deletions packages/web3-providers-ipc/test/config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
rootDir: '../..',
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/config/setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
Expand Down
12 changes: 6 additions & 6 deletions packages/web3-types/test/config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
rootDir: '../..',
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/config/setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
verbose: false,
collectCoverage: false,
Expand Down
14 changes: 7 additions & 7 deletions packages/web3-utils/test/config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
rootDir: '../..',
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/config/setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
},
verbose: false,
collectCoverage: false,
coverageReporters: ['json'],
Expand Down
12 changes: 6 additions & 6 deletions packages/web3-validator/test/config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
rootDir: '../..',
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/config/setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
Expand Down
22 changes: 22 additions & 0 deletions packages/web3-validator/test/integration/void.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
This file is part of web3.js.

web3.js is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

web3.js is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
*/

describe('Web3 validator test', () => {
it('void', () => {
expect(1).toBe(1);
});
});
7 changes: 6 additions & 1 deletion packages/web3/test/cjs_black_box/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ module.exports = {
},
},
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
};
12 changes: 6 additions & 6 deletions packages/web3/test/config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
rootDir: '../..',
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/config/setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
Expand Down
7 changes: 6 additions & 1 deletion packages/web3/test/esm_black_box/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ export default {
},
},
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
};
8 changes: 4 additions & 4 deletions scripts/geth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ start() {
if [ -z "${ORIGARGS[1]}" ]
then
echo "Starting geth..."
echo "docker run -p $WEB3_SYSTEM_TEST_PORT:$WEB3_SYSTEM_TEST_PORT ethereum/client-go:latest --nodiscover --nousb --ws --ws.addr 0.0.0.0 --ws.port $WEB3_SYSTEM_TEST_PORT --http --http.addr 0.0.0.0 --http.port $WEB3_SYSTEM_TEST_PORT --allow-insecure-unlock --http.api personal,web3,eth,admin,debug,txpool,net --ws.api personal,web3,eth,admin,debug,miner,txpool,net --dev"
docker run -p $WEB3_SYSTEM_TEST_PORT:$WEB3_SYSTEM_TEST_PORT ethereum/client-go:latest --nodiscover --nousb --ws --ws.addr 0.0.0.0 --ws.port $WEB3_SYSTEM_TEST_PORT --http --http.addr 0.0.0.0 --http.port $WEB3_SYSTEM_TEST_PORT --allow-insecure-unlock --http.api personal,web3,eth,admin,debug,txpool,net --ws.api personal,web3,eth,admin,debug,miner,txpool,net --dev
echo "docker run -p $WEB3_SYSTEM_TEST_PORT:$WEB3_SYSTEM_TEST_PORT ethereum/client-go:latest --nodiscover --nousb --cache=12048 --ws --ws.addr 0.0.0.0 --ws.port $WEB3_SYSTEM_TEST_PORT --http --http.addr 0.0.0.0 --http.port $WEB3_SYSTEM_TEST_PORT --allow-insecure-unlock --http.api personal,web3,eth,admin,debug,txpool,net --ws.api personal,web3,eth,admin,debug,miner,txpool,net --dev"
Copy link
Contributor

Choose a reason for hiding this comment

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

docker run -p $WEB3_SYSTEM_TEST_PORT:$WEB3_SYSTEM_TEST_PORT ethereum/client-go:latest --nodiscover --nousb --cache=12048 --ws --ws.addr 0.0.0.0 --ws.port $WEB3_SYSTEM_TEST_PORT --http --http.addr 0.0.0.0 --http.port $WEB3_SYSTEM_TEST_PORT --allow-insecure-unlock --http.api personal,web3,eth,admin,debug,txpool,net --ws.api personal,web3,eth,admin,debug,miner,txpool,net --dev
else
echo "Starting geth..."
echo "docker run -d -p $WEB3_SYSTEM_TEST_PORT:$WEB3_SYSTEM_TEST_PORT ethereum/client-go:latest --nodiscover --nousb --ws --ws.addr 0.0.0.0 --ws.port $WEB3_SYSTEM_TEST_PORT --http --http.addr 0.0.0.0 --http.port $WEB3_SYSTEM_TEST_PORT --allow-insecure-unlock --http.api personal,web3,eth,admin,debug,txpool,net --ws.api personal,web3,eth,admin,debug,miner,txpool,net --dev"
docker run -d -p $WEB3_SYSTEM_TEST_PORT:$WEB3_SYSTEM_TEST_PORT ethereum/client-go:latest --nodiscover --nousb --ws --ws.addr 0.0.0.0 --ws.port $WEB3_SYSTEM_TEST_PORT --http --http.addr 0.0.0.0 --http.port $WEB3_SYSTEM_TEST_PORT --allow-insecure-unlock --http.api personal,web3,eth,admin,debug,txpool,net --ws.api personal,web3,eth,admin,debug,miner,txpool,net --dev
echo "docker run -d -p $WEB3_SYSTEM_TEST_PORT:$WEB3_SYSTEM_TEST_PORT ethereum/client-go:latest --nodiscover --nousb --cache=12048 --ws --ws.addr 0.0.0.0 --ws.port $WEB3_SYSTEM_TEST_PORT --http --http.addr 0.0.0.0 --http.port $WEB3_SYSTEM_TEST_PORT --allow-insecure-unlock --http.api personal,web3,eth,admin,debug,txpool,net --ws.api personal,web3,eth,admin,debug,miner,txpool,net --dev"
docker run -d -p $WEB3_SYSTEM_TEST_PORT:$WEB3_SYSTEM_TEST_PORT ethereum/client-go:latest --nodiscover --nousb --cache=12048 --ws --ws.addr 0.0.0.0 --ws.port $WEB3_SYSTEM_TEST_PORT --http --http.addr 0.0.0.0 --http.port $WEB3_SYSTEM_TEST_PORT --allow-insecure-unlock --http.api personal,web3,eth,admin,debug,txpool,net --ws.api personal,web3,eth,admin,debug,miner,txpool,net --dev
echo "Waiting for geth..."
npx wait-port -t 10000 "$WEB3_SYSTEM_TEST_PORT"
echo "Geth started"
Expand Down
17 changes: 7 additions & 10 deletions templates/jest.config.js.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,20 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
*/
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
},
rootDir: '../..',
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/config/setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
verbose: false,
collectCoverage: false,
coverageReporters: ['json'],
Expand Down
12 changes: 6 additions & 6 deletions tools/web3-plugin-example/test/config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
rootDir: '../..',
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/config/setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: './test/tsconfig.json',
},
],
},
verbose: false,
collectCoverage: false,
Expand Down
Loading