Conversation
ChALkeR
left a comment
There was a problem hiding this comment.
Check that failing tests throw (by generating a temporary testcase failing on a purpose, but not commiting it)
It looks like no tests are actually executed
You're absolutely correct - tests are not actually executing in workerd. I created a failing test and confirmed it incorrectly passes. The root cause is that the test runner schedules tests with Workerd expects synchronous execution within its test function, while the test runner uses asynchronous scheduling. This is a fundamental incompatibility that would require restructuring the test runner's execution model to support. The workerd:bundle implementation should be removed or marked as not working until we can address the async scheduling issue. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot fix it with an implementation that works asynchronously |
Fixed! Implemented working async execution for workerd. Root cause: Workerd doesn't process setTimeout callbacks during test execution, so the test runner's Solution:
Testing: Changes in commits e18a250, 9d0524c, and 0f02e75. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
231119f to
b2ca7b4
Compare
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
Co-authored-by: ChALkeR <291301+ChALkeR@users.noreply.github.com>
ac81707 to
60b4f62
Compare
ChALkeR
left a comment
There was a problem hiding this comment.
let's merge and then improve
9ba9095 to
c08128c
Compare
c08128c to
1af5d11
Compare
This PR implements working workerd:bundle support by solving the async scheduling incompatibility.
Problem Identified
The initial implementation appeared to work but had a critical flaw: tests were scheduled but never ran. Investigation revealed:
setTimeout(run, 0)insrc/engine.pure.cjsRoot Cause
Workerd expects synchronous execution within its test function, while the test runner uses asynchronous scheduling:
describe()andtest()callssetTimeout(run, 0)schedules the actual test executionSolution Implemented
Manual Test Execution: Instead of relying on setTimeout, explicitly trigger test execution from the workerd wrapper.
Key Changes
1. Test Execution Model (src/engine.pure.cjs)
run()function globally asEXODUS_TEST_RUNfor workerd_maybeProcessExitCode()synchronously after tests complete (not via setTimeout)2. Module Exports (src/engine.js, src/node.js)
runfunction (available for workerd platform)3. Engine Configuration (bin/index.js)
workerd:bundleengine definitionglobalThis.EXODUS_TEST_RUN()to execute tests4. Documentation
workerd:bundleto README.md engines listtest:workerdnpm script to package.jsonHow It Works
describe()andtest()callsEXODUS_TEST_RUN()within the test handlerTesting
✅ Passing tests correctly pass (tests/simple.test.js)
✅ Failing tests correctly fail with proper error messages
✅ Multiple test files work correctly
✅ Test output is properly displayed
✅ Linting passes
The implementation successfully works around workerd's setTimeout limitation by providing a manual execution path that integrates with workerd's test framework.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.