We're going to iterate an implementation of Project Euler problem 1 in Javascript via TDD.
Implement a command line program in Javascript to solve Project Euler problem 1.
To automatically run the spec files you've added to src
folder when they change, run npm --silent start
.
- Clone this repository.
- Install node.js/npm with package manager
- Verify installation:
which node
should tell you where node is installed e.g./usr/local/bin/node
which npm
should tell you the same e.g./usr/local/bin/npm
- Install dependencies with
npm install
, which should install jasmine for node. - The
postinstall
script should have ran, and if all dependencies are installed correctly, should have produced an output similar to:
>> Executing 5 defined specs...
Test Suites & Specs:
1) Example module
. ✔ should be loaded
. ✔ should be able to add
. ✔ should not know how to subtract
2) nested test suite
* ⚠ should have a pending test
* ⚠ should have another pending test
Pending:
1) Example module nested test suite should have a pending test
How to create a pending test
2) Example module nested test suite should have another pending test
Temporarily disabled with xit
5 specs, 0 failures, 2 pending specs
Finished in 0.012 seconds
>> Done!
Pending Specs:
1) Example module nested test suite : should have a pending test
Reason: How to create a pending test
2) Example module nested test suite : should have another pending test
Reason: Temporarily disabled with xit
Summary:
Suites: 2 of 2
Specs: 3 of 5 (2 pending)
Expects: 3 (0 failures)
Finished in 0.012 seconds
- Tests/Specs should be saved in
src
folder with the suffix_spec.js
e.g.euler_1_spec.js
.
There is desire to setup the project in IntelliJ. However, only IntelliJ Ultimate or WebStorm support Javascript projects, and both require licenses.
- Download IntelliJ Community Edition
- Setup your project in IntelliJ