Skip to content

Commit e3d4233

Browse files
committed
common: move globalSetup to beforeAll
1 parent cc86522 commit e3d4233

5 files changed

Lines changed: 14 additions & 13 deletions

File tree

packages/indexer-common/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const bail = (s) => {
66
process.env.NODE_NO_WARNINGS = '1'
77

88
module.exports = {
9-
globalSetup: '<rootDir>/src/__tests__/global-setup.ts',
9+
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
1010
collectCoverage: true,
1111
preset: 'ts-jest',
1212
forceExit: true,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Logger } from '@graphprotocol/common-ts'
2+
import { initNetworkRegistryESM } from './src'
3+
4+
5+
beforeAll(async () => {
6+
const logger = new Logger({ name: 'global-setup', level: 'error' })
7+
await initNetworkRegistryESM(logger)
8+
})

packages/indexer-common/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
"lint": "eslint . --ext .ts,.tsx --fix",
1616
"compile": "tsc",
1717
"prepare": "yarn format && yarn lint && yarn compile",
18-
"test": "LOG_LEVEL=info jest --colors --verbose --runInBand --detectOpenHandles",
19-
"test:ci": "LOG_LEVEL=info jest --verbose --maxWorkers=1 --ci",
20-
"test:debug": "LOG_LEVEL=debug jest --runInBand --detectOpenHandles --verbose",
21-
"test:watch": "jest --runInBand --detectOpenHandles --watch --passWithNoTests --verbose",
18+
"test": "NODE_OPTIONS='--experimental-vm-modules' LOG_LEVEL=info jest --colors --verbose --runInBand --detectOpenHandles",
19+
"test:ci": "NODE_OPTIONS='--experimental-vm-modules' LOG_LEVEL=info jest --verbose --maxWorkers=1 --ci",
20+
"test:debug": "NODE_OPTIONS='--experimental-vm-modules 'LOG_LEVEL=debug node jest --runInBand --detectOpenHandles --verbose",
21+
"test:watch": "NODE_OPTIONS='--experimental-vm-modules' jest --runInBand --detectOpenHandles --watch --passWithNoTests --verbose",
2222
"clean": "rm -rf ./node_modules ./dist ./tsconfig.tsbuildinfo"
2323
},
2424
"dependencies": {

packages/indexer-common/src/__tests__/global-setup.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/indexer-common/src/network.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ async function connectToProtocolContracts(
550550
const numericNetworkId = parseInt(networkIdentifier.split(':')[1])
551551

552552
// Confidence check: Should be unreachable since NetworkSpecification was validated before
553-
if (resolveChainId(networkIdentifier) !== networkIdentifier) {
553+
if (resolveChainId(networkIdentifier)) {
554554
throw new Error(`Invalid network identifier: ${networkIdentifier}`)
555555
}
556556

0 commit comments

Comments
 (0)