mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +00:00
19 lines
496 B
JavaScript
19 lines
496 B
JavaScript
process.exitCode = 1;
|
|
const { AsyncLocalStorage } = require("async_hooks");
|
|
|
|
const asyncLocalStorage = new AsyncLocalStorage();
|
|
|
|
asyncLocalStorage.run({ test: "timers.ref.unref" }, () => {
|
|
const timeout = setTimeout(() => {
|
|
if (asyncLocalStorage.getStore()?.test !== "timers.ref.unref") {
|
|
console.error("FAIL: setTimeout with ref/unref lost context");
|
|
process.exit(1);
|
|
}
|
|
process.exit(0);
|
|
}, 10);
|
|
|
|
// Test ref/unref operations
|
|
timeout.unref();
|
|
timeout.ref();
|
|
});
|