HomeОбразованиеRelated VideosMore From: LevelUpTuts

#4 Writing Integration Tests - React Testing For Beginners

106 ratings | 7439 views
In this series we demystify React testing for beginners. We show you how to test React components using Jest & React Testing Library. No prior testing experience necessary. ### Video Links Buy React Testing For Beginners: https://www.leveluptutorials.com/store/products/tutorials/lut-dd026 Become a Pro: https://www.leveluptutorials.com/pro ### Affiliate Links Please use these links when signing up for services to help support Level Up. Easy Hosting with Netlify: https://goo.gl/pychVP Shared Web Hosting: https://goo.gl/pfC6uc ### Level Up Links Syntax Podcast ft Scott Tolinski & Wes Bos: https://goo.gl/7jDDxX Subscribe to the Level Up Newsletter http://eepurl.com/AWjGz Developer Ready Complete and ready to set-up JavaScript testing solution. Works out of the box for any React project. Instant Feedback Fast interactive watch mode runs only test files related to changed files and is optimized to give signal quickly. Snapshot Testing Capture snapshots of React trees or other serializable values to simplify testing and to analyze how state changes over time. Zero configuration testing platform Jest is used by Facebook to test all JavaScript code including React applications. One of Jest's philosophies is to provide an integrated "zero-configuration" experience. We observed that when engineers are provided with ready-to-use tools, they end up writing more tests, which in turn results in more stable and healthy code bases.
Html code for embedding videos on your blog
Text Comments (12)
Lập Trần Sáng (8 days ago)
Hi @LevelUpTuts your IDE theme is realy nice, could you share your theme name, thanks you.
Stewie Po (1 month ago)
Oh, you like to talk) But tuts are great
Cris Muscalu (1 month ago)
Tolinski i didn't watch you videos in a while now and i just realized someting terrrible! You are by far the biggest instigator to procrastination of all! I've been messing with my fonts and terminal for 2 hours now and it's all you fault! :-D
Cris Muscalu (1 month ago)
Btw on windows splitting the terminal to the right doesn't work (or at least for me)
Evgheni Calcutin (1 month ago)
what font in IDE was used? I'd like to use it in VSCode
Dominik Seljan (10 days ago)
Evgheni Calcutin FiraCode
TLCSlAssassinl (1 month ago)
Great tutorial series! I have one problem though, I get an error when I try to import stuff from other .js files. Any idea what may cause this? FAIL src/Components/App.test.js ● Test suite failed to run Jest encountered an unexpected token This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript. By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules". Here's what you can do: • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. • If you need a custom transformation specify a "transform" option in your config. • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. You'll find more details and examples of these config options in the docs: https://jestjs.io/docs/en/configuration.html Details: D:\Projects\AutoScout23_Frontend\src\Components\App.test.js:1 ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { add } from "./ForTesting"; ^ SyntaxError: Unexpected token { at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:403:17) Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total Time: 1.729s Ran all test suites. npm ERR! Test failed. See above for more details.
Macky Beltran (11 days ago)
i got this error too before. it's probably due to errors on the dev environment setup (import is es6). What I did to fix: clone the repo, then npm install fsevents. I'm using a mac, if that helps.
tanyuj (2 months ago)
i've done very little testing in the past, but aren't you suppose to write test, watch it fail then write the function that makes that test pass, then refactor that function? opposed to you just writing the function first then the test?
LevelUpTuts (2 months ago)
You are right. That's just TDD.
tanyuj (2 months ago)
maybe that's TDD which is a different approach to testing. i dunno. im still learning.
Yash Raj Arora (3 months ago)
awesome !!!!

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.