0

I have several test files, which I can successfully execute via truffle test (having started a ganache-cli process).

For example:

  • ganache-cli
  • truffle test test/test1.js
  • truffle test test/test2.js

However, when I try to input both files at once, for example:

  • ganache-cli
  • truffle test test/test1.js test/test2.js

Truffle completes the first one successfully, but throws an error for the second one:

Contract: Test2 "before all" hook: prepare suite:
Uncaught Error: Error: LevelUpArrayAdapter named 'blockLogs' index out of range: index 6; length: 6
at C:\Users\barak\AppData\Roaming\npm\node_modules\ganache-cli\build\cli.node.js:85357:23
at C:\Users\barak\AppData\Roaming\npm\node_modules\ganache-cli\build\cli.node.js:85331:5
at C:\Users\barak\AppData\Roaming\npm\node_modules\ganache-cli\build\cli.node.js:85777:12
at C:\Users\barak\AppData\Roaming\npm\node_modules\ganache-cli\build\cli.node.js:85542:19
at C:\Users\barak\AppData\Roaming\npm\node_modules\ganache-cli\build\cli.node.js:87681:7
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
...

Here is my truffle-config.js file:

// See <http://truffleframework.com/docs/advanced/configuration>
module.exports = {
    contracts_build_directory: "./build/contracts",
    networks: {
        development: {
            host: "127.0.0.1",
            port: 8545,
            network_id: "*", // Match any network id
            gas: 4712388, // Gas limit used for deploys
            gasPrice: 100000000000, // Gas price used for deploys
        },
    },
    solc: {
        optimizer: {
            enabled: true,
            runs: 5000000,
        },
    },
};

Does anybody have any idea what I am missing here?

I found this related thread on GitHub, which gives the following explanation:

You throw an error that is unhandled.
Read the error message.
"Uncaught Error" means that something @#$% up and there was no one to clean up.
The program has no choice but to exit.

But it doesn't quite explain why everything works correctly when I truffle test one file at a time.

Thank you!!!

0

I just made a try using the same methodology as you did and it seems to work on my side :

Test

The problem you're submitting might be an error of code in your unit tests. Could you provide the code of the files ?

  • I don't have using network 'development'. Could that be the problem? – goodvibration Jan 24 '18 at 15:09
  • I don't think this is the problem. However maybe playing with the params of your truffle-config and/or using the default one ( without the solc optimizer ) might give different result. Giving a try at that won't cost much and might help stepping forward in understanding why it fails. – Asone Jan 24 '18 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.