Challenge Reverse Words : why Test Code doesn't work?

I’m doing the challenge Reverse Words, I did tests to test the script, even with error cases (empty string or only one word) but when I click on Test Code, it tells me :

Tests failed to run due to an error: “”. Check your code and try again.

I don’t understand what the error could be since my tests seem to run correctly. My code :

function wordReverser(phrase) {
  var phraseArray = phrase.split(' ');
  var x = phraseArray.length;
  var y = parseInt(x/2);
  var tmp;
  if (x <= 0)
    return("");
  if (x == 1)
    return (phrase);
  for (var z = 0; z < y;z++)
    {
      tmp = phraseArray[z];
      phraseArray[z] = phraseArray[x-1];
      phraseArray[x-1] = tmp;
      x--;
    }
  finalPhrase = phraseArray.join(" ");
  return (finalPhrase);
}
console.log(wordReverser(""));
console.log(wordReverser(" "));
console.log(wordReverser("Codecademy rules"));
console.log(wordReverser("Codecademy"));
console.log(wordReverser(("May the Fourth be with you")));

// Leave this so we can test your code:
module.exports = wordReverser;

Another thing, though not as important, if I let my tests on it (they are outside the function) before clicking on Test Code, it will tells me :

Tests failed to run due to an error: "Looks like your code is not compiling or not being exported with module.exports = FUNCTION NAME. Check for a syntax error. ". Check your code and try again.

To test it directly :

function wordReverser(phrase) { var phraseArray = phrase.split(' '); var x = phraseArray.length; var y = parseInt(x/2); var tmp; if (x <= 0) return(""); if (x == 1) return (phrase); for (var z = 0; z < y;z++) { tmp = phraseArray[z]; phraseArray[z] = phraseArray[x-1]; phraseArray[x-1] = tmp; x--; } finalPhrase = phraseArray.join(" "); return (finalPhrase); } console.log(wordReverser("")); console.log(wordReverser(" ")); console.log(wordReverser("Codecademy rules")); console.log(wordReverser("Codecademy")); console.log(wordReverser(("May the Fourth be with you"))); // Leave this so we can test your code: module.exports = wordReverser;