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 242578 - Karma stuck on "running" qunit based javascript unit tests
Summary: Karma stuck on "running" qunit based javascript unit tests
Status: VERIFIED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: HTML Project (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-05 13:26 UTC by sandreas
Modified: 2014-04-24 11:38 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot (369.06 KB, image/jpeg)
2014-03-05 13:26 UTC, sandreas
Details
Export QunitProject.zip (8.81 MB, application/zip)
2014-03-28 07:06 UTC, sandreas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sandreas 2014-03-05 13:26:06 UTC
Karma is configured to run tests with qunit (npm install karma-qunit)and watching changed files to automatically rerun tests. Starting Karma prints out "SUCCESS" on console but shows "No Tests executed" in the unit testing area (see Step 1 in attached screenshot).

If I click rerun tests or change a test-File, console prints out "SUCCESS" and "done.", but the unit testing area is stuck in "Running..." (see Step 2 in screeshot). 

Only a restart of Karma results in step 1.

// karma.conf.js (located in /karma.conf.js)
// / is seen as project root
module.exports = function(config) {
    config.set({
        frameworks: ['qunit'],
        files: [
            'tests/js/unit/*.js'
        ],
        browsers: ['PhantomJS'],
        plugins: [
            'karma-qunit'
        ]
    });
};

// calculatorTests.js (located in /tests/js/unit/calculatorTests.js)
test('one should equal one', function() {
    equal(1, 1, 'error: one did not equal one');
});
Comment 1 sandreas 2014-03-05 13:26:57 UTC
Created attachment 145777 [details]
Screenshot
Comment 2 Vladimir Riha 2014-03-05 13:48:38 UTC
Thank you for reporting.

Reproduced also with Chrome. Does not happen with JasmineJS


Product Version: NetBeans IDE 8.0 (Build 201403032200)
Java: 1.8.0; Java HotSpot(TM) Client VM 25.0-b69
Runtime: Java(TM) SE Runtime Environment 1.8.0-b131
System: Linux version 3.2.0-48-generic-pae running on i386; UTF-8; en_US (nb)
Comment 3 Tomas Mysik 2014-03-28 06:44:05 UTC
Guys, could anyone please attach a sample project with qunit tests?

Simply reopen this issue, thanks.
Comment 4 sandreas 2014-03-28 07:06:53 UTC
Created attachment 146362 [details]
Export QunitProject.zip

Added a sample netbeans project
Comment 5 Tomas Mysik 2014-03-28 07:18:29 UTC
You are not going to fix this issue, right? ;)

Thanks for the sample project.
Comment 6 Tomas Mysik 2014-04-17 08:27:41 UTC
Your project does not use Karma as a JavaScript tester, does not have properly set the Tests folder. If I setup it manually, I get this:

"/home/gapon/NetBeansProjects/QunitProject/node_modules/karma/bin/karma" "start" "/home/gapon/NetBeansProjects/QunitProject/karma.conf.js" "--port" "9876"
INFO [karma]: Karma v0.12.1 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.2 (Linux)]: Connected on socket Wc8GIKuTqWHXO2Ycx3yA with id 55179949
WARN [PhantomJS 1.9.2 (Linux)]: Adapter did not report total number of specs.
PhantomJS 1.9.2 (Linux): Executed 0 of 0 SUCCESS (0 secs / 0 secs)
ERROR [karma]: [TypeError: Cannot call method 'push' of undefined]
TypeError: Cannot call method 'push' of undefined
    at onBrowserStart (/home/gapon/NetBeansProjects/QunitProject/node_modules/karma/lib/reporters/base.js:14:20)

Do I need to do any other steps to fix the project?

Please, reopen this issue and attach a _correctly_ configured NetBeans project (it is likely better to use an HTML5 project rather than a PHP project since we can focus on Karma directly). It is totally OK to attach a project without node_modules directory and just tell us "invoke this or that command to install dependencies" etc.

Thanks.
Comment 7 Vladimir Riha 2014-04-17 09:21:13 UTC
Tomasi, you need to have older Karma. Uninstall Karma from the project 

$ cd [projectRoot]
$ npm uninstall karma

and run following in project root:

$ npm install karma@0.10
Comment 8 Vladimir Riha 2014-04-17 09:24:16 UTC
Btw I added  'karma-junit-reporter' to the list of plugins in karma.conf.js but it didn't change anything.

Should the fix be safe and easy, I'd vote for patch candidate but please feel free to remove it.
Comment 9 Tomas Mysik 2014-04-17 10:38:05 UTC
Yes, I agree with the patch candidate (the fix is quite easy).

Thanks.

http://hg.netbeans.org/web-main/rev/cc765f1d520f
Comment 10 Quality Engineering 2014-04-18 02:42:30 UTC
Integrated into 'main-silver', will be available in build *201404180001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/cc765f1d520f
User: Tomas Mysik <tmysik@netbeans.org>
Log: #242578 - Karma stuck on "running" qunit based javascript unit tests
Comment 11 Vladimir Riha 2014-04-18 06:42:51 UTC
Verified, thank you

Product Version: NetBeans IDE Dev (Build 201404180001)
Java: 1.8.0; Java HotSpot(TM) Client VM 25.0-b70
Runtime: Java(TM) SE Runtime Environment 1.8.0-b132
System: Linux version 3.2.0-60-generic-pae running on i386; UTF-8; en_US (nb)
Comment 12 Tomas Mysik 2014-04-18 06:48:46 UTC
Transplanted to releases repo to the branch release80.

Thanks.

http://hg.netbeans.org/releases/rev/0ee0c4dc6428
Comment 13 Quality Engineering 2014-04-24 02:15:45 UTC
Integrated into 'releases/release80', will be available in build *201404240045* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/0ee0c4dc6428
User: Tomas Mysik <tmysik@netbeans.org>
Log: #242578 - Karma stuck on "running" qunit based javascript unit tests
(transplanted from cc765f1d520f12d4150fe6e6723c39e8bab48712)
Comment 14 Vladimir Riha 2014-04-24 11:27:25 UTC
verified in patch1

Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 1
Java: 1.8.0_05; Java HotSpot(TM) Client VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Linux version 3.2.0-60-generic-pae running on i386; UTF-8; en_US (nb)
Comment 15 Vladimir Riha 2014-04-24 11:38:34 UTC
... Jasmine support works as well (tested with AngularSeed)