Skip to content

Testing Routes and Controllers: explicitly state that jest is required to test sample code #30420

@hbar1st

Description

@hbar1st

Checks

Describe your suggestion

This lesson described supertest without actually differentiating clearly between it and testing frameworks like Jest/Mocha etc. An unsuspecting learner like me, reads the text of the lesson and doesn't realise that supertest doesn't work the same as these testing frameworks. The lesson doesn't actually also say that in order to run the supertest code samples given, we need a testing framework (Jest) to be installed and setup first.
This led me to make a couple of mistakes when trying out the lesson.
1- I didn't know that Supertest was not able to actually run the tests
2- Once I clarified on discord that I needed a test framework, I thought I should make use of vitest with the sample code (but that sample code doesn't actually work with vitest as you cannot use done with vitest).

Perhaps most of this would have been avoided if I'd had more experience with testing, but I'm not sure many of us do.
It was remarked on discord that this question (of how to run the sample code in the lesson) has come up before. I confirmed this.

An addition of a sentence to this lesson to mention the need for a test framework to use with Supertest and to instruct that Jest is required for the sample code would be helpful and appreciated.

thank you for your attention

Path

Node / JS

Lesson Url

https://www.theodinproject.com/lessons/nodejs-testing-routes-and-controllers

(Optional) Discord Name

hana-banana

(Optional) Additional Comments

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions