From 86d22bd44592815ce63d403a5bead57f0d6c4a73 Mon Sep 17 00:00:00 2001 From: thomas-senechal Date: Thu, 30 May 2024 16:43:43 +0200 Subject: [PATCH] Add custom jest config for OpenRPC tests --- .github/workflows/openrpc-test.yml | 6 +----- packages/massa-web3/jest-open-rpc.config.ts | 13 +++++++++++++ packages/massa-web3/jest.config.ts | 3 +++ packages/massa-web3/package.json | 1 + 4 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 packages/massa-web3/jest-open-rpc.config.ts diff --git a/.github/workflows/openrpc-test.yml b/.github/workflows/openrpc-test.yml index 2c50a87a..7f256e51 100644 --- a/.github/workflows/openrpc-test.yml +++ b/.github/workflows/openrpc-test.yml @@ -32,14 +32,10 @@ jobs: npm run build working-directory: ./ - - name: Install OpenRPC generation dependencies - run: | - npm ci - - name: Generate OpenRPC spec run: | npm run generate - name: Test OpenRPC spec run: | - npm run test + npm run test:openrpc diff --git a/packages/massa-web3/jest-open-rpc.config.ts b/packages/massa-web3/jest-open-rpc.config.ts new file mode 100644 index 00000000..12f8037d --- /dev/null +++ b/packages/massa-web3/jest-open-rpc.config.ts @@ -0,0 +1,13 @@ +import baseConfig from '../../jest.config' +import type { Config } from '@jest/types' + +const config: Config.InitialOptions = { + ...baseConfig, + rootDir: '../..', + displayName: 'massa-web3', + testMatch: [ + '/packages/massa-web3/test/open_rpc/*.(spec|test).ts?(x)', + ], +} + +export default config diff --git a/packages/massa-web3/jest.config.ts b/packages/massa-web3/jest.config.ts index 2095669e..783dc798 100644 --- a/packages/massa-web3/jest.config.ts +++ b/packages/massa-web3/jest.config.ts @@ -6,6 +6,9 @@ const config: Config.InitialOptions = { rootDir: '../..', displayName: 'massa-web3', testMatch: ['/packages/massa-web3/test/**/*.(spec|test).ts?(x)'], + testPathIgnorePatterns: [ + '/packages/massa-web3/test/open_rpc/publicAPI.spec.ts', + ], } export default config diff --git a/packages/massa-web3/package.json b/packages/massa-web3/package.json index b96934aa..611524e4 100644 --- a/packages/massa-web3/package.json +++ b/packages/massa-web3/package.json @@ -21,6 +21,7 @@ "test:watch": "jest --watch", "test:watch:all": "jest --watchAll", "test:cov": "jest --coverage --silent --detectOpenHandles --forceExit", + "test:openrpc": "jest --config 'jest-open-rpc.config.ts'", "test-smart-contract-example": "ts-node ./examples/smartContracts/index.ts", "test-mns": "ts-node ./examples/smartContracts/nameResolver.ts", "test-wallet": "ts-node ./examples/wallet/index.ts",