-
-
Notifications
You must be signed in to change notification settings - Fork 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
7.0.0-alpha4 + babel-plugin-istanbul breaks transpilation for test runner #294
Comments
I did some experimentation. I can reproduce this issue. I suspect what is going on is that (given column 6143 and such) I can only get columns > 5000 when I process say.js with the es2015 preset + istanbul plugin and repeat the process on the output file. |
@gotwarlost @JaKXz I see babel-register being required twice:
mind trying this approach with |
@gotwarlost @JaKXz okay, dug into this, the root problem seems to be that I got things working by creating a {
"presets": ["es2015"],
"env": {
"test": {
"plugins": [
"istanbul"
]
}
}
} And updating {
"name": "nyc-ava-test",
"version": "1.0.0",
"main": "say.js",
"scripts": {
"test": "cross-env NODE_ENV=test nyc --no-cache -r text ava"
},
"license": "ISC",
"ava": {
"require": [
"babel-register"
]
},
"nyc": {
"sourceMap": false,
"instrument": false
},
"devDependencies": {
"ava": "^0.15.1",
"babel": "^6.5.2",
"babel-cli": "^6.9.0",
"babel-plugin-istanbul": "^1.0.1",
"babel-preset-es2015": "^6.9.0",
"babel-register": "^6.9.0",
"cross-env": "^1.0.8",
"nyc": "^7.0.0-alpha.4"
}
} @jamestalmage, @novemberborn any thoughts about why we're not finding the |
Given this AVA config: "ava": {
"require": [
"babel-register"
]
}, AVA uses its default Babel config when transpiling test files. Source files are taken care of through Is nyc trying to instrument the test files? Cause they probably shouldn't be instrumented. Though you can use the P.S. @bcoe @gotwarlost I'm quite excited about this! 💯 Just been heads down with client work and preparing a conference presentation so haven't had a chance to chip in yet |
@novemberborn I turned off I did upgrade a few of the underlying libraries such as |
@novemberborn @JaKXz I had stored a bad run in the cache, and babel config was being loaded correctly. The following configuration should work: {
"name": "nyc-ava-test",
"version": "1.0.0",
"main": "say.js",
"scripts": {
"test": "cross-env NODE_ENV=test nyc -r lcov ava"
},
"license": "ISC",
"babel": {
"presets": [
"es2015"
],
"env": {
"test": {
"plugins": [
"istanbul"
]
}
}
},
"ava": {
"require": [
"babel-register"
]
},
"nyc": {
"sourceMap": false,
"instrument": false
},
"devDependencies": {
"ava": "^0.15.1",
"babel": "^6.5.2",
"babel-cli": "^6.9.0",
"babel-plugin-istanbul": "^1.0.1",
"babel-preset-es2015": "^6.9.0",
"babel-register": "^6.9.0",
"cross-env": "^1.0.8",
"nyc": "^7.0.0-alpha.4"
}
} If you're using
|
@bcoe what exactly are the files that need to be deleted to start with a clean slate every time? I simply cannot correlate the changes I make to |
@gotwarlost You can turn off this cache by passing the |
@bcoe yeah we should definitely update the documentation for v7 with the instructions about
If |
@JaKXz I believe this only bites you if you have data in the |
@bcoe no, [that's why I mentioned it, because] after removing |
@bcoe it was really difficult for me to figure out what's going on with multiple modules maintaining caches in different (unexpected) places. At one point, I had 2 source trees that were checked out that were exactly the same, except one was working and another was erroring out. It wasn't obvious to me as to where I should look for a cache file. I think we need to either document a mechanism or have a command to clear the cache, similar to Also, do we really need a cache? |
In other news, I published For example, if you comment out the test that uses the default object, you will get 3 uncovered branches - one each for each variable and one for the object itself, however the HTML report would not highlight anything as uncovered. |
I had the same problem as @gotwarlost where even source trees from backup failed, which worked 3 days before, when setting up AVA together with nyc. Problem here is really babel has its own cache, ava maintains a cache and sometimes you need a 'disable all the performance and show me whats failing' flag. |
@jamestalmage and @novemberborn will attest to the fact that there's a pretty huge performance boost on a large codebase if cache is enabled (for consistency, AVA and nyc share the same underlying cache logic). Having said this! now that we also have babel caching in the mix, maybe we should make nyc caching turned off by default? We can also try to work with babel to converge on a similar caching approach? CC: @hzoo |
Don't get me wrong, performance is important! But bug tracing in this setup is really difficult. At the moment I e.g. have the problem that coverage reports are only right after the first run when I added a new test case. All following runs produce flaky results which are wrong. My first impression is a caching problem here, but its hard to check this easily at the moment with three places of caching.
the Readme says it is disabled by default, is this wrong? |
@hoschi, @gotwarlost, retracing my steps, I was considering turning the cache on by default in |
@bcoe I think it's unfortunate that Just got the unit tests in my projects down from 3m to 1m thanks to |
The use of `babel-preset-env` seems to resolve the following issue: istanbuljs/nyc#294.
Minimal reproduction: https://gist.github.com/JaKXz/9c9aa2c9dcc106e59939ec4b9f79c4f4
continued from: #288 (comment)
I am not fully sure which project to "blame", so I can move this to the
babel-plugin-istanbul
repo if that's better. @bcoe @gotwarlost cc @kentcdodds if you see this in your test as well.The text was updated successfully, but these errors were encountered: