Testing Node Server with Jest and Supertest

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ธ.ค. 2024

ความคิดเห็น • 78

  • @ovienaduken7296
    @ovienaduken7296 3 ปีที่แล้ว +7

    this is a very straight forward way to explain testing with supertest. Thanks

  • @leetcodeking4859
    @leetcodeking4859 2 ปีที่แล้ว +1

    Hi. I just move to California from China, this is the best video I seen on topic. Thank you friend.

  • @JJP-lb3ek
    @JJP-lb3ek 3 ปีที่แล้ว +5

    Exactly what i needed in my life right now. Thanks!

  • @djvanschaik
    @djvanschaik 2 ปีที่แล้ว +15

    If you get a request not defined error, make sure to try: `const request = require('supertest')` instead of `const supertest = require('supertest')`. Other than that this is great!

    • @sheheerali7059
      @sheheerali7059 2 ปีที่แล้ว +1

      i should have looked at this comment earlier😅

    • @nested9301
      @nested9301 ปีที่แล้ว

      "type":"module"

  • @VladBurlutsky
    @VladBurlutsky 3 ปีที่แล้ว +1

    Just did a random search and came across this video. Very good, Sam!Keep up the good work!

  • @jesuscama5354
    @jesuscama5354 2 ปีที่แล้ว +2

    Thanks for keeping it simple and clean. 🚀

  • @wralith
    @wralith 2 ปีที่แล้ว +2

    It was just what I was looking for. Thank you very much for the clear explanation.

  • @debanjanbarman7212
    @debanjanbarman7212 3 ปีที่แล้ว +3

    Thanks, bro. It helped me. Keep up the good work.

  • @BlackDragon-rj4sc
    @BlackDragon-rj4sc 11 หลายเดือนก่อน

    I just started to create my first nodejs boilerplate with jest test and this video was very helpful to setup things

  • @shahilhussain6466
    @shahilhussain6466 2 ปีที่แล้ว

    That was very quick and simple explanation and use case of Jest and SuperTest, thanks man!.

  • @JigneshPatel-jr5bj
    @JigneshPatel-jr5bj 3 ปีที่แล้ว +2

    Great, thanks for this video!

  • @leandrodavimg
    @leandrodavimg 2 ปีที่แล้ว +2

    Great video, simple and explained very well about supertest

  • @yanyangiachan
    @yanyangiachan 3 ปีที่แล้ว

    I like these testing tutorials with examples. Thanks

  • @babykosh5415
    @babykosh5415 2 ปีที่แล้ว

    THANK YOU for doing the pseudo code steps!

  • @realmonzeromer
    @realmonzeromer 3 ปีที่แล้ว +1

    I was struggling with this
    Thank you so much for your hard work
    I subscribed

  • @Shailendrakumar-ge5cf
    @Shailendrakumar-ge5cf ปีที่แล้ว

    Thank you so much for the text version ♥

  • @debashisroyroy652
    @debashisroyroy652 3 ปีที่แล้ว +1

    helpFull .. Thank You. Expecting more nice things from you.

  • @harmanmax
    @harmanmax 2 ปีที่แล้ว +1

    Thanks mate , in windows i am using cross-env package and in package.json "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --watchAll"

  • @kostiantynkarzhanov9216
    @kostiantynkarzhanov9216 ปีที่แล้ว

    Very good tutorial! Thank you! 💛

  • @Sergio-ef5pz
    @Sergio-ef5pz 3 ปีที่แล้ว +1

    Great content mate! I'm on my first month as a backend dev with Node/Express and I'm looking forward to getting to know testing tools. Thanks for your explanation!

  • @utsavojha2953
    @utsavojha2953 3 ปีที่แล้ว +2

    Great video, great explanation !! Thanks 🤩

  • @brentryczak
    @brentryczak ปีที่แล้ว

    Instant like after that first tip about the ports. That was my issue

  • @suhasvenkatesh7895
    @suhasvenkatesh7895 3 ปีที่แล้ว

    Awesome, simple to understand. Simplicity in explanation. Thanks

  • @scrice9081
    @scrice9081 ปีที่แล้ว

    thanks man this is awesome!!!

  • @guillaume5623
    @guillaume5623 ปีที่แล้ว

    Great content, thank you

  • @prerakhere
    @prerakhere 5 หลายเดือนก่อน

    is supertest used for unit or integration testing? i read at a lot of places on the internet that it is used for integration testing. i am confused.

  • @danielsouza1824
    @danielsouza1824 2 ปีที่แล้ว

    How to overcome "Jest did not exit one second after the test run has completed."? Now I'm facing this problem. Did you solve that?

  • @zainhaider1633
    @zainhaider1633 2 ปีที่แล้ว

    hey great video but i wan to know how not to affect you actual DB during test?

  • @tech3425
    @tech3425 ปีที่แล้ว

    Thanks a lot for this! Would appreciate it if you could make a video regarding setup for this kind of test suite with Typescript-Express

  • @12kenbutsuri
    @12kenbutsuri 3 ปีที่แล้ว +2

    Thank you for the tutorial. I'm a bit confused with one thing though, when was supertest ever used? wasn't everything here contained in jest?

    • @krsnyder128
      @krsnyder128 3 ปีที่แล้ว

      At 4:36 he mentions that the request function comes from supertest!

    • @12kenbutsuri
      @12kenbutsuri 3 ปีที่แล้ว

      @@krsnyder128 thank you! I missed that part.

    • @trant4
      @trant4 2 ปีที่แล้ว +1

      @@krsnyder128 Does not work for me, request is underfined

  • @karinaillesova5706
    @karinaillesova5706 3 ปีที่แล้ว +6

    Hi, this was great video to watch while creating my first tests for my API endpoints. It does however make changes to my actual database. Would you make a video on mongodb-memory-server please?

  • @sammygopeh7578
    @sammygopeh7578 2 ปีที่แล้ว

    Lord! I cannot say thank you and enough

    • @SamMeechWard
      @SamMeechWard  2 ปีที่แล้ว

      consider becoming a channel member ;)

  • @ayushpratap4726
    @ayushpratap4726 3 ปีที่แล้ว

    waiting for the next part ! Try using Nest.JS with JEST Supertest.

  • @ngneerin
    @ngneerin 2 ปีที่แล้ว

    Have been trying to fix supertest with async app. Got fixed after watching this video

  • @RajendraPrasadyk
    @RajendraPrasadyk 2 ปีที่แล้ว

    Can we get video on with middleware supertest

  • @daniel.w8112
    @daniel.w8112 8 หลายเดือนก่อน

    where do we use jest here ?

  • @matthewbeardsley7004
    @matthewbeardsley7004 2 ปีที่แล้ว

    Having this as my script saved me hours!! Thanks!!
    "test": "NODE_OPTIONS=--experimental-vm-modules jest"

    • @alidemircix
      @alidemircix 2 ปีที่แล้ว

      Why does not work only writing npm test for this. I spent about 2 hours to solve this problem but I don't know why do we use "test": "NODE_OPTIONS=--experimental-vm-modules jest" code

  • @nwigweuzochukwu6089
    @nwigweuzochukwu6089 3 ปีที่แล้ว

    In a user registration flow that involves sending verification emails, i'm getting this type of error: thrown: "Exceeded timeout of 5000 ms for a test. I guess it's because of the email sender request and response but how do i fix this?

  • @FredWang
    @FredWang 2 ปีที่แล้ว

    To use `import express from 'express'`, are you using the latest node version or by importing ESM ?

    • @lyflfflyflff
      @lyflfflyflff 2 ปีที่แล้ว +3

      He wrote "type": "module" at the package.json file. It tells node.js to use ECMAScript modules instead of a default CommonJS

  • @attilaszombathelyi3
    @attilaszombathelyi3 9 หลายเดือนก่อน

    great job

  • @he01682936
    @he01682936 3 ปีที่แล้ว

    Nice video, thanks :)

  • @cannabisanomaly
    @cannabisanomaly ปีที่แล้ว

    Anyone been able to figure out how to use EJS syntax for importing/exporting on the backend instead of CJS? I still haven't been able to figure out how to configure that 😅

  • @alex-dk2rj
    @alex-dk2rj 3 ปีที่แล้ว

    Great stuff!

  • @clasesutnfrc8699
    @clasesutnfrc8699 2 ปีที่แล้ว +1

    04:20 Request with supertest

  • @jbkwon
    @jbkwon 2 ปีที่แล้ว

    You are so awesome!

  • @22SPORTSLIVE_10
    @22SPORTSLIVE_10 2 ปีที่แล้ว +1

    Can someone help with some unit test plz

  • @antimaaaato
    @antimaaaato 3 ปีที่แล้ว

    Nice video!
    Could you tell me your Node.js and jest, supertest versions?

  • @MattBodman
    @MattBodman 3 ปีที่แล้ว

    Love the vids! What's the music in this one?

  • @saulramirez727
    @saulramirez727 2 ปีที่แล้ว

    Supervideo of superset

  • @tom_c
    @tom_c ปีที่แล้ว

    Sam, great video! Thank you for contributing to the community... I am having a problem trying to reproduce the core of what you explained. For some reason the test fails saying that the request received a 404 but it should be a 403 (returned correctly testing it via postman). I think it has something to do with the routes and passing the app object to the request function of supertest... Any comments would be appreciated. Thank you in advance!

  • @danielsouza1824
    @danielsouza1824 2 ปีที่แล้ว

    Thank you very much, the NODE_OPTIONS=--experimental-vm-modules npx jest solved my problem 😓

  • @Codethier
    @Codethier 3 ปีที่แล้ว

    i owe you a beer mate

  • @Mercio2
    @Mercio2 2 ปีที่แล้ว

    thanks

  • @JBeique
    @JBeique 2 ปีที่แล้ว

    TDD sure is SUPER with SUPER TESTS

  • @eddyeffy
    @eddyeffy ปีที่แล้ว

    Something is wrong with your dependecies

  • @TenthFir
    @TenthFir ปีที่แล้ว +1

    Why do you guys add music to a course video... I am here to learn. And even the music volume is more than your speech

    • @SamMeechWard
      @SamMeechWard  ปีที่แล้ว

      No guys, just me. I like the music 🤗

  • @TheSerikzhan
    @TheSerikzhan 2 ปีที่แล้ว

    nice

  • @ezeanichucks3728
    @ezeanichucks3728 6 หลายเดือนก่อน

    Dude, I hope I can repay you someday🎉

  • @aprilm2941
    @aprilm2941 3 ปีที่แล้ว +1

    🤗

  • @ms.Mysh1
    @ms.Mysh1 ปีที่แล้ว

    I can’t concentrate because of your beautiful face 😅

  • @sohrabradmehrgaming1556
    @sohrabradmehrgaming1556 2 ปีที่แล้ว

    You should become a teacher or something

    • @SamMeechWard
      @SamMeechWard  2 ปีที่แล้ว

      I don't think i'd be able to put up with the students

  • @djaos-8326
    @djaos-8326 2 ปีที่แล้ว

    thanks