-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathrunTests.js
More file actions
46 lines (39 loc) · 1.7 KB
/
Copy pathrunTests.js
File metadata and controls
46 lines (39 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* eslint-disable @typescript-eslint/no-floating-promises */
/* eslint-disable no-console */
// eslint-disable-next-line import/no-extraneous-dependencies
const { run } = require('jest-cli')
async function runTests() {
try {
// Check if a specific test path was provided as an argument
const args = process.argv.slice(2)
const specificTestPath = args[0]
// Extract any additional arguments (skip the first one if it's a test path)
const additionalArgs = specificTestPath ? args.slice(1) : args
if (specificTestPath) {
// Run only the specific test path with any additional arguments
console.log(`Running specific test: ${specificTestPath}`)
await run([specificTestPath, '--forceExit=true', ...additionalArgs])
return
}
// No specific path provided, run the default sequence
// Run the portfolio test first in isolation. This is required
// to ensure that the 'batching works' test doesn't intercept requests
// from other tests.
console.log('Running portfolio test in isolation...')
await run(['src/libs/portfolio/portfolio.test.ts', ...additionalArgs])
// Run the assetInfo test in isolation to avoid conflicts with other tests
console.log('Running assetInfo test in isolation...')
await run(['src/services/assetInfo/assetInfo.test.ts', ...additionalArgs])
// Run remaining tests in parallel
console.log('Running all remaining tests...')
await run([
'--forceExit=true',
'--testPathIgnorePatterns=src/services/assetInfo/assetInfo.test.ts|src/libs/portfolio/portfolio.test.ts',
...additionalArgs
])
} catch (error) {
console.error('Test execution failed:', error)
process.exit(1)
}
}
runTests()