JoshuaKGoldberg / create-typescript-app

Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 💝
MIT License
1.18k stars 75 forks source link

🧪 Testing: Fill in test coverage for augmentOptionsWithExcludes #699

Closed JoshuaKGoldberg closed 2 months ago

JoshuaKGoldberg commented 1 year ago

Bug Report Checklist

Overview

695 added a bunch of code changes. I didn't fully unit test them - not because I was too impatient to write tests (me?! never!!), but because I wanted to leave some good first issues as followups. Definitely that.

augmentOptionsWithExcludes is missing unit test coverage for ~several dozen lines~ one or two lines. augmentOptionsWithExcludes.test.ts only tests the case of fully automated usage. It doesn't test what happens when the user is prompted for anything. Let's add tests to augmentOptionsWithExcludes.test.ts that exercise the calls to prompt!

Additional Info

You'll likely need to use Vitest mocking - specifically, vi.mock. Search for vi.mock("@clack/prompts" in code to see how other unit tests accomplish this.

We don't need complete 100% unit test coverage of the file. If the tests are giving you grief, feel free to send an incomplete Draft PR with comments asking for help. ❤️


Note that the code might have been refactored since this issue was filed. Names might be slightly off. The general spirit of this issue should still be valid though.

shobhit9957 commented 1 year ago

hey, I would love to contribute, can you please help me. I"m a beginner here...Thanks

JoshuaKGoldberg commented 1 year ago

👋 hey @shobhit9957, great! My advice would be to:

  1. Read through all the docs in this repo -they're linked to in its README.md-
  2. Read through the 'getting started' guide of the tools needed to contribute: TypeScript, pnpm, Vitest
  3. See how other tests are written in this repo
  4. Try adding a test yourself
  5. Send a draft PR once you've made some progress - and ask any questions you need in that draft PR

Cheers!

I'm planning on writing a more helpful blog post soon. Hopefully that list is useful until then.

shobhit9957 commented 1 year ago

hey 😊thanks @JoshuaKGoldberg will follow the steps you've provided and update you with the feedbacks!,

JoshuaKGoldberg commented 2 months ago

Ah, this was previously done. Nice.