- Be sure to have Node.js installed.
- Type
sudo npm install -g mocha
in your terminal
- Navigate into individual lesson folder (eg.
cd 00LessonZero/
) - Run
mocha
in your terminal to run the tests. - Edit lesson script (eg. LessonZero.js) to make the tests pass!
- Simply run
npm test
Tests are a great way to make sure you code works the way you planned it would, and to make sure you don't break something in the future. We will be using them to test our understanding of the lesson.
-
Our test repository is located at https://github.com/AustinCodingAcademy/HTMLIntermediateSection2Tests.
-
Click the 'Fork' button (choose your account if prompted).
-
Copy the HTTPS clone URL
-
In your terminal, navigate (using
cd
) into a directory where you want to start keeping your repositories. -
Clone your new repository by typing
git clone <forked clone URL>
(without carets "<>", ditto for future examples) -
Add the base repository as an upstream
git remote add upstream git@github.com:AustinCodingAcademy/HTMLIntermediateSection2Tests.git
-
Navigate into the directory
cd HTMLIntermediateSection2Tests
-
Type
sudo npm install -g mocha
in your terminal. Enter your password if prompted. -
Navigate into 00LessonZero in your terminal (
cd 00LessonZero/
) -
Run
mocha
-
Watch the test fail :(
-
Open
LessonZero.js
. -
Change the
return false;
statement toreturn true;
-
Run
mocha
again and watch the test pass!
- Below each comment with the specs, try to do what it is asking. Be sure to always
return
your answer. - You can also look at the tests in
test/LessonOneTest.js
to try and read the test examples. - Run
mocha
after each attempt to see if the tests pass.
- When finished, commit your changes and push to GitHub
git status
git add LessonZero.js
git commit -m "Lesson Zero Tests passing!"
git push origin master
.2. Now go to your forked repository on GitHub. A little yellow box should have popped up asking you to make a Pull Request. Click to review.
.3. Click "Create Pull Request"
.4. Everytime you make a change and push to GitHub, this PR will automatically update. No need to do it more than once.
- To get the latest test updates, be sure to have a "clean working directory" by committing or removing all of your changes. You check for a "clean working environment" by running
git status
and makeing sure no files show up. - Run
git pull upstream master