trufflesuite / truffle

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_
MIT License
14.02k stars 2.31k forks source link

Add integration tests for `truffle develop` #1386

Open gnidan opened 6 years ago

gnidan commented 6 years ago

Issue

Ahhh! truffle develop was broken on next! This shouldn't happen!

Requirements

The scenario tests should at least exercise truffle develop a little bit. Just so it doesn't get totally broken.

There's potentially more work in engineering a testing strategy for interacting with our various REPLs, but this should probably be excluded from the scope of this work.

The scope of work for this issue is basically to ensure that this doesn't happen:

TypeError: Cannot read property 'accounts' of undefined
    at Object.run (/.../truffle/packages/truffle-core/lib/commands/develop.js:60:37)
    at Command.run (/.../truffle/packages/truffle-core/lib/command.js:103:20)
    at Object.<anonymous> (/.../truffle/packages/truffle-core/cli.js:40:9)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
Truffle (unbundled) (core: 5.0.0-beta.1)
Solidity v0.4.25 (solc-js)
Node v8.11.3
vibern0 commented 6 years ago

Hi, I think I can do this, but I don't know exactly where to start. Can you please give me a hint? I ran the npm run test and I was looking into files.

Meabo commented 6 years ago

Same here, I was looking for an entry point @gnidan, thanks

gnidan commented 6 years ago

@obernardovieira @Meabo thanks for the interest in this!

The basic task here is to write a scenario test in packages/truffle/test/scenarios, to invoke truffle develop and run commands inside it.

For a more sophisticated approach, there might be something to the idea of modifying packages/truffle/test/scenarios/commandrunner.js script to run all scenario tests in various ways:

Most immediately, the requirements are that there should be automated tests for truffle develop, testing a few basic happy/sad paths around at least these commands:

I opened this issue just to address the problem of catching obvious breakages at merge-time instead of release-time.

vibern0 commented 6 years ago

Thanks @gnidan for quick response. I have one doubt, CommandRunner.run is running commands but actually waiting them to end at some point. Since I want to run the truffle develop and then the other commands inside, is there any example I can follow or do I need to build this kind of thing from scratch?

gnidan commented 6 years ago

From scratch, I'm afraid. :/

gnidan commented 6 years ago

Oh, a naïve solution might be to wait for the specific stdout output truffle(develop)> to know when the prompt is available.

A less naïve solution would be to use IPC messaging, since truffle develop works as part of an IPC cluster. But this sounds like a lot to implement.

vibern0 commented 6 years ago

Ok, doesn't seem easy at first sight, but I will have a try and reply asap. Thanks so far.

gnidan commented 6 years ago

Thank you!

stale[bot] commented 5 years ago

Thank you for raising this issue! It has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you would like to keep this issue open, please respond with information about the current state of this problem.

eggplantzzz commented 5 years ago

Not stale

vibern0 commented 5 years ago

Unfortunately, I did not have time to do much. Shame that it was 2 months ago :disappointed: sorry guys.

stale[bot] commented 5 years ago

Thanks for your response! This issue is no longer considered stale and someone from the Truffle team will try to respond as soon as they can.

eggplantzzz commented 5 years ago

@obernardovieira No problem, it will get done eventually :) It does not seem trivial.

stale[bot] commented 5 years ago

Thank you for raising this issue! It has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you would like to keep this issue open, please respond with information about the current state of this problem.

stale[bot] commented 5 years ago

There has been no new activity on this issue since it was marked as stale 7 days ago, so it is being automatically closed. If you'd like help with this or a different problem, please open a new issue. Thanks!

stale[bot] commented 5 years ago

Thanks for your response! This issue is no longer considered stale and someone from the Truffle team will try to respond as soon as they can.

CruzMolina commented 5 years ago

Assigning to myself to keep open 😠