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.
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
For tests, run:
npm test
And:
npm run test:watch
For print the list, run:
node fizzbuzz