JavaScript Unit Testing with Mocha and Chai

preview_player
Показать описание
When writing programs it is essential to do proper testing before releasing the product. You should never release even a beta version of a website or app without doing some extensive testing on your scripts.
Mocha is a testing framework that lets you run automated tests on your scripts.

Other Notes:
1. In addition to the skip method shown in the video there is also an "only" method that can be used to select individual test(s) that you want to run.
2. There is a retries method that you can use inside your it( ) test. It will retry the test up to the number of times you specify in order to try to get a pass.
3. There are hooks for other functions that you can put inside your describe( ) function. They are afterEach( ) and beforeEach( ). Each of these accept a function as an argument and will run that function either after or before EACH it( ) test within the describe.

Рекомендации по теме
Комментарии
Автор

Masterpice, the speed, the knowladge, the way the content is passed to the listener it just on another level. GREAT! Thank you

PP-ihbh
Автор

Thanks again Steve. I am transitioning from Java to Node framework and your tutorials help me a lot.

pinakim
Автор

Steve Griffith, you are a very good Teacher. Whoever does not understand Unit Testing with Mocha and Chai after watching this video, may find it difficult to learn anything new. Liked and subscribed.

emmanuelaigbovbiosa
Автор

This is one of the best and thorough tutorials on Mocha and Chai! Thank you! :)

pratimadongre
Автор

Than you so much Steve for preparing and uploading this content, it is very useful.

EdwinNiwaha
Автор

It really explains the concept of testing in Javascript in an understandable manner.

kelvinmwangemi
Автор

Eerytime I try to study somthing new regarding SWE since I started like 6 years ago I somehow end up in one of your vids. It's like learning from an old friend lmao

dd-v
Автор

Steve Griffith, more like Jesus Griffith

zpjzusx
Автор

Great, simple, straight-forward tutorial and thank you so much for including links to the code. Also, you have a really soothing voice, which is a huge bonus :)

myronschabe
Автор

So if someone is facing an issue running the very first assertion, try popping the following line in your package.json line just above the scripts property: "type": "module". Next, remove the two require statements and put these instead: 1) import { assert } from 'chai'; and 2) import { robot as R } from '../app.js'; Finally, go to the app.js file and append this export statement to the bottom of your code: export { robot }; and remove the previous module.exports = robot;

ryanford
Автор

Thanks Steve, for this intro to mocha & chai. I’ve been able to learn it right off the bat and even extend it to several other tests; thanks to the IntelliSense built into my coding environment of Visual Studio Code.

stephenkasirye
Автор

Thank you for explaining stuff in such a clear way, you are an excellent teacher! I always undestand the point you are trying to make!

eula
Автор

Brilliant. Unit testing makes sense now. Thanks

AthenaTheSlayer
Автор

Really Amazing tutorial, helped me alot with my Uni assignment!!!!

CurrentGamer
Автор

This tutorial is really good, help me learn the tdd from scrach, thank you very much!

huchenqiang
Автор

CONST best_teacher_ever = "Steve Griffith";

nicolaregiacorte
Автор

Why is this preferable to console.log at points in the code?

alexvass
Автор

is "|| true" still valid in March 2021?

I'm getting an error:
"'true' is not recognized as an internal or external command,
operable program or batch file."

mitchell
Автор

Do I need to install mocha for every project?

tazad
Автор

Line 26 of the app.js the console.log does "pew pew.", but should do "pew pew pew". Pls fix it and then do another pull.

KLNNNN
visit shbcf.ru