Skip to content
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

Plugin fails with ember-cli 2.13 and useBabelInstrumenter: true #111

Closed
paulcwatts opened this issue Apr 25, 2017 · 6 comments
Closed

Plugin fails with ember-cli 2.13 and useBabelInstrumenter: true #111

paulcwatts opened this issue Apr 25, 2017 · 6 comments

Comments

@paulcwatts
Copy link
Contributor

paulcwatts commented Apr 25, 2017

I assume this is known, but for tracking purposes:

$ ember -v
ember-cli: 2.13.0-beta.4
node: 6.10.1
os: darwin x64
$ ember new coverage-test
$ cd coverage-test
$ ember install ember-cli-code-coverage
$ COVERAGE=true ember test
...
1..8
# tests 8
# pass  8
# skip  0
# fail  0

# ok
$ echo "module.exports = { useBabelInstrumenter: true };" > config/coverage.js
$ COVERAGE=true ember test
 TypeError: The plugin [null,{}] didn't export a Plugin instance
    at PluginManager.validate (coverage-test/node_modules/babel-core/lib/transformation/file/plugin-manager.js:164:13)
    at PluginManager.add (coverage-test/node_modules/babel-core/lib/transformation/file/plugin-manager.js:213:10)
    at File.buildTransformers (coverage-test/node_modules/babel-core/lib/transformation/file/index.js:237:21)
    at new File (coverage-test/node_modules/babel-core/lib/transformation/file/index.js:139:10)
    at Pipeline.transform (coverage-test/node_modules/babel-core/lib/transformation/pipeline.js:164:16)
    at Instrumenter.instrumentSync (coverage-test/node_modules/ember-cli-code-coverage/lib/babel-istanbul-instrumenter.js:36:45)
    at CoverageInstrumenter.processString (coverage-test/node_modules/ember-cli-code-coverage/lib/coverage-instrumenter.js:113:25)
    at CoverageInstrumenter.processFile (coverage-test/node_modules/broccoli-filter/index.js:165:31)
    at asyncProcessFile (coverage-test/node_modules/broccoli-filter/index.js:122:21)
    at tryCatch (coverage-test/node_modules/rsvp/dist/rsvp.js:539:12)
Unable to cover: app/resolver.js . Try setting useBabelInstrumenter to true. 
 TypeError: The plugin [null,{}] didn't export a Plugin instance
    at PluginManager.validate (coverage-test/node_modules/babel-core/lib/transformation/file/plugin-manager.js:164:13)
    at PluginManager.add (coverage-test/node_modules/babel-core/lib/transformation/file/plugin-manager.js:213:10)
    at File.buildTransformers (coverage-test/node_modules/babel-core/lib/transformation/file/index.js:237:21)
    at new File (coverage-test/node_modules/babel-core/lib/transformation/file/index.js:139:10)
    at Pipeline.transform (coverage-test/node_modules/babel-core/lib/transformation/pipeline.js:164:16)
    at Instrumenter.instrumentSync (coverage-test/node_modules/ember-cli-code-coverage/lib/babel-istanbul-instrumenter.js:36:45)
    at CoverageInstrumenter.processString (coverage-test/node_modules/ember-cli-code-coverage/lib/coverage-instrumenter.js:113:25)
    at CoverageInstrumenter.processFile (coverage-test/node_modules/broccoli-filter/index.js:165:31)
    at asyncProcessFile (coverage-test/node_modules/broccoli-filter/index.js:122:21)
    at tryCatch (coverage-test/node_modules/rsvp/dist/rsvp.js:539:12)
...

I'm pretty green with Babel and Babel plugins, but if pointed in the right direction I can take a look at making this work!

@ming-codes
Copy link
Contributor

Ember CLI 2.13 moved to babel 6. Babel plugins works differently in babel 6 and I see ember-cli-code-coverage does uses a babel plugin for transformation. Perhaps this is the reason?

@rwjblue
Copy link
Collaborator

rwjblue commented May 2, 2017

Thanks for reporting! The issue lies with the fact that we provide babel options from the host app into our custom babel instrumenter (which is based on babel-core@5). Using babel-core@5 as the instrumenter itself is totally fine (though we should also update to babel@6), but passing babel@6 plugins to babel@5 is causing the reported error.

@paulcwatts paulcwatts changed the title Plugin fails with ember-cli 2.13.0-beta.4 and useBabelInstrumenter: true Plugin fails with ember-cli 2.13 and useBabelInstrumenter: true May 12, 2017
@paulcwatts
Copy link
Contributor Author

I've been working on fixing this here: #115. This updates babel-core to 6.x, which seems to make it work using the new ember-cli. However, I don't know how this will affect older versions not upgraded to the latest ember-cli/babel@6.

