Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Handle ExportNamedDeclarations #507

Merged
merged 4 commits into from
Jun 15, 2016

Conversation

Victorystick
Copy link
Contributor

Istanbul currently doesn't handle export var ..., and throws:

/Users/oskar/github/istanbul/lib/instrumenter.js:252
                        throw new Error('Internal error: attempt to prepend statements in disallowed (non-array) context');
                        ^

Error: Internal error: attempt to prepend statements in disallowed (non-array) context
    at Object.defaultWalker (/Users/oskar/github/istanbul/lib/instrumenter.js:252:31)
    at Object.Walker.apply (/Users/oskar/github/istanbul/lib/instrumenter.js:297:26)
    at Object.defaultWalker (/Users/oskar/github/istanbul/lib/instrumenter.js:237:47)
    at Object.Walker.apply (/Users/oskar/github/istanbul/lib/instrumenter.js:297:26)
    at Object.Walker.startWalk (/Users/oskar/github/istanbul/lib/instrumenter.js:281:18)
    at Object.Instrumenter.instrumentASTSync (/Users/oskar/github/istanbul/lib/instrumenter.js:554:25)
    at Object.Instrumenter.instrumentSync (/Users/oskar/github/istanbul/lib/instrumenter.js:468:25)
    at Object.<anonymous> (/Users/oskar/github/istanbul/exec.js:7:27)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)

This PR attempts to rectify this.

@gotwarlost
Copy link
Owner

You change does not pass the jshint check and does not have a unit test. Please fix / add.

@Victorystick
Copy link
Contributor Author

How about this?

@gotwarlost
Copy link
Owner

Sorry man, I'm totally slammed this week - will get to it in 4-6 days.

@Victorystick
Copy link
Contributor Author

No worries. I'll get out of your hair. 😉

@ftripier
Copy link

ftripier commented Feb 4, 2016

+1

} catch (ex) {
console.error('ES6 feature [' + feature + '] is not available in this environment');
return false;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of making the environment detection "pass", could you rather not just remove the conditional check in test-es6-export.js that tries to do environment detection?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 97.566% when pulling d828255 on Victorystick:es-modules-support into ad8ab1d on gotwarlost:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 97.566% when pulling d828255 on Victorystick:es-modules-support into ad8ab1d on gotwarlost:master.

@Victorystick
Copy link
Contributor Author

Sorry for the delay. I've addressed all the issues. Let's get these changes in! 😄

@marvinhagemeister
Copy link

I just ran into this exact problem and found this PR. Skimming over the requested changes it looks good to me. Hope this will be merged soon, because this prevents code coverage for es6 environments.

@gotwarlost gotwarlost merged commit f4195bb into gotwarlost:master Jun 15, 2016
@TrySound
Copy link

@gotwarlost Hi. When we can wait a release?

@goesbysteve
Copy link

goesbysteve commented Jul 15, 2016

Should this enable this to be instrument-able now?

export default {
  ...
}

I manually upgrade the dependency in https://github.com/deepsweet/babel-istanbul-loader to use babel-istanbul@0.11.x but I'm still getting unexpected token hitting an export default where an exports = works.

@Victorystick Victorystick deleted the es-modules-support branch July 16, 2016 12:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants