Skip to content

Commit

Permalink
Add custom jest config for OpenRPC tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-senechal committed May 30, 2024
1 parent b7731fd commit 86d22bd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/openrpc-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 13 additions & 0 deletions packages/massa-web3/jest-open-rpc.config.ts
Original file line number Diff line number Diff line change
@@ -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: [
'<rootDir>/packages/massa-web3/test/open_rpc/*.(spec|test).ts?(x)',
],
}

export default config
3 changes: 3 additions & 0 deletions packages/massa-web3/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const config: Config.InitialOptions = {
rootDir: '../..',
displayName: 'massa-web3',
testMatch: ['<rootDir>/packages/massa-web3/test/**/*.(spec|test).ts?(x)'],
testPathIgnorePatterns: [
'<rootDir>/packages/massa-web3/test/open_rpc/publicAPI.spec.ts',
],
}

export default config
1 change: 1 addition & 0 deletions packages/massa-web3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 86d22bd

Please sign in to comment.