constructor error

61 views
Skip to first unread message

Joseph Burdeos

unread,
Apr 7, 2016, 3:30:10 PM4/7/16
to Jasmine
hello. here is my jasmine test. 

describe("variable a", function () {
    var a;
    it("says hello", function () {
        a = "Hello";
        expect(a.toBe("Hello"));
    });
});

i ran this and i get the following error:

     Message: TypeError: undefined is not a constructor (evaluating 'a.toBe("Hello")')

i checked the output pane and saw this:

Error: ReferenceError: Can't find variable: $
at global code in file:///c:/users/jburdeos/source/workspaces/productrepository2/trunk/productrepository.joseph.test/scripts/_Chutzpah.b2b0cc0485f4372790dc5d234d0587d8.test.html (line 311)
While Running:c:\users\jburdeos\source\workspaces\productrepository2\trunk\productrepository.joseph.test\scripts\josephjasminetest.js

Error: ReferenceError: Can't find variable: $
at global code in file:///c:/users/jburdeos/source/workspaces/productrepository2/trunk/productrepository.joseph.test/scripts/_Chutzpah.b2b0cc0485f4372790dc5d234d0587d8.test.html (line 443)
While Running:c:\users\jburdeos\source\workspaces\productrepository2\trunk\productrepository.joseph.test\scripts\josephjasminetest.js

Error: ReferenceError: Can't find variable: $
at global code in file:///c:/users/jburdeos/source/workspaces/productrepository2/trunk/productrepository.joseph.test/scripts/_Chutzpah.b2b0cc0485f4372790dc5d234d0587d8.test.html (line 729)
While Running:c:\users\jburdeos\source\workspaces\productrepository2\trunk\productrepository.joseph.test\scripts\josephjasminetest.js


i tried googling for solutions but to no avail. can anyone help me?

thanks in advance


Gregg Van Hove

unread,
Apr 7, 2016, 3:40:31 PM4/7/16
to jasmi...@googlegroups.com
Looks like you have a paren `)` in the wrong place. Your expect line should read `expect(a).toBe("Hello");` The matchers are called on the result of `expect` not inside it.

Hope this helps. Thanks for using Jasmine!

- Gregg

--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jasmine-js+...@googlegroups.com.
To post to this group, send email to jasmi...@googlegroups.com.
Visit this group at https://groups.google.com/group/jasmine-js.
For more options, visit https://groups.google.com/d/optout.

Joseph Burdeos

unread,
Apr 8, 2016, 1:23:54 PM4/8/16
to Jasmine
Thank you so much! Spent an entire day looking for a solution for this. im so stupid but i guess thats how i learn. lol. thanks again!
Reply all
Reply to author
Forward
0 new messages