If you want to test String.prototype.includes in PhantomJS? Apparently PhantomJS doesn’t implement ES6 features properly. Luckily String.prototype.includes is quite easy to polyfill. You can choose if you want to do that in the test suite or the controller.
1 2 3 4 5 | if (!String.prototype.includes) { String.prototype.includes = function() {'use strict'; return String.prototype.indexOf.apply(this, arguments) !== -1; }; } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.