mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-04 13:05:49 +00:00
refactor jest setup to improve unit/integration test executions (#2322)
* fix test:integration command to run tests directly under ./test/integration * refactor jest setup to have separate config files for integration and unit tests
This commit is contained in:
@@ -4,5 +4,9 @@ const base = require('../../jest.config.base.js')
|
||||
module.exports = {
|
||||
...base,
|
||||
roots: [...base.roots, '<rootDir>/test'],
|
||||
testMatch: [
|
||||
'<rootDir>/test/integration/**/*.test.ts',
|
||||
'<rootDir>/test/integration/*.test.ts',
|
||||
],
|
||||
displayName: 'xrpl.js',
|
||||
}
|
||||
13
packages/xrpl/jest.config.unit.js
Normal file
13
packages/xrpl/jest.config.unit.js
Normal file
@@ -0,0 +1,13 @@
|
||||
// Jest configuration for api
|
||||
const base = require('../../jest.config.base.js')
|
||||
|
||||
module.exports = {
|
||||
...base,
|
||||
roots: [...base.roots, '<rootDir>/test'],
|
||||
testMatch: ['<rootDir>/test/**/*.test.ts'],
|
||||
testPathIgnorePatterns: [
|
||||
'<rootDir>/test/integration',
|
||||
'<rootDir>/test/fixtures',
|
||||
],
|
||||
displayName: 'xrpl.js',
|
||||
}
|
||||
@@ -61,8 +61,8 @@
|
||||
"clean": "rm -rf dist build coverage",
|
||||
"docgen": "tsc --build tsconfig.docs.json && typedoc && echo js.xrpl.org >> ../../docs/CNAME",
|
||||
"prepublish": "npx run-s clean build",
|
||||
"test": "jest --verbose false --silent=false ./test/**/*.test.ts --testPathIgnorePatterns=./test/integration --testPathIgnorePatterns=./test/fixtures",
|
||||
"test:integration": "TS_NODE_PROJECT=tsconfig.build.json jest --verbose false --silent=false --runInBand ./test/integration/**/*.test.ts",
|
||||
"test": "jest --config=jest.config.unit.js --verbose false --silent=false",
|
||||
"test:integration": "TS_NODE_PROJECT=tsconfig.build.json jest --config=jest.config.integration.js --verbose false --silent=false --runInBand",
|
||||
"test:browser": "npm run build && npm run build:browserTests && karma start ./karma.config.js --single-run",
|
||||
"test:watch": "jest --watch --verbose false --silent=false --runInBand ./test/**/*.test.ts --testPathIgnorePatterns=./test/integration --testPathIgnorePatterns=./test/fixtures",
|
||||
"format": "prettier --write '{src,test}/**/*.ts'",
|
||||
|
||||
@@ -437,6 +437,7 @@ describe('Connection', function () {
|
||||
try {
|
||||
await clientContext.client.connect()
|
||||
} catch (error) {
|
||||
// @ts-expect-error -- error.message is expected to be defined
|
||||
expect(error.message).toEqual(
|
||||
"Error: connect() timed out after 5000 ms. If your internet connection is working, the rippled server may be blocked or inaccessible. You can also try setting the 'connectionTimeout' option in the Client constructor.",
|
||||
)
|
||||
|
||||
@@ -49,7 +49,6 @@ export * from './integration.test'
|
||||
export * from './onConnect.test'
|
||||
export * from './regularKey.test'
|
||||
export * from './submitAndWait.test'
|
||||
export * from './wallet.test'
|
||||
|
||||
// Because this does 256 ledger accepts, we do it last
|
||||
export * from './transactions/accountDelete.test'
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import { Wallet } from '../../src'
|
||||
|
||||
const walletSecret = 'shK6YXzwYfnFVn3YZSaMh5zuAddKx'
|
||||
|
||||
const wallet = Wallet.fromSeed(walletSecret)
|
||||
|
||||
export default wallet
|
||||
Reference in New Issue
Block a user