{"id":18011181,"url":"https://github.com/marcelo-earth/jest-notes","last_synced_at":"2025-04-04T13:28:45.426Z","repository":{"id":128791505,"uuid":"441758292","full_name":"marcelo-earth/jest-notes","owner":"marcelo-earth","description":"🧪📄 Unit Testing with React course notes","archived":false,"fork":false,"pushed_at":"2022-08-20T14:27:59.000Z","size":109,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T15:50:35.249Z","etag":null,"topics":["jest","note-taking","notes","unit-testing"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcelo-earth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-25T21:04:31.000Z","updated_at":"2021-12-25T23:45:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"5d611b1b-6227-43d3-9025-6c13b8564632","html_url":"https://github.com/marcelo-earth/jest-notes","commit_stats":null,"previous_names":["marcelo-earth/jest-notes"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelo-earth%2Fjest-notes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelo-earth%2Fjest-notes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelo-earth%2Fjest-notes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelo-earth%2Fjest-notes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcelo-earth","download_url":"https://codeload.github.com/marcelo-earth/jest-notes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247184400,"owners_count":20897765,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jest","note-taking","notes","unit-testing"],"created_at":"2024-10-30T03:06:12.022Z","updated_at":"2025-04-04T13:28:45.401Z","avatar_url":"https://github.com/marcelo-earth.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧪 Testing Notes\n\n## 📚 Libraries studied\n- Jest\n- React Testing Library\n- Enzyme\n\n\n## ✍ About this repository\n\n### 🌌 Purpose of this repository\nI consider Unit Testing an important tool to ensure the quality of software functionalities. As a FrontEnd engineer I learned to write tests to check functions, or files. At this moment, all the projects, applications or software products that I have developed are about to incorporate, (or already incorporate) a space dedicated to unit testing with Jest within the file structure.\n\n### 📎 About this notes\nThis repository is part of the notes that I have written when studying a topic.\n\nIf you want more of this content, please follow me on [GitHub](https://github.com/360macky) or [Twitter](https://twitter.com/360macky).\n\nThe text is licensed by MIT, the images may be subject to copyright.\n\n## 👀 How to configure the testings?\nUsing setupFilesAfterEnv settings in package.json.\n### How to use setupFilesAfterEnv?\n\nAdding this property to the jest property in package.json, you can specify the path of the file that must be executed to set up the testing framework.\n\n```javascript\n    \"setupFilesAfterEnv\": [\n      \"\u003crootDir\u003e/src/__test__/setupTest.js\"\n    ],\n```\n\n## 💥 How to set up Jest for Web?\nModify package.json with:\n```javascript\n    \"testEnvironment\": \"jsdom\"\n```\nI found this good explaination:\n\u003e By default, jest uses the node testEnvironment. This essentially makes any tests meant for a browser environment invalid.. jsdom is an implementation of a browser environment, which supports these types of UI tests.\n\n\n## 🦾 What are Mocks?\nMocks are simulating functions that our app makes.\n\n## 👨‍🚀 About Enzyme/React\n### Where use `mount`, `shallow` or `render`?\n- `mount()`: When you need the DOM.\n- `shallow()`: When you need something in particular of the component (without the DOM).\n- `render()`: When you need to analyze the resulting HTML structure.\n\n## ✨ Jest Options\n### How can I watch every test suite in the terminal?\nSet verbose property to `true` inside `jest` property inside `package.json` file.\n```javascript\n\"verbose\": true,\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelo-earth%2Fjest-notes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcelo-earth%2Fjest-notes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelo-earth%2Fjest-notes/lists"}