Reputation: 1327
I have a test that passes fine in the browser but is failing in Chutzpah.
Here is the portion that is failing:
var nameLowerCase = person.PersonName.toLowerCase();
var searchLowerCase= search.toLowerCase();
return (nameLowerCase.includes(searchLowerCase));
Chutzpah says:
Message: TypeError: undefined is not a constructor (evaluating 'nameLowerCase.includes(searchLowerCase)') ...
It seems to have an issue with the includes
function, because if I remove that it runs.
I will probably try replacing that functionality with Regex or something, but it's been a huge pain trying to track this down. If I am missing something stupid I would love to have that pointed out to me.
Upvotes: 3
Views: 663
Reputation: 16762
The JS engine which PhantomJS uses does not support the includes method yet.
Upvotes: 5
Reputation: 1327
I still want someone else to answer this question because I want to know why .includes
doesn't work, but using Regex solved my issue:
var searchPattern= new RegExp(search, 'i');
return (person.PersonName.match(searchPattern));
Upvotes: 0