Skip to content

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented Oct 17, 2023

@vercel
Copy link

vercel bot commented Oct 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
field-form ✅ Ready (Inspect) Visit Preview Oct 17, 2023 9:19am

export async function waitFakeTime(timeout: number = 10) {
await act(async () => {
await Promise.resolve();
jest.advanceTimersByTime(timeout);
Copy link
Contributor

Choose a reason for hiding this comment

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

await 加到这里也可以吧?不需要 Promise.resolve

Copy link
Member Author

Choose a reason for hiding this comment

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

jest.advanceTimersByTime 不是 async 函数,加了 await 会报错。

Copy link
Contributor

Choose a reason for hiding this comment

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

明白,但是可以加。加了反而还有作用,不加反倒 test 会挂

@codecov
Copy link

codecov bot commented Oct 17, 2023

Codecov Report

Merging #625 (95e6442) into master (45b959f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 95e6442 differs from pull request most recent head 9ee94c4. Consider uploading reports for the commit 9ee94c4 to get more accurate results

@@           Coverage Diff           @@
##           master     #625   +/-   ##
=======================================
  Coverage   99.43%   99.43%           
=======================================
  Files          18       18           
  Lines        1229     1236    +7     
  Branches      282      283    +1     
=======================================
+ Hits         1222     1229    +7     
  Misses          7        7           
Files Coverage Δ
src/useForm.ts 99.34% <100.00%> (+<0.01%) ⬆️
tests/common/timeout.ts 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

<InfoField name="validate" rules={[{ required: true, message: validateMessage }]}>
<Input />
</InfoField>
<InfoField name="noop" rules={[{ required: true, message: 'noop' }]}>
Copy link
Contributor

Choose a reason for hiding this comment

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

noop 这个用了吗

Copy link
Member Author

Choose a reason for hiding this comment

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

不用,为了检测 dirty 不会校验 noop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants