Transcript from the "Jest JSDOM" Lesson
[00:00:28] What, that's weird. And then we'll run our test again and we'll see the giant window object that's provided to us by JS DOM. Okay, so that's kind of fun and stuff. But if this were the only test that I had in my project, maybe this is a note project or it's just pure Java scripting, then I don't actually need the ability to access window.
[00:00:55] And so I don't need JS DOM. By adding JS DOM it actually is pretty heavy memory wise. And so it adds to the start time so that's why I'm showing you. Let's go ahead and add our configuration right in the [INAUDIBLE] JSON for jest. And here we can add a test environment and this is a path to a node module that is responsible for creating or setting up the test environment.
[00:01:22] And so there is a jest-environment-jsdom, and that's the default that's installed when you install jest so that's why this works. And then there's a jest environment node and that's also installed by default so you don't have to install that. There are various other test environments that are kind of interesting.
[00:01:42] I feel like there's even one that's like for selenium or web driver or something. It's just like what? It's crazy. Jest is a very, very versatile tool. Another handy feature about this test environment is if the module starts with jest-environment and you can actually remove that. So it reads a little nicer.
[00:02:01] So with that we can run this and now our test is going to fail because we're trying to log something that's not defined. So we are all set to have our tests run a little bit faster.