Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove timer faking from functionWatcher tests #5151

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lopert
Copy link
Contributor

@lopert lopert commented Jan 3, 2025

WHY are these changes introduced?

Part of https://github.com/Shopify/shopify-functions/issues/481

This test was reported as flakey, so this attempts to fix it by removing the unnecessary timer faking.

WHAT is this pull request doing?

Swaps out our timer faking with a more straightforward waitFor that just checks the last returned result from our hook function until it matches what we expect.

I used waitFor from cli-kit's testing/ui, and had to add it to the public export.
I figured this was fine, but if it's not I could also copy the code from it into our tests more directly.

I also looked at usePollAppLogsTest where we used a similar approach, but I chose to keep it as is over there since that test has a lot to do with timing, retries, and enqueued timers. It makes sense over there.

How to test your changes?

p vitest function/ui

Post-release steps

N/A

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor

github-actions bot commented Jan 3, 2025

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/testing/ui.d.ts
@@ -1 +1 @@
-export { getLastFrameAfterUnmount, render, Stdin, waitForInputsToBeReady, waitForContent, sendInputAndWait, sendInputAndWaitForChange, sendInputAndWaitForContent, } from '../../../private/node/testing/ui.js';
\ No newline at end of file
+export { getLastFrameAfterUnmount, render, Stdin, waitFor, waitForInputsToBeReady, waitForContent, sendInputAndWait, sendInputAndWaitForChange, sendInputAndWaitForContent, } from '../../../private/node/testing/ui.js';
\ No newline at end of file

@lopert lopert marked this pull request as ready for review January 3, 2025 16:35
@lopert lopert requested a review from a team as a code owner January 3, 2025 16:35
Copy link
Contributor

github-actions bot commented Jan 3, 2025

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.

@lopert lopert requested a review from shauns January 3, 2025 16:35
Copy link
Contributor

github-actions bot commented Jan 3, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
75.32% (+0% 🔼)
8841/11738
🟡 Branches
70.58% (+0.01% 🔼)
4290/6078
🟡 Functions
75.2% (-0.01% 🔻)
2314/3077
🟡 Lines
75.85% (-0% 🔻)
8357/11018
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / identifiers.ts
96.23% (-3.77% 🔻)
89.19% (-1.29% 🔻)
100% 100%
🟢
... / ConcurrentOutput.tsx
98.36% (-1.64% 🔻)
88% (-4% 🔻)
100%
98.33% (-1.67% 🔻)

Test suite run success

1994 tests passing in 900 suites.

Report generated by 🧪jest coverage report action from fd3bf4a

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.

1 participant