1 00:00:01,290 --> 00:00:05,380 In this video we're going to install a couple of dependencies to get our test setup up and running. 2 00:00:05,480 --> 00:00:07,090 It's going to go over to my terminal. 3 00:00:07,160 --> 00:00:12,720 I'm gonna make sure I'm inside my art service directory and we will do an npm install a very critically 4 00:00:12,750 --> 00:00:17,240 these test dependencies are going to install are going to be marked as development dependencies. 5 00:00:17,340 --> 00:00:20,030 So we're going to add on that save Dev flag right there. 6 00:00:20,100 --> 00:00:24,300 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 7 00:00:24,300 --> 00:00:25,330 going to install. 8 00:00:25,410 --> 00:00:34,970 So I'll do an app types just at types super test we'll get just we are going to get something else called 9 00:00:35,000 --> 00:00:45,330 T S just super test and then Mongo DV memory server OK. 10 00:00:45,460 --> 00:00:49,390 So let's run this command because it is going to take a little bit to install and we'll discuss exactly 11 00:00:49,390 --> 00:00:51,900 what's going on with all this. 12 00:00:51,910 --> 00:00:52,200 All right. 13 00:00:52,210 --> 00:00:55,480 So this is going to kick off the installation process and I'm going to sit here at the screen for a 14 00:00:55,480 --> 00:00:56,530 little bit. 15 00:00:56,650 --> 00:01:01,080 You're going to start to see that as we install a very particular package the one called Mongo to be 16 00:01:01,090 --> 00:01:02,050 memory server. 17 00:01:02,050 --> 00:01:05,260 There's actually a rather large download to go along with it. 18 00:01:05,290 --> 00:01:10,000 Now just before this video I pre installed that thing just to save a little bit of time this video but 19 00:01:10,000 --> 00:01:15,580 for you you're probably gonna see that it's downloading a file that is 80 megabytes large or so. 20 00:01:15,640 --> 00:01:19,130 So that is this copy of Mongo TB that is going to be running in memory. 21 00:01:19,150 --> 00:01:24,520 The reason we are running a copy of Mongo in memory is that we can easily test multiple databases at 22 00:01:24,520 --> 00:01:25,470 the same time. 23 00:01:25,630 --> 00:01:30,070 Remember we really want to be able to run tests for different services concurrently on the same machine 24 00:01:30,730 --> 00:01:34,420 that might eventually start to be a little bit challenging if we are having them all connect to the 25 00:01:34,420 --> 00:01:36,150 same instance of Mongo DB. 26 00:01:36,820 --> 00:01:42,550 So rather than having all these different services connecting to the same test instance of Mongo we're 27 00:01:42,550 --> 00:01:49,330 going to instead create a mongo DV memory server or an instance of Mongo in memory for each these different 28 00:01:49,330 --> 00:01:56,450 services we are testing it's going to end up running much much more quickly now that 80 megabyte download 29 00:01:56,510 --> 00:02:00,950 is something that we really do not want to repeat every single time that we tried to build up our Docker 30 00:02:00,950 --> 00:02:03,500 image where the OTT service. 31 00:02:03,500 --> 00:02:07,970 The only thing that's going to be running inside of our docker container or the OSS service is the actual 32 00:02:07,970 --> 00:02:09,330 express application. 33 00:02:09,380 --> 00:02:13,780 We have said that we're not going to be running our tests inside of that image at any point in time. 34 00:02:14,060 --> 00:02:17,900 So we don't really need to install any of these dependencies as we are building that image. 35 00:02:17,900 --> 00:02:21,680 That's why we installed them as D development dependencies. 36 00:02:21,680 --> 00:02:25,790 We're not going to go over to our Docker file and we're going to update it to make sure that whenever 37 00:02:25,790 --> 00:02:30,350 we build an image for the service we do not attempt to install these development dependencies. 38 00:02:30,350 --> 00:02:35,180 And again it's so we can avoid downloading that 80 megabyte file every single time we have to rebuild 39 00:02:35,210 --> 00:02:36,510 our image. 40 00:02:36,620 --> 00:02:38,360 So I got to go back over to my editor. 41 00:02:38,390 --> 00:02:44,840 I'm going to find my Docker file inside the off directory and I'm going to modify the NPM install command. 42 00:02:44,990 --> 00:02:51,770 I'm going to change the very end of it to only broad like so and then I'll save the file. 43 00:02:51,770 --> 00:02:56,820 To now if we ever decide to install more dependencies into our project or change any other file that's 44 00:02:56,820 --> 00:02:59,230 going to cause the image to be rebuilt. 45 00:02:59,250 --> 00:03:02,950 We will not have to sit around and wait for that 80 megabyte download. 46 00:03:03,000 --> 00:03:06,780 This might sound like a very small optimization but you're going to see that we're going to actually 47 00:03:06,780 --> 00:03:12,270 have to rebuild our image several times in the coming videos or as we build in one last thing to our 48 00:03:12,720 --> 00:03:13,620 service here. 49 00:03:13,680 --> 00:03:18,480 And if we had to re download that Mongo DB memory server every single time it would be really annoying 50 00:03:18,540 --> 00:03:19,600 really quickly. 51 00:03:20,270 --> 00:03:20,620 OK. 52 00:03:20,640 --> 00:03:24,530 So back in my terminal it looks like all those dependencies were installed. 53 00:03:24,540 --> 00:03:25,680 Let's take a quick pause right here. 54 00:03:25,680 --> 00:03:27,580 We're going to start to make use of these things. 55 00:03:27,580 --> 00:03:30,420 I know we haven't really discussed each of them in detail yet. 56 00:03:30,420 --> 00:03:32,550 We're going to start to wear them all up in the next video.