Creating ember addon for integration tests - can't get file into tests


Apologies for the x post - I have put this on SO also.

I am trying to turn this:

into an ember-cli-addon ( )

I have read which is great but I am stuck figuring out how to make the qunit-assert-html.min.js available in my tests.

All I have done so far is add the file to /vendor and then imported it inside index.js:

npm linking the add-on into my project successfully adds the /vendor/qunit-assert-html.min.js to my apps /vendor folder but I can’t figure out how to make that available in my integration tests.

Any help appreciated!


There’s a few ways to make dependencies available in your add-on: it’s either have to be a bower_components or vendor. Those are the ONLY two folders that you are allowed to include files from. It is possible to include node_modules or any other folder in your add-on, but there’s quite a few hoops to jump through to get there.

bower_components are standard installed through bower package manager, but because bower flattens dependency tree, your add-on has to instruct the dependent app to install it. You do this through a default blueprint. Don’t forget to add the dependency to your add-on’s bower.json too for dev purpose.

vendor follows the convention of vendor/package/file.js. I don’t think this is documented, but your vendor file MUST follow this convention for import to work correctly.

Including node_modules and other folders requires you to implement treeFor* hooks in your addon. These hooks are invoked by ember-cli to allow you to include additional broccoli trees in the build cycle. In order to include other folders, you have to use these hooks to move your files into the vendor/ folder, then import it again in the included hook.

Hope that helps.


Nice one - thank you


I’m struggling with dependencies in an addon right now. Is there any documentation? This is a great summary but I need a little more help figuring out how to make all of the dependencies I’ll need play nice.



Wayne can you please post back your findings and examples on getting this to work with integration tests? Thanks!


Actually, I found the answer finally.

in ember-cli-build.js file

'use strict';

const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {
  let app = new EmberAddon(defaults, {
    // Add options here

    This build file specifies the options for the dummy test app of this
    addon, located in `/tests/dummy`
    This build file does *not* influence how the addon or the app using it
    behave. You most likely want to be modifying `./index.js` or app's build file
  if (app.env === 'test') {

  return app.toTree();