damianarp / fizzbuzz

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fizzbuzz Exercise

Technical exercise in job interview

Build Status

The following exercise prints a list of numbers in which "fizz" is printed when the number is a multiple of 3, "buzz" is printed when it is a multiple of 5, and "fizzbuzz" is printed when it is a multiple of both.

Installation

In this case, Fizzbuzz uses Node.js v10+ to run.

Create a new project by default, install the dependencies and devDependencies and start the server:

cd fizzbuzz
npm init -y

Install the jest library in development mode for testing:

npm i -D jest

Configure jest:

npx jest --init

Would you like to use Jest when running "test" script in "package.json"? NO

Would you like to use TypeScript for the configuration file? NO

Choose the test enviroment that will be used for testing: NODE

Do you want Jest to add coverage reports? YES

What provider should be used to instrument code for coverage? V8

Automatically clear mock calls and instances beetween every test? YES

Create a new file named fizzbuzz.js and fizzbuzz.test.js

Test

For tests, run:

npm test

And:

npm run test:watch

The list

For print the list, run:

node fizzbuzz

About


Languages

Language:JavaScript 100.0%