Reputation: 41
I am trying to test simple example with qUnit. it shows me error
Uncaught ReferenceError: require is not defined in test.js file.
I am using express server in javascript but not using jQuery.
qunit.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>QUnit Test</title>
<link rel="stylesheet" href="//code.jquery.com/qunit/qunit-1.18.0.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="//code.jquery.com/qunit/qunit-1.18.0.js"></script>
<script src="test/test.js"></script>
</body>
</html>
test/test.js
QUnit.test( "hello test", function( assert ) {
assert.ok( 1 == "1", "Passed!" );
});
Upvotes: 4
Views: 1110
Reputation: 320
wrap the Qunit.test inside a Qunit.module
QUnit.module('qunit testing', function () {
QUnit.test( "hello test", function( assert ) {
assert.ok( 1 == "1", "Passed!" );
});
});
Upvotes: 1