Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 1 KB

README.md

File metadata and controls

53 lines (37 loc) · 1 KB

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