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

refactor: Type check and restructure tests #119

Merged
merged 10 commits into from
Oct 21, 2024
Merged

refactor: Type check and restructure tests #119

merged 10 commits into from
Oct 21, 2024

Conversation

Peeja
Copy link
Member

@Peeja Peeja commented Oct 8, 2024

This is more what I was getting at with https://github.com/storacha/freeway/pull/116/files#r1787752932. This avoids some of the stashing and mutation by putting more inside the new Promise() construction itself.

I've also pulled wranglerEnv out into its own const, because it's actually an input, not an output. Then I've made workerInfo a let which is assigned when Wrangler boots, and is undefined before that, signaling that Wrangler is not yet available. The previous code was failing because there were undefined fields that aren't typed to allow undefined. Which wasn't an issue until…

I also turned type checking on in test/, because apparently it wasn't already. 😛 And lastly, I've ignored .wrangler, because Wrangler writes to that when it runs.

@Peeja Peeja requested a review from fforbeck October 8, 2024 20:27
Copy link
Member

@fforbeck fforbeck left a comment

Choose a reason for hiding this comment

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

That's awesome! Thanks for updating that @Peeja.
I guess you just need to sort out those linter/type issues flagged by the test workflow, and it is good to go. I also tested this locally and worked well.

Dang lack of Prettier...
@fforbeck
Copy link
Member

fforbeck commented Oct 9, 2024

@Peeja For some reason after the changes the workerd (wrangler) process is not terminated when the integration tests are completed. I can see it running in the background after the test suite is completed.

* Make types work
* Test through with stubs more and less with mocks
* Use `@import` a bunch for readability
* Avoid `let`s in favor of `const`s
* Separate the rate-limiter middleware's expected environment interface
  from the general environment, and don't combine them until we actually
  combine the middlewares into the stack.
Copy link
Member

@fforbeck fforbeck left a comment

Choose a reason for hiding this comment

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

This looks great to me! However, since the changes affect more than just the Wrangler setup, we should consider renaming the PR to reflect its broader scope.

I also added a minor suggestion about the treeKill usage to kill the wrangler process.

test/helpers/run-wrangler.js Outdated Show resolved Hide resolved
It's the only way to be sure.

Co-authored-by: Felipe Forbeck <[email protected]>
@Peeja Peeja changed the title refactor: Cleaner promises in Wrangler harness refactor: Type check and restructure tests Oct 18, 2024
@Peeja Peeja merged commit d097a91 into main Oct 21, 2024
1 check passed
@Peeja Peeja deleted the cleaner-promise branch October 21, 2024 14:11
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