Summary
Add microtask-boundary ordering assertions to the await using null and await using undefined test cases in tests/language/explicit-resource-management/await-using.js to verify that the runtime still introduces an async yield point at block exit even when the disposable resource is skipped.
Why
The current tests only verify that skipped null/undefined values do not throw and that surrounding code continues to run. They do not catch a regression where the compiler/evaluator drops the block-exit await point for skipped disposables, since no ordering assertion against the microtask queue is made.
Current behavior
test("await using null is silently skipped", async () => {
let reached = false;
{
await using resource = null;
reached = true;
}
expect(reached).toBe(true);
});
The test passes but does not verify the presence of the async boundary.
Expected behavior
The tests should use a microtask-ordering pattern to assert the block-exit await point is present even for skipped (null/undefined) resources:
test("await using null is silently skipped", async () => {
const order = [];
const task = (async () => {
{
await using resource = null;
}
order.push("after");
})();
expect(order).toEqual([]);
await Promise.resolve();
await task;
expect(order).toEqual(["after"]);
});
Mirror the same pattern for the undefined case.
Scope notes
Summary
Add microtask-boundary ordering assertions to the
await using nullandawait using undefinedtest cases intests/language/explicit-resource-management/await-using.jsto verify that the runtime still introduces an async yield point at block exit even when the disposable resource is skipped.Why
The current tests only verify that skipped null/undefined values do not throw and that surrounding code continues to run. They do not catch a regression where the compiler/evaluator drops the block-exit await point for skipped disposables, since no ordering assertion against the microtask queue is made.
Current behavior
The test passes but does not verify the presence of the async boundary.
Expected behavior
The tests should use a microtask-ordering pattern to assert the block-exit await point is present even for skipped (null/undefined) resources:
Mirror the same pattern for the
undefinedcase.Scope notes
tests/language/explicit-resource-management/await-using.jsDisposeTrackedResourcesAsynccallingAwaitValuefordhAsyncDisposeentries even when the method is nil) is already correct per PR Add explicit resource management support #290.