Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Rerun tests when watch detects changes #269

Open
chevdor opened this issue Sep 20, 2016 · 7 comments
Open

Rerun tests when watch detects changes #269

chevdor opened this issue Sep 20, 2016 · 7 comments

Comments

@chevdor
Copy link

chevdor commented Sep 20, 2016

It would be awesome to be able to call watch as:
truffle watch --network XYZ --tests

As a result, when a change is detected, the tests are executed again.
I made an attempt to add:

if(config.tests) {
   Tasks.test(options, done);
}

at:
https://github.com/ConsenSys/truffle/blob/master/lib/tasks.js#L314

but the tests run only the first time.

@adklempner
Copy link
Contributor

I tried what you did and here is my output:

Rebuilding...
Completed without errors on Tue Sep 20 2016 11:23:11 GMT-0700 (PDT)


  Contract: MetaCoin
    ✓ should put 10000 MetaCoin in the first account
    ✓ should call a function that depends on a linked library (60ms)
    ✓ should send coin correctly (114ms)


  3 passing (486ms)

>> File contracts/Migrations.sol changed.
Rebuilding...
Compiling Migrations.sol...
Writing artifacts to ./build/contracts
>> File build/contracts/Migrations.sol.js changed.
Rebuilding...
Completed without errors on Tue Sep 20 2016 11:24:15 GMT-0700 (PDT)


  0 passing (0ms)

Completed without errors on Tue Sep 20 2016 11:24:15 GMT-0700 (PDT)


  0 passing (0ms)

Looks like on the second time it runs the test task, but it does not pick up the test file.

@chevdor
Copy link
Author

chevdor commented Sep 20, 2016

That's indeed the issue I ran into and the reason I opened a new issue
instead of a PR. Thanks for confirming that you get the same behaviour on
your end.

On Tue, Sep 20, 2016, 20:29 adklempner notifications@github.com wrote:

I tried what you did and here is my output:

Rebuilding...
Completed without errors on Tue Sep 20 2016 11:23:11 GMT-0700 (PDT)

Contract: MetaCoin
✓ should put 10000 MetaCoin in the first account
✓ should call a function that depends on a linked library (60ms)
✓ should send coin correctly (114ms)

3 passing (486ms)

File contracts/Migrations.sol changed.
Rebuilding...
Compiling Migrations.sol...
Writing artifacts to ./build/contracts
File build/contracts/Migrations.sol.js changed.
Rebuilding...
Completed without errors on Tue Sep 20 2016 11:24:15 GMT-0700 (PDT)

0 passing (0ms)

Completed without errors on Tue Sep 20 2016 11:24:15 GMT-0700 (PDT)

0 passing (0ms)

Looks like on the second time it runs the test task, but it does not pick
up the test file.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#269 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAtFpIj9CDv4F78CzH8nQo1MGA14ZEiPks5qsCYLgaJpZM4KB4mj
.

@p14n
Copy link

p14n commented Jun 1, 2017

I'd like this functionality but I don't see the output above - and I can't find a reference to the --tests flag in the code. Tests don't get re-run for me.

@olegdater
Copy link

That would be indeed awesome. It will speed up the development process greatly.
@chevdor have you found any hacks/workarounds to implement it adhoc yet?

@p14n
Copy link

p14n commented Sep 21, 2017

I added a PR to address this but it's been closed a few days ago - apparently watch is being removed. I don't really understand the reasoning behind that.

#425

@olegdater
Copy link

@p14n check #448 (check comment from @carchrae ) it might help with watch

@p14n
Copy link

p14n commented Sep 22, 2017

@olegwn Cheers.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants