首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Karma ng-html2js预处理器不生成模块

Karma ng-html2js预处理器不生成模块
EN

Stack Overflow用户
提问于 2014-11-07 07:44:20
回答 2查看 819关注 0票数 2

我正在尝试调试我的karma设置没有预处理我的指令模板。

我希望通过设置moduleName: foo,我可以轻松地获取Chrome调试控制台中的模块并查看发生了什么,但在调试中尝试angular.module('foo')会返回一个no module found错误,让我相信问题出在其他地方。

我还尝试将html预处理器更改为一些无意义的字符串,希望karma会抛出一个错误,但它没有。这使我认为问题可能是没有正确的模板路径,但如果我将该路径更改为其他路径,则确实会抛出错误no files match this path

有没有我遗漏的调试选项/方法?有没有办法记录ng-html2js传入/传出的内容?

这是我的karma.conf.js

代码语言:javascript
复制
module.exports = function(config) {
  config.set({
    plugins: [
      // these plugins will be require() by Karma
      'ng-html2js',
      'jasmine',
      'karma-jasmine',
      'karma-phantomjs-launcher',
      'karma-chrome-launcher'
    ],
    basePath: '',
    // frameworks to use
    frameworks: ['jasmine'],
    files: [
      APPLICATION_SPEC,
      '../app/assets/javascripts/image-crop.js',
      '../app/assets/javascripts/angular/**/*.js',
      '../spec/javascripts/**/*_spec.js',
      "../public/templates/**/*.html"
    ],
    exclude: [
      './app/bower_components/angular/angular.min.js'
    ],
    reporters: ['progress'],
    preprocessors: {
      '**/*.html': ['ng-html2js']
    },
    ngHtml2JsPreprocessor: {
      stripPrefix: 'public/templates',
      moduleName: 'foo',
    },
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,


    browsers: ['PhantomJS', 'Chrome'],
    singleRun: false
  });
};
EN

回答 2

Stack Overflow用户

发布于 2016-01-16 00:55:14

有没有我遗漏的调试选项/方法?有没有办法记录ng-html2js传入/传出的内容?

是;karma start --log-level debug将显示DEBUG [preprocessor.html2js]条目。但是,只有在files路径和preprocessors模式正确的情况下,才能获得这些条目。

票数 2
EN

Stack Overflow用户

发布于 2014-11-07 19:35:03

这似乎是路径的一个问题,因为当我将基本路径basePath: '../'添加到我的karma配置中并调整我的files:路径时,预处理器工作正常。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26791573

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档