Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

got Stuck In Testing #6105

humayoualisaral started this conversation in Show and tell
Discussion options

const {expect,assert}=require("chai")
const { describe, beforeEach, it } = require("node:test")
describe("SimpleStorage",function(){
 let contractFactory,simpleStorage
 beforeEach(async()=>{
 contractFactory=await ethers.getContractFactory("SimpleStorage")
 simpleStorage=await contractFactory.deploy()
 })
 it("it should start with the favourite number of 0",async function(){
 const currentValue=await simpleStorage.retrieve()
 const expectedValue="1" 
 assert.equal(currentValue.toString(),expectedValue)
 })
})

Error:


 0 passing (1ms)
# Subtest: SimpleStorage
 # Subtest: it should start with the favourite number of 0
 not ok 1 - it should start with the favourite number of 0
 ---
 duration_ms: 2362.802989
 failureType: 'hookFailed'
 error: 'failed running beforeEach hook'
 code: 'ERR_TEST_FAILURE'
 stack: |-
 Artifacts._handleWrongArtifactForContractName (/media/humayou/272F73E63EAB4DD6/hardHat/SimpleStorage/node_modules/hardhat/src/internal/artifacts.ts:700:11)
 Artifacts._getArtifactPathFromFiles (/media/humayou/272F73E63EAB4DD6/hardHat/SimpleStorage/node_modules/hardhat/src/internal/artifacts.ts:825:19)
 Artifacts._getArtifactPath (/media/humayou/272F73E63EAB4DD6/hardHat/SimpleStorage/node_modules/hardhat/src/internal/artifacts.ts:505:21)
 Artifacts.readArtifact (/media/humayou/272F73E63EAB4DD6/hardHat/SimpleStorage/node_modules/hardhat/src/internal/artifacts.ts:71:26)
 getContractFactory (/media/humayou/272F73E63EAB4DD6/hardHat/SimpleStorage/node_modules/@nomicfoundation/hardhat-ethers/src/internal/helpers.ts:107:22)
 Object.<anonymous> (/media/humayou/272F73E63EAB4DD6/hardHat/SimpleStorage/test/Lock.js:7:21)
 TestHook.run (node:internal/test_runner/test:544:9)
 node:internal/test_runner/test:487:9
 Suite.runHook (node:internal/test_runner/test:485:7)
 ItTest.run (node:internal/test_runner/test:519:9)
 ...
 1..1
not ok 1 - SimpleStorage
 ---
 duration_ms: 2366.639547
 failureType: 'subtestsFailed'
 error: '1 subtest failed'
 code: 'ERR_TEST_FAILURE'
 ...
You must be logged in to vote

Replies: 1 comment

Comment options

Hi @HUMAYOU-ALI-SARAL,
Try to clean cache files and artifices by
npx hardhat clean or yarn hardhat clean

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /