Just an example HTML page for reporting Jasmine 2.0 tests.


<!doctype html>
<html lang="en">
    <meta charset="UTF-8">
    <title>Jasmine 2.0 example page.</title>
    <link href="jasmine.css" rel="stylesheet" />
    <script src="jasmine.js"></script>
    <script src="jasmine-html.js"></script>
    <script src="boot.js"></script>

        // This is the function we will test.
        function addOne(num) {
            if (typeof num == "number") {
                return num + 1
            else {
                return "not a number"

        // These are the tests.
        describe("addOne", function () {
            it("should be a function", function () {
                expect(typeof addOne).toEqual('function');

            it("should be add one to an integer argument", function () {

            describe("when argument is not a number", function () {
                it("should return 'not a number' when argument is String", function () {
                    expect(addOne("this is a string")).toEqual("not a number");


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts