This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 271262 - JavaScript Karma Code Coverage does not work in a PHP Application Project
Summary: JavaScript Karma Code Coverage does not work in a PHP Application Project
Status: NEW
Alias: None
Product: javascript
Classification: Unclassified
Component: Testing (show other bugs)
Version: 8.2
Hardware: PC Windows 10
: P3 normal (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords: TEST
Depends on:
Blocks:
 
Reported: 2017-08-10 16:12 UTC by bikusta
Modified: 2017-08-10 16:12 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bikusta 2017-08-10 16:12:39 UTC
Product Version = NetBeans IDE 8.2 (Build 201609300101)
Operating System = Windows 10 version 10.0 running on amd64
Java; VM; Vendor = 1.8.0_91
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.91-b15

Reproducibility: Happens every time

STEPS:

  * Create PHP Application Project with these files and folders:

nbproject
src
  lib.js
test
  lib.spec.js
karma.conf.js

  * Content of lib.js:

var LIB = LIB || {};

LIB.isNumber = function (value) {
  return typeof value === 'number';
};

  * Content of lib.spec.js:

QUnit.test('isNumber()', function (assert) {
  assert.ok(LIB.isNumber(1), "LIB.isNumber(1)");
  assert.notOk(LIB.isNumber('x'), "LIB.isNumber('x')");
});

  * Content of karma.conf.js:

module.exports = function (config) {
  config.set({
    basePath: '.',

    files: [
      'src/**/*.js',
      'test/**/*.spec.js'
    ],

    exclude: [],
    autoWatch: true,
    reporters: ['coverage'],

    preprocessors: {
      'src/**/*.js': ['coverage']
    },

    coverageReporter: {
      type: 'cobertura',
      dir: 'build',
      subdir: 'coverage-reports'
    },

    frameworks: ['qunit'],

    browsers: ['Chrome'],

    plugins: [
      'karma-qunit',
      'karma-chrome-launcher',
      'karma-coverage'
    ]
  });
};

  * Activate Code Coverage and run Tests.

ACTUAL:
  No coverage is shown.

EXPECTED:
  Show coverage in editor of lib.js.

REMARKS:
  Code coverage works with this configuration in a HTML5/JS Application Project, but not in a PHP Application Project.