Skip to content

Simple set up to crack code challenges and test as you go + my coding challenges (Codewars, Advent of Code, Challenge Rocket, LeetCode)

Notifications You must be signed in to change notification settings

lazy-ocean/coding_challenges

Repository files navigation

coding_challenges

A simple set-up to crack code challenges, executing in VS Code and testing with Jest as you go.

To do

You'll need on your computer:

  • Node.js
  • npm / yarn
  • Jest (testing)
  • nodemon (watching for changes and executing JavaScript code in the console)

How does it work

  1. Copy example folder and rename for your challenge
  2. Modify solution.test.js according to your tests:
const tests = {
  // Format:
  // 'test name': [[arguments], expected result]
  "adds 1 + 2 to equal 3": [[1, 2], 3],
  "adds 1 + 5 to equal 6": [[1, 5], 6],

  // if there's only one argument:
  "some name": [1, 6],

  // if an array is argumented:
  "some name": [[[2, 3]], 6],

  // add any number of tests
};
  1. Work in solution.js as usual
  2. To execute your code on every save:
$ nodemon ./folder-name/solution.js
  1. To run tests:
$ yarn test ./folder-name

or with testing on every save

$ yarn test ./folder-name --watch

About

Simple set up to crack code challenges and test as you go + my coding challenges (Codewars, Advent of Code, Challenge Rocket, LeetCode)

Topics

Resources

Stars

Watchers

Forks