-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
fix: include object-spread-syntax plugin #141
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import {realpathSync} from 'fs' | ||
import {dirname} from 'path' | ||
import {programVisitor} from 'istanbul-lib-instrument' | ||
import babelSyntaxObjectRestSpread from 'babel-plugin-syntax-object-rest-spread' | ||
|
||
const testExclude = require('test-exclude') | ||
const findUp = require('find-up') | ||
|
@@ -23,7 +24,7 @@ function makeShouldSkip () { | |
let config = {} | ||
if (Object.keys(opts).length > 0) { | ||
// explicitly configuring options in babel | ||
// takes precendence. | ||
// takes precedence. | ||
config = opts | ||
} else if (nycConfig.include || nycConfig.exclude) { | ||
// nyc was configured in a parent process (keep these settings). | ||
|
@@ -52,6 +53,7 @@ function makeShouldSkip () { | |
function makeVisitor ({types: t}) { | ||
const shouldSkip = makeShouldSkip() | ||
return { | ||
inherits: babelSyntaxObjectRestSpread, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should really be reverted. If something needs to support object rest spread, the user should be the one opting into it, it shouldn't be a weird side-effect of loading istanbul. If Jest specifically wants to auto-enable it, this should be loaded by Jest. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @loganfsmyth @SimenB I'm keeping a close eye on babel/babel#7660 -- I agree it feels a little weird (and like a slippery slope) in hindsight to be enabling one specific language feature. Getting state-4 language features by default sounds like the best possible scenario (is this already the case?). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No disagreement there. We've mostly been focused on 7, but there's probably a good argument to do a last pass on Babel 6 to enable stabilized syntax by default. Given that jestjs/jest#4519 landed in Jest, it seems like this doesn't have any reason to be in Istanbul though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @SimenB can you verify this? @loganfsmyth is there any reason we shouldn't be upgrading Istanbul to babel 7 as soon as possible? would this issue not arise in 7. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See this comment: jestjs/jest#5082 (comment) Easy enough to do, but a new release of jest is also a bit out (we're gearing up for a new major), so it won't be fixed for user in a while There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It's probably good to update the plugin to support Babel 7 stuff, but we've done our best to make plugins work on both 6 and 7, so I think plugin should be careful not to drop support for 6 too fast.
The newer version of Babel is likely to support the newer standards certainly, so I'd expect it to have object spread on by default, but there will always be more stuff. I'll also say that if babel/babel#7660 does become a thing, I'm not at all against Istanbul using it, but it seems like you'd want to be enabling it in You've already got As a general overview of the current logic here and in It seems like an ideal world we'd have
|
||
visitor: { | ||
Program: { | ||
enter (path) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explicitly bumping to ensure istanbuljs/istanbuljs#82 is included