Jasmine test fails when run in Chutzpah but not in browser

I have a test that carries over fine in the browser, but doesn't work in Chutzpah.

Here's the part that fails:

var nameLowerCase = person.PersonName.toLowerCase();
var searchLowerCase= search.toLowerCase();
return (nameLowerCase.includes(searchLowerCase));

      

Chutzpach says:

Message: TypeError: undefined is not a constructor (evaluating 'nameLowerCase.includes (searchLowerCase)') ...

It seems that the problem is with the function includes

, because if I remove it, it will run.

I'll probably try to replace this functionality with Regex or something, but it was a huge pain trying to track this down. If I'm missing something stupid I would like it to point to me.

+3


source to share


2 answers


The JS engine that PhantomJS uses does not yet support the include method.



+5


source


I still want someone else to answer this question because I want to know why it .includes

doesn't work, but using Regex solved my problem:



var searchPattern= new RegExp(search, 'i');
return (person.PersonName.match(searchPattern));

      

0


source







All Articles