Marsrover.js
var marsRover = function() {
return 0;
};
MarsRoverSpec.js (this does not work)
describe("MarsRover Kata Tests", function() {
it("has function named marsRover", function() {
expect(marsRover()).toBe(0);
});
});
The above code does not work: ReferenceError: marsRover is not defined
MarsRoverSpec.js (this works)
var marsRover = function() {
return 0;
};
describe("MarsRover Kata Tests", function() {
it("has function named marsRover", function() {
expect(marsRover()).toBe(0);
});
});
I assume that I need to include or require a JS file. What is the best or easiest way to do this?
HTML
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Jasmine Spec Runner v2.0.0</title>
<link rel="shortcut icon" type="image/png" href="lib/jasmine-2.0.0/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href="lib/jasmine-2.0.0/jasmine.css">
<script type="text/javascript" src="lib/jasmine-2.0.0/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-2.0.0/jasmine-html.js"></script>
<script type="text/javascript" src="lib/jasmine-2.0.0/boot.js"></script>
<script type="text/javascript" src="../Mars Rover/src/MarsRover.js"></script>
<script type="text/javascript" src="../Mars Rover/spec/MarsRoverSpec.js"></script>
</head>
<body>
</body>
</html>
source
share