just-boris / karma-bower

Loads any type of matcher into your test scope
MIT License
1 stars 5 forks source link

Let karma-bower read the project's bower.json #3

Open kdekooter opened 9 years ago

kdekooter commented 9 years ago

Let karma-bower read the project's bower.json and load the dependencies from there, instead of defining them (again) in the karma.conf.

just-boris commented 9 years ago

Now you can do it by the following way

bowerPackages: Object.keys(require('./bower.json').dependencies)

We can do some shortcut for it, but how should it look? Also some people want to include devDependencies as well, so I have to design an option for them.

kdekooter commented 9 years ago

Thanks, that will help me move ahead for now.

I'd say default to reading the dependencies from the project's bower.json dependencies section. bowerPackages will then be used as an override. An additional useDevDependencies: true property would allow loading of dev deps.

just-boris commented 9 years ago

I will think about solution, and maybe find something nice. And I hope some people come into this issue with a nice another idea

esquevin commented 9 years ago

While interesting, this doesn't loads the dependencies of your dependencies :/

just-boris commented 9 years ago

@esquevin interesting point. Now I see only one way to resolve this: read bower_components directory and load all modules from there.

esquevin commented 9 years ago

I've solved my problem by using wiredep in the karma.conf file instead of karma-bower:

  var resources = require('wiredep')();

  //load all the dependencies (following all the requirements)
  var files = resources.js;

  //append your own files
  files = files.concat([
      "bower_components/angular-mocks/angular-mocks.js",

        "src/app.js",
        "src/components/**/*.js",
        "dev/html.js",

        "unit-tests/conf.js",
        "unit-tests/**/*.js",
  ])

Then I pass files to the files property of my karma.conf file

just-boris commented 9 years ago

Nice package. It does a lot of work regarding bower dependencies. I'll try to use it somehow