Pig Latin: solution does not pass!

“Should handle words without vowels” problem.
In Chrome Console, this variant works fine.

If there is a special case for words w/o vowels, it is not described in task.

Your code so far

function translatePigLatin(str) {
  if(/^[aoyei]+/.test(str)){ //starts with vowel
    return str+'way';
 return str.replace( /(^[^aoyei]+)(.*)/, '$2$1ay');


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36.

Link to the challenge:

“y” is not a vowel.