-
Notifications
You must be signed in to change notification settings - Fork 19
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
WIP: trying to upgrade AVA #5
Conversation
cc @jamestalmage @sindresorhus @sotojuan @novemberborn @vdemedes, if ya'll would have a second to give this a look I'd really appreciate it :-) I'm seeing this in my work project as well. I've been looking into this for a day now. I don't really have any leads. Also, maybe @bcoe of the Thanks for any help/tips you can give. This is an instructional repository and I'd love to be able to remove this section about having to install |
Another person who may have thoughts: @xjamundx |
I think that this is an inter-op issue with React + AVA + nyc somehow... Here are a few commands you can run to get a quick-start on this:
Here's the output I see with those last two commands:
A few things you'll notice:
The most noticeable difference between those two files is one has JSX and the other does not. I'm thinking that may have something to do with it... |
Note: The AVA docs say that for code coverage you may need to specify inline source maps for coverage to work. But adding this to my
|
@novemberborn any thoughts on this one, looks like |
This fixes an `nyc` compatibility issue that [surfaced here](kentcdodds/react-ava-workshop#5) I am not entirely sure why source-map inlining is required (it worked fine without it in previous versions of AVA). @novemberborn - It looks like the type of value we return from `retrieveSourceMap` inside `test-worker.js` changed from an object to a string sometime between `0.9.2` and `0.13` - I wonder if that has something to do with it.
@kentcdodds, got a hotfix for you:
See my commit message in jamestalmage/ava@919a131 |
@jamestalmage, I updated the PR and it's still giving me the same error. Am I doing something wrong? |
Thanks for looking into this by the way! 🎉 |
Clear |
That worked! Any chance this will get patch released today? Or should I just go with the hotfix for now? |
I'm not entirely sure my solution is the correct one (I think the problem is elsewhere), so hotfix. I've opened an AVA PR to discuss |
@kentcdodds I have some ideas on what's going here but haven't yet had a chance to dig deeper. I can reproduce the issue locally though so that's good. |
Thanks for taking the time to look at it :-) |
@kentcdodds nyc is covering your test files and then fails to apply the source maps. That's a separate issue I haven't tracked down yet. To exclude your test files add the following to your "nyc": {
"exclude": "app/**/*.test.js"
} Normally nyc excludes |
Oh interesting. Didn't even realize that I was instrumenting the test files. I'll give that a look. But this didn't actually solve the root issue correct? You're still looking at that? |
Indeed. Regardless of the root issue though you probably don't want to be instrumenting the test files. |
If course :-) Mind if I submit a pull request to support my naming convention for test files? |
Please do! |
I'm sure I could find it, but if it's quick for you, I'd appreciate a link to the relevant code :-) |
https://github.com/bcoe/nyc/blob/69ed03b29c423c0fd7bd41f9dc8e7a3a68f7fe50/index.js#L45 I'll leave the test location for you ;-) |
Looks like nyc cannot find the source map AVA generated for the test file. Unfortunately nyc thinks it instrumented the original test file but it didn't. Without the source map it can't generate a coverage report because the information generated by Istanbul does not line with the test file. This might need some changes both to AVA and nyc. Good thing I have commit access to both ;-) |
See avajs/ava#662 for an AVA fix that allows nyc to access the source maps. |
4965aa8
to
21c1a10
Compare
Some output before these changes:
Some output after these changes:
As you can see, the tests work in both cases (yay), but coverage is busted after upgrading to AVA
0.13.0
and I have no idea why. Been working on this for a while now and I'm really stumped.Thoughts appreciated from my AVA friends :-)