Truffle test: error when passing more than one file as input

Ethereum Asked by goodvibration on November 4, 2020

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:UsersbarakAppDataRoamingnpmnode_modulesganache-clibuildcli.node.js:85357:23
at C:UsersbarakAppDataRoamingnpmnode_modulesganache-clibuildcli.node.js:85331:5
at C:UsersbarakAppDataRoamingnpmnode_modulesganache-clibuildcli.node.js:85777:12
at C:UsersbarakAppDataRoamingnpmnode_modulesganache-clibuildcli.node.js:85542:19
at C:UsersbarakAppDataRoamingnpmnode_modulesganache-clibuildcli.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 <>
module.exports = {
    contracts_build_directory: "./build/contracts",
    networks: {
        development: {
            host: "",
            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!!!

One Answer

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


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

Answered by Asone on November 4, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP