Skip to content

Commit

Permalink
chore: See if we can support TypeScript configs
Browse files Browse the repository at this point in the history
  • Loading branch information
janjakubnanista committed Dec 13, 2023
1 parent 878f278 commit fe7dd54
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { OAppOmniGraphHardhat } from '@layerzerolabs/ua-utils-evm-hardhat'

const config: OAppOmniGraphHardhat = {
contracts: [],
connections: [],
}

export default config
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ describe('task/oapp/wire', () => {
expect(promptToContinueMock).not.toHaveBeenCalled()
})

it('should work with typescript', async () => {
const oappConfig = configPathFixture('valid.config.empty.ts')

await hre.run(TASK_LZ_WIRE_OAPP, { oappConfig })

expect(promptToContinueMock).not.toHaveBeenCalled()
})

it('should have debug output if requested (so called eye test, check the test output)', async () => {
const oappConfig = configPathFixture('valid.config.connected.js')

Expand Down
2 changes: 1 addition & 1 deletion packages/ua-utils-evm-hardhat/src/tasks/oapp/wire.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const action: ActionType<TaskArgs> = async ({ oappConfig: oappConfigPath, logLev
try {
logger.verbose(`Loading config file '${oappConfigPath}'`)

rawConfig = require(resolve(oappConfigPath))
rawConfig = await import(resolve(oappConfigPath))
} catch (error) {
throw new Error(`Unable to read config file '${oappConfigPath}': ${error}`)
}
Expand Down

0 comments on commit fe7dd54

Please sign in to comment.