-
Notifications
You must be signed in to change notification settings - Fork 260
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
Support for npm scripts which call npm packages #56
Comments
So . . . in principal we do support this: since #44 it's possible to set a However, I'm seeing some bewildering results:
I don't understand why. Could be something in the transpilation step? Or not? Complicated build here! They're pushing the envelope. @maurelian Are you getting 58 passing / 18 failing running the tests as they suggest? If everything's passing for you then something is wrong on my end. As far as configuration goes: module.exports = {
testCommand: 'npm run transpile; truffle test --network coverage',
copyNodeModules: true,
} My module.exports = {
networks: {
development: {
host: 'localhost',
port: 8545,
network_id: '*', // Match any network id
},
kovan: {
host: 'localhost',
port: 8546,
network_id: '42',
gas: 4612388,
},
coverage: {
host: "localhost",
network_id: "*",
port: 8555, // <-- Use port 8555
gas: 0xfffffffffff, // <-- Use this high gas value
gasPrice: 0x01 // <-- Use this low gas price
}
},
test_directory: 'transpiled/test',
migrations_directory: 'transpiled/migrations',
}; NB: also fooled around with the network id param (b/c they specify one) in both testrpc and truffle.js and it made no noticeable difference. |
I had the tests running at some point, on some branch, but similarly am getting failures now. Sorry for sending you on a bug hunt that might not have been in your tool. Let me get back to you on this soon after talking to the team. :) |
Oh not at all - I think there are definitely solidity-coverage bugs here! No worries. |
I'm going to close because the question about how to call node packages from scripts is basically resolved. However - I'm adding 0xProject to the list of installation targets to test. And think an addendum to the README might be in order here because how to handle this issue is not super clear. |
I know this is closed, but I've made some progress, and also hitting a new wall! So it's worth reporting in. :) Updates to the repo are here: https://github.com/maurelian/0x-contracts/tree/audit_coverage Things I worked around:
So at this point I'm getting a funny error: but it does exist. $ ./node_modules/truffle/cli.js version
Truffle v3.2.5 |
I fixed the previous error by using the absolute path to truffle. The report is at least generating now, but I'm running out of gas, even after adding |
Hmmmm. Interesting. This is great. Will you try adding I might also revert the change to the gas in |
So, when I tried that, I was getting empty responses from testrpc.
Then I tried
And that worked! No idea what would be different, but it worked. That seems really weird to me, not sure what's up. Maybe some async stuff? I also should double check the report output against the actual tests, for accuracy. |
Oh great! The testrpc disconnect thing is really frustrating. I can't figure that out. I'm going to add your |
although I think running testrpc in-memory is more elegant, I generally appreciate the feedback of running it in a separate terminal session. |
Yes, I agree. I hoped that in-memory would just work and would make integration with CI more straightforward but it's actually been an unrelenting source of confusion and unreliability. |
Reviewing the report, I'm pretty sure it's missing somethings. ie. you would at least expect to see the the (as seen here) Happy to file an issue if you have a suggestion for what to call it. :) |
Yes definitely file an issue as long the tests are actually making it past the require at line 126. . . I don't know what to call that either. Maybe 'Missing coverage after require' and link here. |
They have some serious tests for that so if it's not making it past the require they have bug, which is conceivable. . .it might be worth logging what the values are around here. When I search the report for fillOrder the coverage looks consistent with not running that code. Like you can see that fillOrders don't complete. Which doesn't mean there isn't a problem here, but if that's the case shouldn't their tests error? |
Checked the difference between testrpc 3.0.2 and testrpc-sc (which is based on 3.0.3). and saw that solc was temporarily pinned to 4.0.6 in that patch. I'm going to float it with a caret again . . . don't know if that will change things but maybe. |
Actually I'm pinning it to 0.4.8 because that's what testrpc@latest is. |
Is the solc version used determined by the testrpc version? I'm not getting any compilation errors, and the I'm experiencing a discrepancy between results which seem to vary depending on both the use of testrpc and when using solidity-coverage to run tests. Quick summary of my observations:
Any suggestions for troubleshooting? Feel free to ping me in slack. :) |
I think the solc thing is irrelevant actually. I saw it in the testrpc deps but it looks like it's only used for the unit tests. I'm going to try to reproduce . . . Were I to make another wild guess, this problem is about signing and weird signing stuff somewhere from earlier this year. |
I tried a variation on case 2 above, to see if your testrpc fork depends on the gas limit setting.
This at least brings the behavior of Should I move this to an issue on that repo? |
Oh here is fine. This is |
|
Oh and where is your testrpc3.0.2? Is that using ethereumjs-util@4.5.0? |
It's in When I
|
Hmmmm! Interesting! Well, I made a branch of
For the life of me cannot get past the typescript comp errors and it seems like the require paths in the tests on the
Thanks for that slack invite - I read through a few weeks of it on Monday and it's completely fascinating! So cool. |
IIRC that's fixed by running |
Ok. Revisiting, now . . . |
Sadly I'm not making too much headway on this. . . Some of the errors are being triggered by network stuff that's hardcoded into the migrations files - there are places there where the testing environment network is assumed to be 'development'. That stuff is fixable / hackable. But the signing? Is there any way that you can ask them about their signing protocol and if they are dependent on ethereumjs-util@4.x.x? Just plugging in an earlier version of the utils isn't working. There was significant change to the way things are signed this spring - see this ethereumjs-util PR and I think |
Try to run this on /0xProject/contracts. The tests run as is without issue (using
npm run test
, but throw an error when called via solidty-coverage. It seems to have something to do with the npm scripts:Error message:
I also tried changing the script to
rm -rf ./transpiled; ./node_modules/.bin/copyfiles ./build/**/* ./transpiled; ./node_modules/.bin/tsc
This gets me a new error, which seems closer to success:
The text was updated successfully, but these errors were encountered: