Testing failes for Sum all primes

The tests are for some reason returning “TypeError: unknown: undefined has no properties”. Does anyone see why and guide me on the right path?

const isPrime = num => {
  for (let i = 2; i < num; i++) if (num % i === 0) return false;
  return num > 1;
};

const sumPrimes = num => {
  try {
    if (num < 2) {
      throw new RangeError('Check your input');
    }

    let arr = [];

    for (let index = 2; index <= num; index++) {
      if (isPrime(index)) {
        arr.push(index);
      }
    }
    return arr.reduce((acc, val) => acc + val);
  } catch (e) {
    console.error(e);
  }
};

sumPrimes(977); // This returns the correct value