ember-cli-code-coverage摩卡显示有测试时覆盖率为0%

收藏

I'm using ember-cli-code-coverage with ember-cli-mocha. When I run COVERAGE=true ember test I'm getting 0% coverage for statements, functions, and lines. Yet, I have tests that are covering those sections. Any I missing something in my setup?

单元测试文件:

  beforeEach(function() {
    controller = this.subject();
  });

  it('sets selectedImage to null', function() {
    expect(controller.get('selectedImage')).to.eql(null);
  });

  describe('setCoverageTest', function() {
    it('sets selectedImage to true', function()  {
      expect(controller.get('selectedImage')).to.eql(null);
      controller.setCoverageTest();
      expect(controller.get('selectedImage')).to.be.true;
    });
  });

config / coverage.js:

module.exports = {
  excludes: ['*/templates/**/*'],
  useBabelInstrumenter: true
};
回复