Jasmine doesn't seem to support =>
(if my own findings are correct).
This is a snippet from my logic.js
file
var myObj = new function(){
this.getSomething = function(input){
_myLocalArray.forEach(item =>{
//left blank
});
};
};
My test is
/// <reference path="../../Ui/Content/Javascript/logic.js"/>
/// <reference path="jasmine.js" />
describe("My Tests", function () {
it("Description etc", function () {
var result = myObj.getSomething("some input"); // FAILS HERE
expect(result.length).toBe(0);
});
...
It fails with
JavaScript critical error at line 61, column 37 in file:///d:/github/Ui/Content/Javascript/logic.js\n\nSCRIPT1002: Syntax error
Line 61 is shown in th3e code snippet above with //FAILS HERE
and then an exception in Jasmine is thrown which is
myObj is undefined
If I comment out the code in logic (where I use =>
) then the code executes without these errors
What am I doing wrong? Is =>
not supported? I find nothing in the docs to confirm this.
EDIT
I am not use nodeJs. I'm using vanilla javascript, visual studio 2017, Jasmine and Chutzpah.
from Does Jasmine support javascript with => (arrow)
No comments:
Post a Comment