Hello. I’m trying to take advantage of test-helpers, but I cannot seem to figure this out. Everything “just worked” with truffle and ganache. It doesn’t seem like test-environment is even talking to ganache, it just fails my tests telling my that the contract is not deployed to the “detected network”
I’ve tried test-helpers config to define the provider as my ganache url, but I still see no activity from ganache console like I do with truffle, and I still get the same error.
describe("Wrapped", async function () { const [sender, receiver] = accounts; it("should connect to my deployed contract", async () => { const wrapped = await Wrapped.deployed() });
Returns:
Error: Contract has not been deployed to detected network (network/artifact mismatch)
Extra info: When connecting “time” test-helper and querying time.latestblock, I’m getting words: [ 0 ] in the BN response. It should be the blocknumber reported by ganache, but it is not.
Environment
Truffle, ganache, openzeppelin test-environment with mocha chai.
Sorry. I marked this solved too soon. I’m getting the correct block number now, and seeing activity in Ganache, BUT still getting same error Error: Contract has not been deployed to detected network (network/artifact mismatch)
Even though I’ve deployed my contracts before running tests.
Edit: It seems I’ve updated web3, but not the test-environment provider itself. Openzeppelin is still using some simulated provider, and not my web3 instance.
Update: Solved in a roundabout way, by editing setup-provider in test-environment to override for my own web3 instance, and then manually telling my tests what address each contract is located at. Seems like I’m still missing something, but this was enough to get my back to work.
I’ll probably just keep with the current workaround to force test environment to use my ganache. Unless there is a much simpler way to get test-helpers into truffle environment.
Can somebody add a more detailed description with a code snippet of the changes? I'm potentially facing a similar error as outlined in stackexchange and looking forward to try out the solution.
@frangio Can you provide a good source where the different instances of ganache are explained in more detailed and potentially some approaches on its configuration are shown? Looking forward your help!