Repository navigation
Closed
Description
I have a demo repo set up to illustrate the issue. When using a Babel plugin, such as babel-plugin-transform-object-rest-spread, building the project fails with the error TypeError: The plugin "transform-object-rest-spread" didn't export a Plugin instance , preventing the build from succeeding.
Steps taken to build the demo repo:
- Create new Ember 2.13 project
- Configure project to use pods
- Add babel config to
ember-cli-build.js - Update
package.jsonto include devDependency forbabel-plugin-transform-object-rest-spread - Add
config/coverage.jsto configure using Babel instrumentation, as well as to indicate the desired plugin - Add new
testroute and controller, set an object to render to template that uses the spread operator
Test results:
$ ember test
'instrument' is imported from external module 'ember-data/-debug' but never used
cleaning up...
Built project successfully. Stored in "/Users/jleja/code/testApp/tmp/class-tests_dist-vC0AgVDo.tmp".
ok 1 PhantomJS 2.1 - ESLint | app: app.js
ok 2 PhantomJS 2.1 - ESLint | app: resolver.js
ok 3 PhantomJS 2.1 - ESLint | app: router.js
ok 4 PhantomJS 2.1 - ESLint | app: test/controller.js
ok 5 PhantomJS 2.1 - ESLint | app: test/route.js
ok 6 PhantomJS 2.1 - ESLint | tests: helpers/destroy-app.js
ok 7 PhantomJS 2.1 - ESLint | tests: helpers/module-for-acceptance.js
ok 8 PhantomJS 2.1 - ESLint | tests: helpers/resolver.js
ok 9 PhantomJS 2.1 - ESLint | tests: helpers/start-app.js
ok 10 PhantomJS 2.1 - ESLint | tests: test-helper.js
ok 11 PhantomJS 2.1 - ESLint | tests: unit/test/route-test.js
ok 12 PhantomJS 2.1 - Unit | Route | test: it exists
1..12
# tests 12
# pass 12
# skip 0
# fail 0
$ COVERAGE=true ember test
⠸ Building'instrument' is imported from external module 'ember-data/-debug' but never used
⠴ BuildingUnable to cover: app/app.js . Try setting useBabelInstrumenter to true.
TypeError: The plugin "transform-object-rest-spread" didn't export a Plugin instance
at PluginManager.validate (/Users/jleja/code/testApp/node_modules/ember-cli-code-coverage/node_modules/babel-core/lib/transformation/file/plugin-manager.js:164:13)
at PluginManager.add (/Users/jleja/code/testApp/node_modules/ember-cli-code-coverage/node_modules/babel-core/lib/transformation/file/plugin-manager.js:213:10)
at File.buildTransformers (/Users/jleja/code/testApp/node_modules/ember-cli-code-coverage/node_modules/babel-core/lib/transformation/file/index.js:237:21)
at new File (/Users/jleja/code/testApp/node_modules/ember-cli-code-coverage/node_modules/babel-core/lib/transformation/file/index.js:139:10)
at Pipeline.transform (/Users/jleja/code/testApp/node_modules/ember-cli-code-coverage/node_modules/babel-core/lib/transformation/pipeline.js:164:16)
at Instrumenter.instrumentSync (/Users/jleja/code/testApp/node_modules/ember-cli-code-coverage/lib/babel-istanbul-instrumenter.js:36:45)
at CoverageInstrumenter.processString (/Users/jleja/code/testApp/node_modules/ember-cli-code-coverage/lib/coverage-instrumenter.js:113:25)
at CoverageInstrumenter.processFile (/Users/jleja/code/testApp/node_modules/broccoli-filter/index.js:165:31)
at asyncProcessFile (/Users/jleja/code/testApp/node_modules/broccoli-filter/index.js:122:21)
at tryCatch (/Users/jleja/code/testApp/node_modules/rsvp/dist/rsvp.js:539:12)
(Same TypeError repeats for each file)
cleaning up...
Built project successfully. Stored in "/Users/jleja/code/testApp/tmp/class-tests_dist-VG1YuBo3.tmp".
not ok 1 PhantomJS 2.1 - Global error: TypeError: undefined is not an object (evaluating '_resolver.default') at http://localhost:7357/assets/tests.js, line 83
---
Log: |
{ type: 'error',
text: 'TypeError: undefined is not an object (evaluating \'_resolver.default\') at http://localhost:7357/assets/tests.js, line 83\n' }
...
not ok 2 PhantomJS 2.1 - Global error: Error: Assertion Failed: The tests file was not loaded. Make sure your tests index.html includes "assets/tests.js". at http://localhost:7357/assets/vendor.js, line 18622
---
Log: |
{ type: 'error',
text: 'Error: Assertion Failed: The tests file was not loaded. Make sure your tests index.html includes "assets/tests.js". at http://localhost:7357/assets/vendor.js, line 18622\n' }
...
While I haven't really tried any other plugins, I have at least tried seeing what would happen if I just loaded the Babel plugin without needing to transform anything. Same errors occur.
Metadata
Metadata
Assignees
Labels
No labels
Activity
anehx commentedon Jun 19, 2017
I got the same with
babel-plugin-transform-decorators-legacyandbabel-plugin-transform-async-generator-functions.. I think this appears for every babel plugin.anehx commentedon Jun 19, 2017
Fixed this by depending on the current master branch of this addon which fixed this issue...
jleja commentedon Jun 19, 2017
In my demo branch, checking out
masterdoes indeed fix it. In the application I'm working on, doing that starts surfacing[BABEL] app/templates/testing.hbs: Using removed Babel 5 option: base.optional - Put the specific transforms you want in the 'plugins' option. Looks like another dependency is the issue, shall look further into it. Thanks!jleja commentedon Jun 19, 2017
That wasn't too hard to track down. In my application, I had Babel configured as:
Doesn't like the optional setting, so I'll just move that to a plugin. Closing this issue down!
rwjblue commentedon Jun 19, 2017
optionalisn't valid with babel@6, see readme of https://github.com/rwjblue/ember-computed-decorators#babel-6x for details on getting decorators to workjleja commentedon Jun 19, 2017
Thanks @rwjblue!
buschtoens commentedon Aug 18, 2017
I'm trying to get coverage running with ES6 classes and static class properties, but apparently I must be doing something wrong...
buschtoens/ember-joda#4
https://travis-ci.org/buschtoens/ember-joda/jobs/265890944#L558-L570
buschtoens commentedon Aug 18, 2017
My bad. The config file has to be located at
tests/dummy/config/coverage.jsfor addons. Seems a bit weird to me, but fits the docs (implicitly), sinceconfigPathistests/dummy/configfor addons:However, while the plugin is now found, it can't be used:
https://travis-ci.org/buschtoens/ember-joda/jobs/265930210#L567-L578
buschtoens commentedon Aug 18, 2017
And there we have it: #133
Sorry for the commotion. 😅
reiallenramos commentedon Mar 10, 2020
Recently encountered this problem when we upgraded from Ember 2.xx to 3.14.
ember testworks fine but fails whenCOVERAGE=trueis added. @jleja do you still have the fix? It's not obvious in your comments what you did that resolved the issue. Thanks