Test suite failed to run

I’m getting this error:

Test suite failed to run

    Cannot find module 'core-js/core/dict' from '../..<solution>/ozans-playlist.js'

    Require stack:
      <solution>/ozans-playlist.js
      <solution>/ozans-playlist.spec.js

Locally it works fine, this is the first time it is causing problems worked fine through the entirety of JS Track.

Hi there!

I cannot reproduce the error you’re running into:

…but we have had issues with core-js being misconfigured in the past.

  1. Can you check if on Ozan's Playlist in JavaScript on Exercism you see a prompt to update your exercise? If so, please do it.
  2. If not or if it still doesn’t work, could you post your solution here? I’m happy to look into the issue in the test-runner.

I did not receive any prompt whatsoever; it works fine offline.
the code file is pasted below.

// @ts-check
//
// The line above enables type checking for this file. Various IDEs interpret
// the @ts-check directive. It will give you helpful autocompletion when
// implementing this exercise.
import { set } from "core-js/core/dict";
/**
 * Removes duplicate tracks from a playlist.
 *
 * @param {string[]} playlist
 * @returns {string[]} new playlist with unique entries
 */
export function removeDuplicates(playlist) {
  const play = [...new Set(playlist)];
  return play;
}
/**
 * Checks whether a playlist includes a track.
 *
 * @param {string[]} playlist
 * @param {string} track
 * @returns {boolean} whether the track is in the playlist
 */
export function hasTrack(playlist, track) {
  const play = new Set(playlist);
  return play.has(track);
}
/**
 * Adds a track to a playlist.
 *
 * @param {string[]} playlist
 * @param {string} track
 * @returns {string[]} new playlist
 */
export function addTrack(playlist, track) {
  const play = new Set(playlist);
  play.add(track);
  return [...play];
}
/**
 * Deletes a track from a playlist.
 *
 * @param {string[]} playlist
 * @param {string} track
 * @returns {string[]} new playlist
 */
export function deleteTrack(playlist, track) {
  const play = new Set(playlist);
  play.delete(track);
  return [...play];
}
/**
 * Lists the unique artists in a playlist.
 *
 * @param {string[]} playlist
 * @returns {string[]} list of artists
 */
export function listArtists(playlist) {
  let play = new Set();
  for (let i = 0; i < playlist.length; i++) {
    play.add(playlist[i].split(' - ')[1]);
  }
  return removeDuplicates([...play]);
}

Thank you for reporting.

I’m assuming you didn’t add the import line yourself but rather your editor or IDE added it when you were filling in this exercise.

Core-js is a library that allows us to write code for older systems such as an older node of older browser. However, the way it’s works is that it looks at the current running version of the executing system and then “just in time” inserts the correct polyfills, such as the one imported in your code.

However, what’s locally available would only match what’s available on the test runner if you have the exact same setup (which you don’t, which is normal. I also have a different setup).

The solution here is to remove the import line. The tests should still run locally. The tests should then also run on the test runner.

Going forward, you should never import from the core-js package: the test runner will do this for you, and so does the local setup!

it works, thank you sir for your time and guidance! :pray:

1 Like