Skip to content
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

Error: TypeError: Cannot read property 'files' of undefined #432

Closed
steven-gong-aventus opened this issue Nov 19, 2019 · 7 comments
Closed

Comments

@steven-gong-aventus
Copy link

Hi,
I'm using solidity coverage with the following version:

truffle: v5.1.0
ganache-core: v2.8.0
solidity-coverage: v0.7.0-beta.2

And receives the following error message:

Istanbul reports written to ./coverage/ and ./coverage.json
solidity-coverage cleaning up, shutting down ganache server
Error: TypeError: Cannot read property 'files' of undefined
at Object.run (~\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\migrate\index.js?abc3:92:1)
Truffle v5.1.0 (core: 5.1.0)
Node v10.16.3

I am using the default values in .solcover.js file.

Is there anything I should customize to fix this issue from the default configs?

Thanks

@cgewecke
Copy link
Member

cgewecke commented Nov 19, 2019

@steven-gong-artos If you have a sec could you try using an earlier version of Truffle - maybe 5.0.41 - they just released 5.1.0 - it's possible behavior has changed slightly.

Also, are you getting a coverage report? Is everything except for this final error working?

@cgewecke
Copy link
Member

@steven-gong-artos

Was able to run solidity-coverage with Truffle's MetaCoin project on 5.1.0 without any problems.

Do you have a reproduction case for this? Would be happy to look at it.

@cgewecke
Copy link
Member

@steven-gong-artos

Suspect this might be caused by something similar to truffle 2419. In that case, an empty folder in the test directory triggers the error. Underlying cause is the node-dir module which solidity-coverage uses for a similar purpose.

@steven-gong-aventus
Copy link
Author

steven-gong-aventus commented Nov 20, 2019

Hi @cgewecke,
I've tried truffle 5.0.41 and it returns the same Error.
An incorrect coverage report shows 0% for Stmts, Branch, Funcs, and Lines is generated with this error at the end.

@cgewecke
Copy link
Member

@steven-gong-artos

I was able to reproduce your error by adding an empty folder to the migrations folder. Could you check that directory for an empty folder, remove it and see if this error goes away?

@cgewecke
Copy link
Member

cgewecke commented Dec 1, 2019

Fix published in 0.7.0-beta.3

@cgewecke cgewecke closed this as completed Dec 1, 2019
@steven-gong-aventus
Copy link
Author

Thanks, @cgewecke ,
You are right, migrations/coverage is generated to contain some empty folders.
Once this migrations/coverage folder is removed, this TypeError disappears.

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

No branches or pull requests

2 participants