Heads up! To view this whole video, sign in with your Courses Plus account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Setting Up Travis CI with Node.js!
You have completed Setting Up Travis CI with Node.js!
Preview
Continuous Integration services also automatically test pull requests. This video covers failing builds and adding new features via a pull request.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Okay, let's run our tests again, npm test.
0:00
And let's implement these three pending
tests, that they should multiply
0:04
positive numbers, positive and negative
numbers, and negative numbers together.
0:10
Let's head over to
the test_calculator_multiplication.
0:15
And we should be able to just
import the multiply function.
0:21
And we should be able
to just assert.equal.
0:35
Multiply 2 times 3 should be 6.
0:38
In that minus 2 times 3 should be minus 6.
0:56
And that minus 2 times
1:06
minus 3 should be, cool.
1:10
So let's just create a branch git branch,
1:15
git checkout branch multiply,
1:20
And then git add, git commit.
1:27
Created tests for multiplication.
1:33
Git push.
1:41
Or we need to set the upstream
to be origin multiply.
1:48
And now let's check out
our Travis CI tests.
1:55
So as you can see here we have
this multiply going here, and
2:01
you see it's being pushed into this
queue here on the left as well.
2:06
And there's an error, and why is that?
2:15
Well, multiply is not a function,
we've actually wrote the tests but
2:20
we didn't implement it.
2:23
So let's quickly implement that now.
2:24
So, in our index.js we can
create a function, multiply,
2:29
And then return a times b.
2:41
And let's not forget to export it and
just to be sure let's do an npm test.
2:45
All the tests are passing locally so
that's great.
2:54
So we can do git add, git commit -m "Added
2:57
implementation" and then we can push that.
3:02
And it's getting pushed up
to the multiply branch.
3:10
And then we should start seeing
the test being run again.
3:14
And as you can see, it passed this time.
3:29
Great, so now I want to show you what it
looks like when we create a pull request.
3:31
So here's our multiply branch and we can
click compare and create pull request.
3:37
Make sure you select the master branch of
your repository and then add a comment,
3:44
implemented multiplication.
3:50
Create pull request.
3:57
And you should see Travis CI now
taking a look at the pull request.
4:03
And when we click on
Pull Requests over here.
4:09
And as you can see it's
one of the tests again.
4:12
So when we click in you can see
it's creating the Build system.
4:14
Cleaning the repository, installing node.
4:35
Running the tests and
4:38
it passes.
4:44
So let's go back to our pull request and
4:47
you can see that all
the checks have been passed.
4:50
So right now if you're happy you can
match that into your master branch.
4:53
I hope you've enjoyed this workshop,
integrating Travis CI with Node.js.
4:59
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up