Skip to content

Script ignores compilers configuration of truffle.config.js #360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
meyer1994 opened this issue Jul 28, 2019 · 5 comments
Closed

Script ignores compilers configuration of truffle.config.js #360

meyer1994 opened this issue Jul 28, 2019 · 5 comments
Labels

Comments

@meyer1994
Copy link

meyer1994 commented Jul 28, 2019

I currently have this solc version:

$ solc --version
solc, the solidity compiler commandline interface
Version: 0.5.10+commit.5a6ea5b1.Linux.g++

And my truffle.config.js has this compilers section:

compilers: {
    solc: {
        version: "native",
        settings: {
            optimizer: {
                enabled: false,
                runs: 200
            }
        }
    }
}

But, when running $ npx solidity-coverage, it uses another version?

$ npx solidity-coverage
...
Compiling your contracts...
===========================
...
> Artifacts written to /.../build/contracts
> Compiled successfully using:
   - solc: 0.5.8+commit.23d335f2.Emscripten.clang
...

Runnning truffle test uses the correct (native) version. Is there some configuration that I am missing?

@cgewecke
Copy link
Member

cgewecke commented Jul 28, 2019

@meyer1994 Do you have a coverage network listed in your truffle-config.js as shown in the README?

SC loads the truffle config and if it doesn't see a coverage network it runs the tests with its own bare bones truffle config which uses the Truffle defaults.

You don't have to launch a client or anything, just list that network.

@cgewecke
Copy link
Member

cgewecke commented Aug 1, 2019

@meyer1994 Any luck with this?

@meyer1994
Copy link
Author

Sorry about the late response.

You were right. Creating coverage network fixed it. Partially. Weirdly, it generates an error during tests that does not happen when running truffle test. When I arrive home I will post the error here.

Now about the first fix. Shouldn't the truffle-config.js compilers section have precedence over the default value of this package?

@cgewecke
Copy link
Member

cgewecke commented Aug 1, 2019

@meyer1994

Shouldn't the truffle-config.js compilers section have precedence over the default value of this package?

Yes, it should. Right now the coverage tool has a very awkward integration with Truffle - it was initially built around Truffle 3 and does everything 'from outside'. These configuration problems should be resolved in the next version which will be written as a Truffle plugin.

@cgewecke cgewecke added the 0.7.0 label Aug 2, 2019
@cgewecke
Copy link
Member

cgewecke commented Aug 2, 2019

@meyer1994 I've edited the README to make it clear that adding a coverage network is a default installation requirement.

Closing since SC does handle the compiler correctly when a network is defined. Feel free to describe your failing test problem in this thread though...

@cgewecke cgewecke closed this as completed Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants