Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Document better the details of aync methods

オープン
#1,012 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
45/100
issue の種類
ドキュメント
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript, typescript

調査の方向性

src/wait-for.js とリンク先の dom-testing-library/api-async ページから始め、既存の waitFor ドキュメントを issue の interval と timeout に関する質問と比較します。ページで両方のオプションの動作が、flaky な例に対処し、読者がタイミングを理解できる程度に明確に説明されていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Is your feature request related to a problem? Please describe.

In the example seen at the bottom of this issue, I get flaky results. The assertion passes sometimes and fails sometimes. This comes from a lack of understanding by me of how async methods work. I've Googled the heck out of it and read the docs linked below a bunch of times. I also looked through the source code, but I found it to be difficult to understand from someone who hasn't worked in this project.

Describe the solution you'd like

Ultimately, I think there are a couple of waitFor options that should be documented in more detail. I'd like the below questions to be answered.

  • What is the behavior of interval option?
  • What is the behavior of the timeout option?

I think this should be covered in detail here: https://testing-library.com/docs/dom-testing-library/api-async/

Describe alternatives you've considered A clear and concise description of
any alternative solutions or features you've considered.

NA

Additional context Add any other context or screenshots about the feature
request here.

Example code that has flaky results. I don't think the details of useDataFetch is important here, but let me know if I can answer any questions about it.

it('displays fetched data', async () => {
  const increment = createIncrement();
  const MyComponent = () => {
    const { data } = useDataFetch(async () => {
      await sleep(1);
      return increment();
    });
    return <div>times fetch called: {data}</div>;
  };
  
  render(<MyComponent />);
  const element = await screen.findByText('times fetch called: 2');
  expect(element).toBeInTheDocument();
});
主要言語
JavaScript
スター
479
フォーク
738
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

testing-library/testing-library-docs のほかの issue

testing-library/testing-library-docs の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。