-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Only use setImmediate if it is defined #137
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the target is cloudflare workers, could you add some sort of test to verify it works correctly there?
Possibly, though it may involve a lot of extra setup/dependencies. I can look into it more soon, probably early next week |
@mcollina I've added a test that uses wrangler, which is the documented way to use the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
|
||
const sleep = promisify(setTimeout) | ||
|
||
describe('storage memory (cloudflare)', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please skip this in Node.js v18.6? it's failing on CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skipped in c774406
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it's still not skipping the suite in 18 - perhaps before
is still being run for the suite? I'm sorry, this is my first experience with node:test
, and I'm not entirely certain how to solve this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although it appears to be documented for v18, I couldn't get the option to work when running 18.19.0 locally. I just put the whole describe
in an if
block in d1a4ed7, and ran it locally against v18.19.0
await worker.stop() | ||
}) | ||
|
||
test('able to invalidate without error', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test doesn't assert that invalidation works, since the function in the helper returns always an empty object, doesn't it?
What should or should not happen? Throwing/not throwing an error, returning a different value, other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should get a response from the cloudflare worker without encountering an error. The delay is simply to trigger invalidation in the worker.mjs
code. I have changed the description of the test to clarify this intent in fb9dda1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, more clear now. Could you use assert.doesNotThrow
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used doesNotReject
(since it's async) in a3741e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
execute command
It's because |
This PR changes the strategy used to determine if
setImmediate
is available, which should allow the library to work correctly on other non-Node runtimes such as cloudflare workers.Fixes #136