ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

Strangely in Vitest environment sometimes methods do not return response

Open BeycanDeveloper opened this issue 10 months ago • 0 comments

Ethers Version

6.11.1

Search Terms

not return response

Describe the Problem

Strangely the getBlock method does not return response in Vitest environment. It just waits. When I create a normal test.ts file and try it, I get a response without any problem.

Code Snippet

it('Block Timestamp', async () => {
        expect(await tx.getBlockTimestamp()).toBe(1710140424)
    })

    async getBlockTimestamp(): Promise<number> {
        const blockNumber = await this.getBlockNumber()
        const block = await this.ethers.getBlock(blockNumber)
        return block?.timestamp ?? 0
    }

Contract ABI

No response

Errors

No response

Environment

No response

Environment (Other)

No response

BeycanDeveloper avatar Mar 30 '24 13:03 BeycanDeveloper