{"id":13474426,"url":"https://github.com/kentcdodds/testing-workshop","last_synced_at":"2025-09-28T21:31:29.845Z","repository":{"id":66053030,"uuid":"77655018","full_name":"kentcdodds/testing-workshop","owner":"kentcdodds","description":"A workshop for learning how to test JavaScript applications","archived":true,"fork":false,"pushed_at":"2020-09-16T22:02:58.000Z","size":3952,"stargazers_count":1356,"open_issues_count":5,"forks_count":707,"subscribers_count":43,"default_branch":"master","last_synced_at":"2024-09-27T03:24:45.813Z","etag":null,"topics":["e2e-tests","end-to-end-testing","integration-testing","javascript","kcd-edu","testing","unit-testing","workshop"],"latest_commit_sha":null,"homepage":"http://git.io/testing-workshop","language":"JavaScript","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/kentcdodds.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-12-30T02:46:53.000Z","updated_at":"2024-08-28T16:05:23.000Z","dependencies_parsed_at":"2023-04-16T21:15:52.621Z","dependency_job_id":null,"html_url":"https://github.com/kentcdodds/testing-workshop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentcdodds%2Ftesting-workshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentcdodds%2Ftesting-workshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentcdodds%2Ftesting-workshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentcdodds%2Ftesting-workshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kentcdodds","download_url":"https://codeload.github.com/kentcdodds/testing-workshop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234563155,"owners_count":18853062,"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":["e2e-tests","end-to-end-testing","integration-testing","javascript","kcd-edu","testing","unit-testing","workshop"],"created_at":"2024-07-31T16:01:12.258Z","updated_at":"2025-09-28T21:31:24.512Z","avatar_url":"https://github.com/kentcdodds.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Testing Workshop\n\n👋 hi there! My name is [Kent C. Dodds](https://kentcdodds.com)! This is a\nworkshop repo to teach you about testing JavaScript applications.\n\n\u003e **NOTICE**: If you're coming here from\n\u003e [my Frontend Masters 2017 workshop](https://frontendmasters.com/courses/testing-javascript/),\n\u003e I recommend you watch [the updated 2018 workshop instead](https://frontendmasters.com/courses/testing-react/).\n\u003e If you'd rather follow the 2017 workshop, then please\n\u003e [go to the `fem` branch](https://github.com/kentcdodds/testing-workshop/tree/fem)\n\u003e to make sure you're looking at the accurate information for your workshop.\n\n[![chat-badge][chat-badge]][chat]\n[![Build Status][build-badge]][build]\n[![AppVeyor Build Status][win-build-badge]][win-build]\n[![Code Coverage][coverage-badge]][coverage]\n[![License][license-badge]](#license)\n[![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors)\n\n[![PRs Welcome][prs-badge]][prs]\n[![Code of Conduct][coc-badge]][coc]\n[![Watch on GitHub][github-watch-badge]][github-watch]\n[![Star on GitHub][github-star-badge]][github-star]\n[![Tweet][twitter-badge]][twitter]\n\n## Table of Contents\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n- [Topics covered](#topics-covered)\n- [Branches](#branches)\n- [System Requirements](#system-requirements)\n- [Setup](#setup)\n- [Running the app](#running-the-app)\n- [About the app](#about-the-app)\n  - [Continuous Integration](#continuous-integration)\n  - [Hosting](#hosting)\n  - [Register and Login](#register-and-login)\n- [Troubleshooting](#troubleshooting)\n- [Structure](#structure)\n- [Contributors](#contributors)\n- [LICENSE](#license)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Topics covered\n\n1.  Unit Testing with [Jest](http://facebook.github.io/jest)\n2.  Integration Testing with [Jest](http://facebook.github.io/jest)\n3.  End to End (E2E) Testing with [Cypress](https://www.cypress.io/)\n\nWe'll mention other forms of testing, but these are the types we'll focus on and\nlearn in this workshop. Learn more about the course goals and specific topics\ncovered in the [`INSTRUCTIONS.md`](./INSTRUCTIONS.md) file.\n\n**NOTE: This repository is meant for instructional purposes. While you'll\nprobably learn a great deal looking through this project, remember that it's\nnot necessarily a recommendation to test your apps this way. Some code is\n\"over covered\" by unit, integration, and end-to-end tests simply to demonstrate\nthe differences. In a real application it would be unnecessary to be this\nextensive in coverage.**\n\n## Branches\n\nThis project has been used to teach about testing in various settings. You may\nwant to switch to the appropriate branch for this workshop. Otherwise the code\nyou're looking at may not be exactly the same as the code used in the setting\nyou're working with.\n\n- Frontend Masters 2017 [`fem`](https://github.com/kentcdodds/testing-workshop/tree/fem)\n\n## System Requirements\n\n- [git][git] v2.14.1 or greater\n- [NodeJS][node] v8.9.4 or greater\n- [npm][npm] v5.6.0 or greater\n\nAll of these must be available in your `PATH`. To verify things are set up\nproperly, you can run this:\n\n```\ngit --version\nnode --version\nnpm --version\n```\n\nIf you have trouble with any of these, learn more about the PATH environment\nvariable and how to fix it here for [windows][win-path] or\n[mac/linux][mac-path].\n\n## Setup\n\nAfter you've made sure to have the correct things (and versions) installed, you\nshould be able to just run a few commands to get set up:\n\n```\ngit clone https://github.com/kentcdodds/testing-workshop.git\ncd testing-workshop\nnpm run setup --silent\n```\n\nThis may take a few minutes. **It will ask you for your email.** This is\noptional and just automatically adds your email to the links in the project to\nmake filling out some forms easier If you get any errors, please read through\nthem and see if you can find out what the problem is. You may also want to look\nat [Troubleshooting](#troubleshooting). If you can't work it out on your own\nthen please [file an issue][issue] and provide _all_ the output from the\ncommands you ran (even if it's a lot).\n\n## Running the app\n\nTo get the app up and running (and really see if it worked), run:\n\n```shell\nnpm run dev\n```\n\nThis will start the api server, and the client server in development mode at\nthe same time. Your browser should open up automatically to\n`http://localhost:3000` (if it doesn't, just open that yourself) and you should\nbe able to start messing around with the app.\n\nHere's what you should be looking at:\n\n\u003cimg src=\"other/screenshot.png\" alt=\"App Screenshot\" title=\"App Screenshot\" width=\"700\" /\u003e\n\nIf this fails at any point for you, please take a minute to read through any\nerror messages you see and [try to troubleshoot the issue](#troubleshooting).\nIf you can't work it out, feel free to [open an issue][issue].\n\n## About the app\n\nThis app is based on the [Hashrocket](https://hashrocket.com/) project called\n[Today I Learned](https://til.hashrocket.com/). It's a real working application\nbut has been simplified to help us focus on learning testing rather than\nworrying about distracting ourselves with setting up the project. For example\nthe database is actually just a simple JavaScript file. Every time you start\nthe app, all the data is reset (and in development mode, data is randomly\ngenerated).\n\n### Continuous Integration\n\nWe're using two CI services:\n\n- [Travis][build] (Linux): find config in `.travis.yml`\n- [AppVeyor][win-build] (Windows): find config in `appveyor.yml`\n\n### Hosting\n\nThe backend code is deployed to [now.sh](https://now.sh):\n[til.now.sh](https://til.now.sh). Try hitting one of the unauthenticated\nendpoints like [`/api/posts`](https://til.now.sh/api/posts) (note: it's using\nthe open source free tier, so it may take a while to respond as it warms up).\nThe Travis build is responsible for deploying the backend to `now.sh`.\n\nThe frontend code is deployed using [netlify](https://netlify.com):\n[til.netlify.com](https://til.netlify.com). We could host the frontend code\non `now` as well, except Netlify has some pretty awesome features with GitHub\nintegration, and I want to show those off (and benefit from them as well).\nThe frontend code is deployed to netlify using Netlify's integration with\nGitHub.\n\n### Register and Login\n\nIf you want to login, go ahead and register a new account and login with that\none.\n\n**To stop all the servers**, hit \u003ckbd\u003eCtrl\u003c/kbd\u003e + \u003ckbd\u003eC\u003c/kbd\u003e.\n\n## Troubleshooting\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\"npm run setup\" command not working\u003c/summary\u003e\n\nHere's what the setup script does. If it fails, try doing each of these things\nindividually yourself:\n\n```\n# verify your environment will work with the project\nnode ./scripts/verify\n\n# install dependencies in the root of the repo\nnpm install\n\n# install dependencies in the shared directory\nnpm install --prefix shared\n\n# install dependencies in the server directory\nnpm install --prefix server\n\n# install dependencies in the client directory\nnpm install --prefix client\n\n# verify the project is ready to run\nnpm run lint\nnpm run test:coverage\nnpm run test:e2e:run\n```\n\nIf any of those scripts fail, please try to work out what went wrong by the\nerror message you get. If you still can't work it out, feel free to\n[open an issue][issue] with _all_ the output from that script. I will try to\nhelp if I can.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\"npm run dev\" command not working\u003c/summary\u003e\n\nIf it doesn't work for you, you can start each of these individually yourself\n(in separate terminals):\n\n```\ncd server\nnpm run dev\n```\n\n```\ncd client\nnpm run dev\n```\n\nIf any of those scripts fail, please try to work out what went wrong by the\nerror message you get. If you still can't work it out, feel free to\n[open an issue][issue] with _all_ the output from that script. I will try to\nhelp if I can.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\"npm test\" command not working; \"./jest\" command not working\u003c/summary\u003e\n\nWhen attempting to run Jest in watch mode, you may encounter an error that says\nsomething like:\n\n```\n`fsevents` unavailable (this watcher can only be used on Darwin)'\n```\n\nJest watch mode has a dependency on a tool called `watchman`, which needs to be\ninstalled globally on your machine.\n\nTo fix this error, please make sure you have [watchman][watchman] installed for\nyour preferred operating system.\n\nNOTE: installing `watchman` via `npm` installs an outdated version of the package.\nTo get the latest version of `watchman`, it is preferred that you install through\nyour operating system's package manager instead.\n\n\u003c/details\u003e\n\n## Structure\n\nThis project has a bit of a unique setup. Normally you'll have just a single\n`package.json` at the root of your repository, but to simplify setup I've\nincluded both the `server` and `client` projects in a single repository. The\nroot of the project has a `package.json` as does `server`, and `client`. While\nyou'll be working in the source code and tests in these folders, you should be\nable to leave you command line in the root directory for the whole workshop.\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://kentcdodds.com\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/1500684?v=3\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eKent C. Dodds\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/kentcdodds/testing-workshop/commits?author=kentcdodds\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/kentcdodds/testing-workshop/commits?author=kentcdodds\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#infra-kentcdodds\" title=\"Infrastructure (Hosting, Build-Tools, etc)\"\u003e🚇\u003c/a\u003e \u003ca href=\"https://github.com/kentcdodds/testing-workshop/commits?author=kentcdodds\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/osamajandali\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/13832392?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eOsama Jandali\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/kentcdodds/testing-workshop/commits?author=osamajandali\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#design-osamajandali\" title=\"Design\"\u003e🎨\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://stefanivic.me/\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/3818515?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eStefan Ivic\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/kentcdodds/testing-workshop/issues?q=author%3Astefanivic\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/bodiddlie\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/2413413?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eNick Klepinger\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/kentcdodds/testing-workshop/issues?q=author%3Abodiddlie\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://abinavseelan.com\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/6417910?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAbinav Seelan\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/kentcdodds/testing-workshop/issues?q=author%3Aabinavseelan\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://philipsotirov.com\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/2751691?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePhilip Sotirov\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/kentcdodds/testing-workshop/issues?q=author%3Afipo\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/indiesquidge\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/3409645?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAustin Wood\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/kentcdodds/testing-workshop/commits?author=indiesquidge\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/wk32\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/7888225?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eWK\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/kentcdodds/testing-workshop/issues?q=author%3Awk32\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/rjperkins\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/57779301?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eRichard Perkins\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/kentcdodds/testing-workshop/commits?author=rjperkins\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-enable --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!\n\n## LICENSE\n\nThis material is available for private, non-commercial use under the\n[GPL version 3](http://www.gnu.org/licenses/gpl-3.0-standalone.html). If you\nwould like to use this material to conduct your own workshop, please contact me\nat kent@doddsfamily.us\n\n[npm]: https://www.npmjs.com/\n[node]: https://nodejs.org\n[git]: https://git-scm.com/\n[chat]: https://gitter.im/kentcdodds/testing-workshop\n[chat-badge]: https://img.shields.io/gitter/room/kentcdodds/testing-workshop.js.svg?style=flat-square\u0026logo=gitter-white\n[build-badge]: https://img.shields.io/travis/kentcdodds/testing-workshop.svg?style=flat-square\u0026logo=travis\n[build]: https://travis-ci.org/kentcdodds/testing-workshop\n[license-badge]: https://img.shields.io/badge/license-GPL%203.0%20License-blue.svg?style=flat-square\n[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square\n[prs]: http://makeapullrequest.com\n[donate-badge]: https://img.shields.io/badge/$-support-green.svg?style=flat-square\n[donate]: http://kcd.im/donate\n[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square\n[coc]: https://github.com/kentcdodds/testing-workshop/blob/master/other/CODE_OF_CONDUCT.md\n[github-watch-badge]: https://img.shields.io/github/watchers/kentcdodds/testing-workshop.svg?style=social\n[github-watch]: https://github.com/kentcdodds/testing-workshop/watchers\n[github-star-badge]: https://img.shields.io/github/stars/kentcdodds/testing-workshop.svg?style=social\n[github-star]: https://github.com/kentcdodds/testing-workshop/stargazers\n[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20testing-workshop%20by%20@kentcdodds%20https://github.com/kentcdodds/testing-workshop%20%F0%9F%91%8D\n[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/kentcdodds/testing-workshop.svg?style=social\n[emojis]: https://github.com/kentcdodds/all-contributors#emoji-key\n[all-contributors]: https://github.com/kentcdodds/all-contributors\n[win-path]: https://www.howtogeek.com/118594/how-to-edit-your-system-path-for-easy-command-line-access/\n[mac-path]: http://stackoverflow.com/a/24322978/971592\n[issue]: https://github.com/kentcdodds/testing-workshop/issues/new\n[win-build-badge]: https://img.shields.io/appveyor/ci/kentcdodds/testing-workshop.svg?style=flat-square\u0026logo=appveyor\n[win-build]: https://ci.appveyor.com/project/kentcdodds/testing-workshop\n[coverage-badge]: https://img.shields.io/codecov/c/github/kentcdodds/testing-workshop.svg?style=flat-square\n[coverage]: https://codecov.io/github/kentcdodds/testing-workshop\n[watchman]: https://facebook.github.io/watchman/docs/install.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkentcdodds%2Ftesting-workshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkentcdodds%2Ftesting-workshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkentcdodds%2Ftesting-workshop/lists"}