-
Notifications
You must be signed in to change notification settings - Fork 269
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
Add option to include other folders in the coverage envelope #39
Comments
We had this issue internally as well. The solution I've been using is
to generate the coverage environment. Adding individual folders, like |
@area Yes I agree, this is a really good idea. If SC is going to use this 'coverageEnv' approach it should just copy the whole project into it . . . and maybe also ask people to declare a coverage network with the right gas values instead of trying to handle the default case for them. The only reservation I have about this is copying Are you having the An interim solution might be to adopt your approach (it's simpler and cleaner anyway), but exclude node_modules by default with an option to include? |
It's actually a EDIT: This appears to be a consequence of using the global |
Hmmm! Interesting! @area Someone fixed the Another remotely possible fix: people are exposing the babel transpiler globally to their truffle project by requiring it at the top of Maybe we should add truffle! - it's dev dependency right now (to speed up CI). We already add another whole testrpc. This thing will be so big though . . . |
Unit test copying project into env (#39)
Published with 0.1.4 |
The new truffle 3.3 seems to break requiring local .js files (not a package in node_modules). Truffle 3.2.5 allowed a workaround to require('../file.js') if the file was outside the node_modules directory but this does not work anymore in 3.3. require('file.js') does not work either. Truffle 3.3 gives an error: Error: Cannot find module "." |
@fumecow Truffle 3.3.1 has been released which should include a |
yes - will do. Thanks! |
I'm not seeing any difference. But I do notice that when I pulled the latest truffle using npm, truffle --version still says 3.3.0 even though package.json says ^3.3.1. Did the update not make it into the package somehow? |
Hmm, let me take a look. |
Did your bundle version increase? i.e.,
|
If it did, can you give me some code that easily reproduces the issue? That will help tremendously. |
We should probably change that (new) version number to be reversed: Bundle version is more important than core version. |
Yes - the bundle version did increment to 3.3.1. I'm seeing the error for example on the initial migration when I remove the ".." in the following require. It also happens with the tests. In this case, the config.js file is in the project's home directory, one up from the migrations directory.
Hope that helps reproduce.. |
This looks like its webpack injecting garbage into the dynamic require statements in // cli.webpack.config.js
...
module: {
rules: [
{ test: /\.js$/, use: "shebang-loader" }
],
noParse: [/truffle-require/]
},
... Build is too big to link a line ref to on GitHub but tested this and it seems to preserve the EDIT: This obviously isn't enough since there are requires at the top of that file that DO need webpack injections. SECOND EDIT: Maybe it does work! If not it might be possible to extract the require function block into its own file and noParse it, since that code doesn't look like it has any non-node dependencies. |
Thanks for the tip @cgewecke. Much appreciated. I've just released version v3.3.2, and as far as I can tell it fixes the error. Please give it a shot. Thank you to all for your patience and feedback. Cheers! |
Confirmed - this seems to fix it here as well. Thanks! |
@tcoulter @fumecow Maybe I'm crazy It seems like it might still be broken - just slightly differently 😄 My test case involves requiring from a folder outside the
That kind of makes sense because in 3.3.1 webpack was also injecting bundle references for the module Don't we have to extract the function below into it's own file, noParse that, but require it into
I'm going to post a link to a repo that can reproduce the error in a second. |
@tcoulter: repo is metacoin-require-bug. It has 3.3.2 installed as a dev dependency so running Sorry about the original suggestion . . . I think that little block of code can be extracted into an unparsed file and still work - it only needs modules that are available from node so its probably okay if they're not bundled. |
I guess I forgot to mention I had to 'npm install' the new (missing) modules manually.. |
Truffle 3.4.3 is out. As far as I can tell, this should fix the issue for good. The reason this sprung back up was due to bundling issues; our tests were passing unbundled, but didn't catch If one of you can test out the new version to ensure I've fixed the issue for you, that'd be much appreciated. |
@tcoulter YES!!! Works. Thank you! |
@tcoulter I can confirm this is working here as well. Thanks! |
melonproject/protocol for example has a utilities folder located at project root which the tests require from e.g.
require('../utilities/<file>')
The text was updated successfully, but these errors were encountered: