Bubbit / wct-istanbub

11 stars 5 forks source link

Support for testing components with `import.meta.url`... #15

Closed Westbrook closed 5 years ago

Westbrook commented 6 years ago

Ran into an issue where trying to run a test with coverage on components with import.meta.url return this error:

SyntaxError: Unexpected token, expected ( (126:14)
    at Parser.pp$5.raise (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/babylon/lib/index.js:4454:13)
    at Parser.pp.unexpected (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/babylon/lib/index.js:1761:8)
    at Parser.pp$3.parseExprAtom (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/babylon/lib/index.js:3632:14)
    at Parser.parseExprAtom (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/babylon/lib/index.js:7238:22)
    at Parser.pp$3.parseExprSubscripts (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/babylon/lib/index.js:3494:19)
    at Parser.pp$3.parseMaybeUnary (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/babylon/lib/index.js:3474:19)
    at Parser.pp$3.parseExprOps (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/babylon/lib/index.js:3404:19)
    at Parser.pp$3.parseMaybeConditional (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/babylon/lib/index.js:3381:19)
    at Parser.pp$3.parseMaybeAssign (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/babylon/lib/index.js:3344:19)
    at Parser.parseMaybeAssign (/Users/westbrook/Documents/web/repos/ll-course-catalog/node_modules/babylon/lib/index.js:6474:20)

I've dug around and it looks like it is due to the currently depended on version of istanbul-lib-instrument (and possibly other Istanbul packages) not having caught up to Babel@7.x yet. It looks like some (or all) of their packages have an @next version that have been update appropriately https://github.com/istanbuljs/istanbuljs/blob/istanbul-lib-coverage%402.0.1/packages/istanbul-lib-instrument/package.json so if moving to those newer versions makes sense to you too, I'm gonna try and see if that will correct this issue.

Fingers crossed it's a pretty 1 to 1 transition and I can can a PR together for this tomorrow or the next day.

Westbrook commented 6 years ago

@Bubbit trying to dot some 'i's and cross some 't's on this and wanted to confirm if it is something wrong with my environment or whether you are also seeing 7 tests failing currently? I've got the same on my WIP branch as your master, which makes me think that they expect something about the env that I don't know about. Please confirm.

Bubbit commented 6 years ago

Sorry for the delay again, was having some hotel/wifi issues this weekend.

The tests are running fine on my machine (master branch)

I'm running on OSX with node 8.6.0 (still need to update ;))