Is there a way to run truffle test and not recompile the solidity code each time? It takes a lot of time if i just want to play around with the javascript tests...



Since January 2020 Truffle suite has option --compile-none

With this option enabled it tests compiled contracts from build/contracts directory.

Here is how it looks like in Truffle v5.1.55:

PS D:\work\ERC20> truffle test  --compile-none                        
Using network 'test'.

Compiling your contracts...
> Everything is up to date, there is nothing to compile.
  • 1
    Thank you, this should be marked as the correct answer.
    – vallard
    Apr 24 '21 at 6:13

This is a known issue with truffle. As of Nov 2018 and the latest version 4.1.14, there is no out-of-the-box solution. There is a workaround, albeit a bit messy:

Create an empty folder called migrations_null and then run your tests like this:

truffle test --migrations_directory migrations_null
  • It only solves the problem with migration, but then I don't have an access to my contracts. It says that they were not deployed. It will still compile all contracts.
    – Rob Magier
    Feb 3 '19 at 23:01

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.