text stringlengths 0 1.36k |
|---|
[1956.70 --> 1959.78] And Chrome automatically updates and breaks all your tests. |
[1959.78 --> 1962.62] And web driver implementations are shady between the different. |
[1963.04 --> 1973.68] But like there's so many problems with that that there's this new world of writing like unit tests where you can kind of mount components directly into memory. |
[1973.68 --> 1983.42] And then like kind of write functional style tests as something that doesn't need a browser at all. |
[1983.98 --> 1990.42] And it's a little different than running like JSDOM, which is like essentially providing it a subset of a browser. |
[1990.70 --> 2000.52] And you can do a lot of the tests that you used to do very slowly, very non-deterministically with browsers as a unit test where you say like, |
[2000.52 --> 2007.58] well, if this function, like if a click is applied here and then this, the DOM should then reflect these different things. |
[2007.80 --> 2013.48] And you can test all that stuff like on a per component basis very quickly without spinning up a whole browser. |
[2013.90 --> 2020.34] So JEST is good at helping you manage those types of things. |
[2020.90 --> 2029.24] In general, if you're writing React code, there's a pretty, JEST would be your default choice, even if it's not. |
[2029.24 --> 2034.76] I doubt it has like more than 70% saturation, but that's pretty good. |
[2034.84 --> 2039.48] There's still quite a few other options that people use, Ava and a few different things. |
[2039.90 --> 2047.06] JEST is, I think, coming around and winning the default choice for testing because Facebook wrote it and supports it and stuff. |
[2047.32 --> 2049.58] So is this one just bundled with the new release? |
[2050.12 --> 2052.18] Yeah, so JEST used to be bundled. |
[2052.36 --> 2053.38] It's just a new version. |
[2053.38 --> 2059.80] And so there are new things that the highlights include immersive watch mode, better snapshot format. |
[2059.92 --> 2065.62] So snapshots are where you can say like, once this is rendered with this data, the HTML should look exactly like X. |
[2066.12 --> 2067.26] And then it can test. |
[2067.36 --> 2071.94] So it's kind of like whenever people do screenshots with like CSS frameworks and stuff like that. |
[2071.94 --> 2072.72] Yeah, yeah, yeah. |
[2072.74 --> 2073.86] It needs to be pixel perfect. |
[2073.98 --> 2077.20] You can do the same thing with the HTML output of your components. |
[2077.20 --> 2082.64] You can just say snapshot, like I don't need to write down what it should look like, but I know this is good snapshot. |
[2082.84 --> 2085.34] It shouldn't change unless I change that module. |
[2085.76 --> 2090.54] And so if some dependency accidentally starts changing your HTML, you'll get a test failure. |
[2092.24 --> 2097.18] And then just like the output and stuff, APIs for new stuff for React. |
[2097.44 --> 2102.30] So you also get automatic coverage reporting, which is good. |
[2102.30 --> 2102.78] Cool. |
[2102.78 --> 2103.10] Cool. |
[2103.20 --> 2107.24] So it's kind of just like enforcing good practices on you anyway. |
[2107.72 --> 2107.96] Yeah. |
[2108.08 --> 2127.80] And whenever you do a create React app, it'll start you up with a test directory with a test already written and imported and building and all that kind of stuff to where it's like really as soon as you write your thing, it's a very fast and easy example on how to start writing tests for your thi... |
[2128.32 --> 2129.04] That's awesome. |
[2129.82 --> 2130.26] Yeah. |
[2130.26 --> 2150.82] One tough thing for writing web apps is if you want to write tests in the same JavaScript that you write your components and stuff in, but if you're using Babel and Webpack and stuff in order to compile everything down, then you start needing to like watch and compile your test directory, which i... |
[2150.82 --> 2161.00] But then like while you're writing your app, you're spending an additional, you know, three seconds every time you do a save compiling your thousands of tests that you've written. |
[2161.68 --> 2170.62] And so like there needs to be good configuration on whether you're kind of in a mode where tests run or get compiled or whether it's important for them to get recompiled. |
[2170.62 --> 2183.28] And most of that's handled to where you're not doing unnecessary work as you're working and then your tests can still be in like new, cool, good ES6-y, babbly stuff that you write your other components in. |
[2183.42 --> 2188.40] You don't have to switch context to write like older school JavaScript for your tests. |
[2189.10 --> 2189.30] Great. |
[2189.30 --> 2192.42] So moving off of testing, because I think it's boring. |
[2192.80 --> 2193.72] No, I'm just kidding. |
[2194.76 --> 2195.20] Fair. |
[2195.20 --> 2195.24] Fair. |
[2196.94 --> 2210.78] So I see that one of the things that it also does is it just it adds a service worker like automatically and has an offline caching strategy, which like I think is great that service worker support and PWAs are like landing in frameworks like this. |
[2211.02 --> 2217.26] I'm terrified at the idea of the framework just like implementing a caching strategy that I don't understand. |
[2218.48 --> 2218.96] Sure. |
[2218.96 --> 2221.52] Because I've spent so much time fighting caches. |
[2221.96 --> 2224.00] Like, yeah, it's just kind of worrisome. |
[2224.00 --> 2231.86] So I put a service worker on TXJS early on the TXJS website in 2015, I think. |
[2232.60 --> 2247.18] And if someone had hit it between like 2 a.m. and 3 a.m. a week before the conference, then they would still have be being served that version of the website for the rest of their lives unless they like went in and cleared the service worker. |
[2247.18 --> 2257.04] So like there's definitely some danger to where like you can get yourself in a place where you accidentally cache everything and there's no way to break out. |
[2257.18 --> 2258.26] And that can be unfortunate. |
[2258.26 --> 2262.26] But I haven't dug deep into their service worker implementation. |
[2263.32 --> 2267.66] But my gut is that if you don't do anything weird, it should be fine. |
[2267.70 --> 2269.82] And if you do something weird, sorry. |
[2269.82 --> 2279.16] Yeah, my gut is that it's fine for normal stuff and you'll probably need to turn it off for crazier stuff. |
[2279.30 --> 2290.50] Or if you want like something like it's probably very baseline and very lazy in the sense that it isn't going to do too much because it can't assume as much. |
[2290.50 --> 2294.58] But if you think about just like a caching strategy of like have we seen this before? |
[2295.16 --> 2302.30] Like if you think about a caching strategy, if we've seen it before, return the old one and then always go grab the new one. |
[2302.62 --> 2309.34] And if there is a new one that's different than the old one, go ahead and also send up another event for new data. |
[2309.34 --> 2321.32] And if that's kind of built into the idea of how you render things, which a lot of the React stuff is like as things change, like it automatically updates, then it can kind of be a good default strategy. |
[2322.12 --> 2322.74] Oh, yeah. |
[2322.80 --> 2323.88] I hadn't really thought about that. |
[2324.04 --> 2326.94] Like React has a lot of understanding about the individual components. |
[2326.94 --> 2329.98] So it knows if re-renders need to happen when the backend updates. |
[2330.10 --> 2331.04] That's interesting. |
[2331.90 --> 2338.66] Yeah, there's some nice synchronicity in some of that stuff, I think. |
[2338.66 --> 2342.30] But yeah, it's not going to be a silver bullet, but I think it's pretty good. |
[2342.62 --> 2352.94] Something, Ember CLI doesn't have service worker, but they have, by default, they serve, like whenever you do Ember serve, a, what is it? |
[2353.08 --> 2363.40] A CSP, a content security policy, which I think is a really cool default to have just to like make that a more widely used thing. |
[2363.40 --> 2370.40] Just like beat by default, XSS is harder in Ember apps than it is in other apps because they do CSP. |
[2371.16 --> 2387.98] And so I really like these toolkit style CLI helper things, doing things like solid generic defaults that maybe aren't the best version of them, but maybe get people thinking about service workers or get people thinking about CSP. |
[2387.98 --> 2390.44] And we'll work in all the simple cases as well. |
[2391.56 --> 2392.04] Interesting. |
[2392.46 --> 2393.32] Very interesting. |
[2394.46 --> 2396.74] You sound skeptical, but I know. |
[2396.86 --> 2397.14] No, no, no. |
[2397.22 --> 2404.28] I think just in general, like on the surface, this looks like a boilerplate generator. |
[2404.78 --> 2408.34] It's actually very much not just a boilerplate generator. |
[2408.72 --> 2408.84] Yeah. |
[2408.84 --> 2409.78] I mean, it's like that too. |
[2410.54 --> 2410.84] Yeah. |
[2411.06 --> 2411.58] Yeah, yeah, yeah. |
[2411.68 --> 2412.12] I mean, obviously. |
[2412.12 --> 2416.06] Like a living boilerplate generator, kind of. |
[2416.06 --> 2416.18] Yeah. |
[2416.98 --> 2417.42] Yeah. |
[2418.16 --> 2418.60] Yeah. |
[2418.68 --> 2419.84] That's intense, though. |
[2419.92 --> 2423.92] Well, it's a boilerplate generator, but it keeps on helping. |
[2424.22 --> 2427.32] Like it just helps you continue on developing the app. |
[2427.36 --> 2430.74] It doesn't just like run once and then you like don't use it. |
[2430.76 --> 2431.02] Right. |
[2431.08 --> 2433.90] Because it helps you put together all of the tools that you need for it. |
[2434.28 --> 2434.54] Right. |
[2435.20 --> 2435.60] Yeah. |
[2435.60 --> 2442.40] I mean, it's like all of this stuff feels like it's a great grandchild of Rails where |
[2442.40 --> 2446.68] Rails would, there's a word for it. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.