I still have to have to some real-world testing.

@Turbo87
Copy link
Collaborator

Turbo87 commented May 18, 2017

@rwjblue
Copy link
Collaborator

rwjblue commented May 18, 2017

Ya, possibly. I'd have to check, but it seems reasonable.

@paulcwatts
Copy link
Contributor Author

That definitely looks promising. I will look to see how I can integrate that.

mattmarcum pushed a commit to mattmarcum/ember-cli-code-coverage that referenced this issue Jun 21, 2017
[Fixes ember-cli-code-coverage#111] Update dependencies, get babel instrumenter working (ember-cli-code-coverage#115)

babel 6 fix
RobbieTheWagner pushed a commit that referenced this issue Oct 15, 2018
* Update CHANGELOG for 0.3.12.

* 0.3.12

* Improve ES7 error message

This messaging was confusing to me so I took a stab at clarifying the intent.

* add mocha support and fix pretender bug

* [Fixes #111] Update dependencies, get babel instrumenter working (#115)

babel 6 fix

* test

* test

* add mocha support and fix pretender bug

[Fixes #111] Update dependencies, get babel instrumenter working (#115)

babel 6 fix

* 0.4.0

* update changelog v0.4.0

* Fixes the hanging issue of #88 (#90)

* Refactor onload to onreadystatechange

onreadystatechange is more reliable, chromium doesnt trigger onload

* Fix PhantomJS honoring responseType issue

* 0.4.1

* update changelog v0.4.1

* Suggest using `posttest` hook for `ember coverage-merge`

It might be helpful to suggest how/where to run `coverage-merge` for people looking to set this up in a CI environment.

The only other thing I might add is that you need to run `npm test` and have the appropriate configuration there for `posttest` to trigger, but I'm not sure if that's overkill since that should be common knowledge.

* Resolve addon file paths correctly in CLI >= 2.12

* Spelling Fix

* support nested coverageFolder

* fix test

* Update minimum version of ember-cli-babel.

The previously locked version was not compatible with `node@8` (due to
`engines` shenanigans).

* Add babel-plugin-istanbul dep.

* Use babel-plugin-istanbul instead of custom instrumenter.

This has some negative effects still:

* Does not re-write the paths to match "real" on disk paths
* Does not instrument dummy app files (I think)

Even with these negative side-effects, it has massive upside:

* Massively less overall code to maintain
* Does not require us to parse babel config (and therefore avoids issues
  around parallelism in broccoli-babel-transpiler)
* Significantly faster when used (e.g. no longer has to double parse and
  process files)

* Refactor middleware to use new istanbul API.

* Refactor coverage-merge command to work with new istanbul-api.

* Add node badge

Figured it would be nice to have a badge for the node version, so people can quickly see what the latest release is.

* 0.4.2

* Fix paths for istanbul report and remove parallel logic for impicit parallel support

* Delete uneeded files

* Remove component fixtures and add tests for 'excludes' config

* Add support for in-repo-addons #120

* Revert parallel changes (TODO: move to another PR)

* Only include test fixtures when testing the addon.

* Add index.js unit tests

* Update some docs

* Add comment about .istanbul.yml to README

* Fix typo

* Bump ember, fix lint

* Adjust some deps

* Bump ember-cli-release

* Add ember-cli-changelog

* Released v1.0.0-beta.0

* Add back "Avoid throwing errors while requiring files for coverage" #64

See #63
Fixes #150

* Upgrade out-of-date deps

* Update sinon

* Setup travis ci to release on pushed tag, add lerna-changelog

- Documented in RELEASE.md

* Add v1.0.0-beta.1 to CHANGELOG
[ci skip]

* 1.0.0-beta.1

* Don't restrict travis to particular branches

* Try using travis stages

* Reformat .travis.yml and do not require sudo

* Pin auto-dist-tag and add --no-sandbox to chrome args if on travis

* Split out script for use with matrix build

* Adjust deploy config

* Make fixtures external (#156)

* Start moving test files to separate addon

* First pass at ember-cli-addon-tests

* Fix test

* Remove addon test, fix lint

* Remove treeFor

* Try sudo required

* Remove no sandbox

* Drop node 4 from travis, use npm instead of yarn

* Add 8

* Add filter

* Add testem.js to fixtures

* Add eslint

* Remove eslint plugins

* Start in-repo addon tests (#158)

* Start in-repo addon tests

* Update per Adam's suggestion

* Fix import paths

* fix babel-plugin-istanbul caching issue (#159)

* fix babel-plugin-istanbul caching issue

* - Refactor instrumentation logic given `babel-plugin-istanbul` constraints
- Fix Unit tests

* Update app-coverage-test.js

* Update in-repo-addon-coverage-test.js

* Try setting path to process.cwd

* Fix tests to workaround tomdale/ember-cli-addon-tests#176

* Update CHANGELOG for v1.0.0-beta.2.

* 1.0.0-beta.2

* Support for addon-test-support (#160)

* Start on support for addon-test-support

* Remove only so all tests run

* Try adding test-support prefix

* Ensure addon-test-support coverage

* Add tests for in-repo engines (#162)

* First attempt at in-repo-engine

* Fix engine coverage test

* Fix lint

* Update CHANGELOG for v1.0.0-beta.3.

* 1.0.0-beta.3

* Remove merge-coverage and explicit parallel option (#163)

* Remove merge-coverage and explicit parallel option

* fix lint

* Update README.md

Describe how parallel works

* Revert "Remove merge-coverage and explicit parallel option (#163)"

This reverts commit 0592f5f.

* Keep implicit and explicit parallel logic

* Update babel-plugin-istanbul (#169)

* Use the parent registry for determining JS extensions (#164)

* Removing unused dependency exists-sync which fixes the deprecation warning from ember-cli (#179)

* Update CHANGELOG for v1.0.0-beta.4.

* 1.0.0-beta.4

* Fix fileLookup is null in testemMiddleware (#182)

* upgrade istanbul-api to 2.0.1 (#186)

istanbul-api@2.0.1 was released on June 6, 2018 and tagged as "next" on npm. The breaking change is pretty straightforward: https://github.com/istanbuljs/istanbuljs/blob/master/packages/istanbul-api/CHANGELOG.md#breaking-changes

* Filter out in-repo addons that could not be found (#188)

* Ember 3.4 (#190)

* Bump deps (#191)

* Bump deps

* Reset engine test versions

* Update CHANGELOG for v1.0.0-beta.5

* 1.0.0-beta.5

* Do not publish coverage, tests, or .idea to npm (#192)

* Update babel-plugin-istanbul (#194)

* Update CHANGELOG for v1.0.0-beta.6

* 1.0.0-beta.6

* TypeScript integration (howto) (#196)

* TypeScript integration (howto)

* removed some abstraction

* 1.0.0-beta.6

* fix: handle babel 7 absolute paths (#199)
NullVoxPopuli added a commit to NullVoxPopuli/ember-cli-code-coverage that referenced this issue Oct 27, 2019
* Update CHANGELOG for 0.3.12.

* 0.3.12

* Improve ES7 error message

This messaging was confusing to me so I took a stab at clarifying the intent.

* add mocha support and fix pretender bug

* [Fixes ember-cli-code-coverage#111] Update dependencies, get babel instrumenter working (ember-cli-code-coverage#115)

babel 6 fix

* test

* test

* add mocha support and fix pretender bug

[Fixes ember-cli-code-coverage#111] Update dependencies, get babel instrumenter working (ember-cli-code-coverage#115)

babel 6 fix

* 0.4.0

* update changelog v0.4.0

* Fixes the hanging issue of ember-cli-code-coverage#88 (ember-cli-code-coverage#90)

* Refactor onload to onreadystatechange

onreadystatechange is more reliable, chromium doesnt trigger onload

* Fix PhantomJS honoring responseType issue

* 0.4.1

* update changelog v0.4.1

* Suggest using `posttest` hook for `ember coverage-merge`

It might be helpful to suggest how/where to run `coverage-merge` for people looking to set this up in a CI environment.

The only other thing I might add is that you need to run `npm test` and have the appropriate configuration there for `posttest` to trigger, but I'm not sure if that's overkill since that should be common knowledge.

* Resolve addon file paths correctly in CLI >= 2.12

* Spelling Fix

* support nested coverageFolder

* fix test

* Update minimum version of ember-cli-babel.

The previously locked version was not compatible with `node@8` (due to
`engines` shenanigans).

* Add babel-plugin-istanbul dep.

* Use babel-plugin-istanbul instead of custom instrumenter.

This has some negative effects still:

* Does not re-write the paths to match "real" on disk paths
* Does not instrument dummy app files (I think)

Even with these negative side-effects, it has massive upside:

* Massively less overall code to maintain
* Does not require us to parse babel config (and therefore avoids issues
  around parallelism in broccoli-babel-transpiler)
* Significantly faster when used (e.g. no longer has to double parse and
  process files)

* Refactor middleware to use new istanbul API.

* Refactor coverage-merge command to work with new istanbul-api.

* Add node badge

Figured it would be nice to have a badge for the node version, so people can quickly see what the latest release is.

* 0.4.2

* Fix paths for istanbul report and remove parallel logic for impicit parallel support

* Delete uneeded files

* Remove component fixtures and add tests for 'excludes' config

* Add support for in-repo-addons ember-cli-code-coverage#120

* Revert parallel changes (TODO: move to another PR)

* Only include test fixtures when testing the addon.

* Add index.js unit tests

* Update some docs

* Add comment about .istanbul.yml to README

* Fix typo

* Bump ember, fix lint

* Adjust some deps

* Bump ember-cli-release

* Add ember-cli-changelog

* Released v1.0.0-beta.0

* Add back "Avoid throwing errors while requiring files for coverage" ember-cli-code-coverage#64

See ember-cli-code-coverage#63
Fixes ember-cli-code-coverage#150

* Upgrade out-of-date deps

* Update sinon

* Setup travis ci to release on pushed tag, add lerna-changelog

- Documented in RELEASE.md

* Add v1.0.0-beta.1 to CHANGELOG
[ci skip]

* 1.0.0-beta.1

* Don't restrict travis to particular branches

* Try using travis stages

* Reformat .travis.yml and do not require sudo

* Pin auto-dist-tag and add --no-sandbox to chrome args if on travis

* Split out script for use with matrix build

* Adjust deploy config

* Make fixtures external (ember-cli-code-coverage#156)

* Start moving test files to separate addon

* First pass at ember-cli-addon-tests

* Fix test

* Remove addon test, fix lint

* Remove treeFor

* Try sudo required

* Remove no sandbox

* Drop node 4 from travis, use npm instead of yarn

* Add 8

* Add filter

* Add testem.js to fixtures

* Add eslint

* Remove eslint plugins

* Start in-repo addon tests (ember-cli-code-coverage#158)

* Start in-repo addon tests

* Update per Adam's suggestion

* Fix import paths

* fix babel-plugin-istanbul caching issue (ember-cli-code-coverage#159)

* fix babel-plugin-istanbul caching issue

* - Refactor instrumentation logic given `babel-plugin-istanbul` constraints
- Fix Unit tests

* Update app-coverage-test.js

* Update in-repo-addon-coverage-test.js

* Try setting path to process.cwd

* Fix tests to workaround tomdale/ember-cli-addon-tests#176

* Update CHANGELOG for v1.0.0-beta.2.

* 1.0.0-beta.2

* Support for addon-test-support (ember-cli-code-coverage#160)

* Start on support for addon-test-support

* Remove only so all tests run

* Try adding test-support prefix

* Ensure addon-test-support coverage

* Add tests for in-repo engines (ember-cli-code-coverage#162)

* First attempt at in-repo-engine

* Fix engine coverage test

* Fix lint

* Update CHANGELOG for v1.0.0-beta.3.

* 1.0.0-beta.3

* Remove merge-coverage and explicit parallel option (ember-cli-code-coverage#163)

* Remove merge-coverage and explicit parallel option

* fix lint

* Update README.md

Describe how parallel works

* Revert "Remove merge-coverage and explicit parallel option (ember-cli-code-coverage#163)"

This reverts commit 0592f5f.

* Keep implicit and explicit parallel logic

* Update babel-plugin-istanbul (ember-cli-code-coverage#169)

* Use the parent registry for determining JS extensions (ember-cli-code-coverage#164)

* Removing unused dependency exists-sync which fixes the deprecation warning from ember-cli (ember-cli-code-coverage#179)

* Update CHANGELOG for v1.0.0-beta.4.

* 1.0.0-beta.4

* Fix fileLookup is null in testemMiddleware (ember-cli-code-coverage#182)

* upgrade istanbul-api to 2.0.1 (ember-cli-code-coverage#186)

istanbul-api@2.0.1 was released on June 6, 2018 and tagged as "next" on npm. The breaking change is pretty straightforward: https://github.com/istanbuljs/istanbuljs/blob/master/packages/istanbul-api/CHANGELOG.md#breaking-changes

* Filter out in-repo addons that could not be found (ember-cli-code-coverage#188)

* Ember 3.4 (ember-cli-code-coverage#190)

* Bump deps (ember-cli-code-coverage#191)

* Bump deps

* Reset engine test versions

* Update CHANGELOG for v1.0.0-beta.5

* 1.0.0-beta.5

* Do not publish coverage, tests, or .idea to npm (ember-cli-code-coverage#192)

* Update babel-plugin-istanbul (ember-cli-code-coverage#194)

* Update CHANGELOG for v1.0.0-beta.6

* 1.0.0-beta.6

* TypeScript integration (howto) (ember-cli-code-coverage#196)

* TypeScript integration (howto)

* removed some abstraction

* 1.0.0-beta.6

* fix: handle babel 7 absolute paths (ember-cli-code-coverage#199)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants