Skip to content

Conversation

ToastedGMS
Copy link
Contributor

Because

This PR adds a short paragraph with information regarding Jest global imports when working with ESLint.

This PR

  • Adds a short paragraph pointing to the Jest docs, explaining Jest setup with ESLint.

Issue

Closes #29509

Additional Information

Link to issue discussion

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project curriculum contributing guide
  • The title of this PR follows the location of change: brief description of change format, e.g. Intro to HTML and CSS lesson: Fix link text
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • If this PR addresses an open issue, it is linked in the Issue section
  • If any lesson files are included in this PR, they have been previewed with the Markdown preview tool to ensure it is formatted correctly
  • If any lesson files are included in this PR, they follow the Layout Style Guide

@github-actions github-actions bot added the Content: JavaScript Involves the JavaScript course label Oct 9, 2025
1. Read about the [basic process and the benefits of TDD](https://web.archive.org/web/20211123190134/http://godswillokwara.com/index.php/2016/09/09/the-importance-of-test-driven-development/).
1. Watch at least the first 3 videos of [the Unit Testing in JavaScript video series](https://www.youtube.com/playlist?list=PL0zVEGEvSaeF_zoW9o66wa_UCNE3a7BEr).
1. Follow along to [Jest's Getting Started tutorial](https://jestjs.io/docs/getting-started). For the upcoming testing practice and project, you only need to follow the instructions for installing jest.
1. Follow along to Jests Getting Started tutorial. For the upcoming testing practice and project, you only need to follow the instructions for installing Jest. Note that while Jest includes global variables like `test` and `expect`, if you are using ESLint, you'll still want to [import the Jest globals your test file needs](https://jestjs.io/docs/getting-started#using-eslint) so ESLint doesn't complain about them.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - I know the below was my original suggestion but on another read, I think some people may wonder where the link to the Getting Started tutorial is, and I don't think we need to link the page twice. What do you think of the below instead?

Suggested change
1. Follow along to Jests Getting Started tutorial. For the upcoming testing practice and project, you only need to follow the instructions for installing Jest. Note that while Jest includes global variables like `test` and `expect`, if you are using ESLint, you'll still want to [import the Jest globals your test file needs](https://jestjs.io/docs/getting-started#using-eslint) so ESLint doesn't complain about them.
1. Follow along to [Jest's Getting Started tutorial](https://jestjs.io/docs/getting-started) until you reach the "Additional Configuration" section, then read the "Using ESLint" section regarding ESLint and Jest globals like `test` and `expect`.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it works to point the reader in the direction of the resource's info, but doesn't explicitly state the Jest globals information, which may leave the reader hanging regarding whether or not to import them, like the original issue was. In my opinion it boils down to how detailed we want to make this and linking to your original comment, having learners go out of scope on their own terms if they wish to do so. Maybe we could sum it up as

Follow along with Jest’s Getting Started tutorial up to the "Additional Configuration" section—only the installation steps are needed for the upcoming testing practice and project. Jest provides global variables like test and expect, but if you're using ESLint, you'll need to explicitly import these in your test files to prevent linting errors (see the "Using ESLint" section in the same tutorial).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the latter half of your wording. Just mixing in my former half because just saying "the installation steps" isn't actually quite clear enough which sections are included and excluded (e.g. the Babel stuff, which is linked in a later lesson when relevant).

Suggested change
1. Follow along to Jests Getting Started tutorial. For the upcoming testing practice and project, you only need to follow the instructions for installing Jest. Note that while Jest includes global variables like `test` and `expect`, if you are using ESLint, you'll still want to [import the Jest globals your test file needs](https://jestjs.io/docs/getting-started#using-eslint) so ESLint doesn't complain about them.
1. Follow along to [Jest's Getting Started tutorial](https://jestjs.io/docs/getting-started) until you reach the "Additional Configuration" section. Jest also provides global variables like `test` and `expect`, but if you're using ESLint, you'll need to explicitly import these in your test files to prevent linting errors (see the "Using ESLint" section in the same tutorial).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content: JavaScript Involves the JavaScript course

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Javascript Testing Basics: import not needed for test and expect not explained

2 participants