Best way to set up Exercism folder for JS and VSCode?

Hello! I’m trying my hand at the JavaScript track, having previously worked my way through a good number of C# exercise (my main language at work).

I attempted to set up my folder structure as shown in the screenshot below, similar to how I have my C# folder setup:

Essentially:

- root folder
-- hello-world
-- lasagna
.code-workspace

However, I’m having quite a bit of trouble running these tests inside VS Code with the official Jest extension, and I’m struggling to figure out how to configure it. I can still run the tests from the CLI just fine.

Is there a way I can get it to discover all of the tests from all subfolders if I’m using folder structure?

JS track is based on the idea, that each exercise is a project on its own. So while you can easily point VSCode to the parent folder to have all of them in one workspace, there still is no project setup supporting that.

To “discover all tests of all exercises” a Jest installation and configuration in the workspace folder should be enough project setup. I haven’t done that on my own, but you may start by copying packages.json from an exercise and adjust that.

Yes, by running jest “standalone” in the workspace root, like @mk-mxp suggested.

One way to do that is something like:

npx jest

However, it’s recommended to open one folder at a time :slight_smile:

1 Like

Thanks @SleeplessByte and @mk-mxp! I’ll definitely keep that in mind, will probably have to rethink my folder structure. A good learning opportunity for sure!