Running build with TravisCI, the command npm run test returns the error: connection not open

@obernardovieira thank you very much for the blog (Test smart contracts like a rockstar), very useful.
However when running build with TravisCI, the command npm run test returns the error:
connection not open

also, the command npm run coverage ultimately fails.

I understand a running instance of ganache is required but I’m not sure how we can fix this.
any thoughts on this?
thanks

1 Like

Hi @m-yahya

thank you so much. Appreciate it :pray:

I think that the problem is because when I first wrote the article, it was possible to run truffle test without having a ganache instance, because it would start its own instance. But then it changed, the article got updated for many other things, but not that one because, in fact, openzepplin was used to have a script and I still use. Since openzeppelin changed to https://github.com/OpenZeppelin/openzeppelin-test-environment, the environment " a local ganache-powered blockchain with unlocked accounts will be spun up" so you don’t see it anywhere in code.

If you want to keep using truffle, I recommend you to look at an old version of openzeppelin where they used the script https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.3.0/scripts/test.sh or at my work here https://github.com/HQ20/starter-kit/blob/master/workspace-blockchain/scripts/test.sh where I still use.
Alternatively, you can start a ganache instance in a container with travis https://github.com/HQ20/starter-kit/blob/master/.travis.yml#L15

Hope this helps :+1:

I’ll take some time to update the article. Many thanks :pray:

1 Like

Thank you very much for the detailed information @obernardovieira.
The use of OpenZeppelin/openzeppelin-test-environment sounds great.

1 Like

Hi @m-yahya and @obernardovieira,

Adding support for coverage is in the Q2 Roadmap for OpenZeppelin Test Environment:

1 Like

A post was split to a new topic: Support for eth-gas-reporter with OpenZeppelin Test Environment?