In this video we're going to install a couple of dependencies to get our test setup up and running.
It's going to go over to my terminal.
I'm gonna make sure I'm inside my art service directory and we will do an npm install a very critically
these test dependencies are going to install are going to be marked as development dependencies.
So we're going to add on that save Dev flag right there.
I'll show you why we're adding this in in just a moment and then going to list out all the stuff we're
going to install.
So I'll do an app types just at types super test we'll get just we are going to get something else called
T S just super test and then Mongo DV memory server OK.
So let's run this command because it is going to take a little bit to install and we'll discuss exactly
what's going on with all this.
All right.
So this is going to kick off the installation process and I'm going to sit here at the screen for a
little bit.
You're going to start to see that as we install a very particular package the one called Mongo to be
memory server.
There's actually a rather large download to go along with it.
Now just before this video I pre installed that thing just to save a little bit of time this video but
for you you're probably gonna see that it's downloading a file that is 80 megabytes large or so.
So that is this copy of Mongo TB that is going to be running in memory.
The reason we are running a copy of Mongo in memory is that we can easily test multiple databases at
the same time.
Remember we really want to be able to run tests for different services concurrently on the same machine
that might eventually start to be a little bit challenging if we are having them all connect to the
same instance of Mongo DB.
So rather than having all these different services connecting to the same test instance of Mongo we're
going to instead create a mongo DV memory server or an instance of Mongo in memory for each these different
services we are testing it's going to end up running much much more quickly now that 80 megabyte download
is something that we really do not want to repeat every single time that we tried to build up our Docker
image where the OTT service.
The only thing that's going to be running inside of our docker container or the OSS service is the actual
express application.
We have said that we're not going to be running our tests inside of that image at any point in time.
So we don't really need to install any of these dependencies as we are building that image.
That's why we installed them as D development dependencies.
We're not going to go over to our Docker file and we're going to update it to make sure that whenever
we build an image for the service we do not attempt to install these development dependencies.
And again it's so we can avoid downloading that 80 megabyte file every single time we have to rebuild
our image.
So I got to go back over to my editor.
I'm going to find my Docker file inside the off directory and I'm going to modify the NPM install command.
I'm going to change the very end of it to only broad like so and then I'll save the file.
To now if we ever decide to install more dependencies into our project or change any other file that's
going to cause the image to be rebuilt.
We will not have to sit around and wait for that 80 megabyte download.
This might sound like a very small optimization but you're going to see that we're going to actually
have to rebuild our image several times in the coming videos or as we build in one last thing to our
service here.
And if we had to re download that Mongo DB memory server every single time it would be really annoying
really quickly.
OK.
So back in my terminal it looks like all those dependencies were installed.
Let's take a quick pause right here.
We're going to start to make use of these things.
I know we haven't really discussed each of them in detail yet.
We're going to start to wear them all up in the next video.