8

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...

Thanks!

Richard Garfield
  • 1,017
  • 2
  • 10
  • 14

2 Answers2

15

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.

Pak Uula
  • 251
  • 2
  • 3
3

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
Paul Razvan Berg
  • 17,902
  • 6
  • 73
  • 143
  • 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 03 '19 at 23:01