سؤال

I'm installed some packages from bower. For tests i need full path to directory with one of the installed packages.

How can i get this path (something like $TRAVIS_BUILD_DIR on travis-ci)?

In Programmatic API i don't find nothing similar.

هل كانت مفيدة؟

المحلول

For this issue i decided to use GruntJS. I needed to SpecRunner.html from jasmine that's to run tests.

Due to GruntJS (and plugin grunt-contrib-jasmine) i can set nessesary paths (sources, specs, helpers) one time - in Gruntfile:

jasmine: {
  pivotal: {
    src: 'src/**/*.js',
    options: {
      specs: 'spec/*Spec.js',
      helpers: 'spec/*Helper.js'
    }
  }
}

For dynamically include libs, loaded from bower, i used GruntJS's plugin grunt-bower-install.

Also for getting path to package, you can use path from .bowerrc:

pkg: grunt.file.readJSON('.bowerrc'),
build: {
  src: 'src/<%= pkg.directory %>.js'
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top