QUnit + JSTestDriver: No tests found
I'm not able to get QUnit working with the JSTestDriver plugin working in PHPStorm. I have followed the help and guides online, but I will always get the error:
No tests found. Please check 'test:' section of the configuration fileEmpty test suite
My jstestdriver.jstd configuration:
My jstestdriver.jstd file
load: - test/libs/equiv.js - test/libs/QUnitAdapter.js - bower_components/jquery/dist/jquery.js - bower_components/qunit/qunit/qunit.js - src/*.js test: - test/*.js
My test file:
(function() {
(function($) {
/*
======== A Handy Little QUnit Reference ========
http://api.qunitjs.com/
Test methods:
module(name, {[setup][ ,teardown]})
test(name, callback)
expect(numberOfAssertions)
stop(increment)
start(decrement)
Test assertions:
ok(value, [message])
equal(actual, expected, [message])
notEqual(actual, expected, [message])
deepEqual(actual, expected, [message])
notDeepEqual(actual, expected, [message])
strictEqual(actual, expected, [message])
notStrictEqual(actual, expected, [message])
throws(block, [expected], [message])
*/
"use strict";
module("jQuery#hash-tabs", {
setup: function() {
return this.elems = $("#qunit-fixture").children();
}
});
test("is chainable", function() {
expect(1);
return strictEqual(this.elems.hash - tabs(), this.elems, "should be chainable");
});
test("is hash-tabs", function() {
expect(1);
return strictEqual(this.elems.hash - tabs().text(), "hash-tabs0hash-tabs1hash-tabs2", "should be hash-tabs");
});
module("jQuery.hash-tabs");
test("is hash-tabs", function() {
expect(2);
strictEqual($.hash - tabs(), "hash-tabs.", "should be hash-tabs");
return strictEqual($.hash - tabs({
punctuation: "!"
}), "hash-tabs!", "should be thoroughly hash-tabs");
});
module(":hash-tabs selector", {
setup: function() {
return this.elems = $("#qunit-fixture").children();
}
});
return test("is hash-tabs", function() {
expect(1);
return deepEqual(this.elems.filter(":hash-tabs").get(), this.elems.last().get(), "knows hash-tabs when it sees it");
});
})(jQuery);
}).call(this);
Tests will run fine using the web version and index.html file which ships with QUnit. But tests cannot be found using the jstestdriver plugin.
Any help would be appreciated
请先登录再写评论。
Thanks, reproduced. JsTestDriver plugin reported wrong error message.
Actually, when running the test in console (outside PHPStrorm), it reports:
So, the workaround is to rename "jQuery#hash-tabs" to something else.
The error message reporting will be improved in PHPStorm 9.
Thank you. It also appears that dashes - cause the same issue. So in my case even
would not work. Renaming to solved the issue.