mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Co-authored-by: Georgijs Vilums <=> Co-authored-by: gvilums <gvilums@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
25 lines
456 B
JavaScript
25 lines
456 B
JavaScript
let unhandledRejectionCalled = false;
|
|
|
|
setTimeout(() => {
|
|
if (!unhandledRejectionCalled) {
|
|
process.exit(1);
|
|
}
|
|
// timeouts should be processed
|
|
process.exit(42);
|
|
}, 1);
|
|
|
|
let promise;
|
|
|
|
process.on("unhandledRejection", (err, promise) => {
|
|
unhandledRejectionCalled = true;
|
|
// there should be an error
|
|
if (!err) {
|
|
process.exit(1);
|
|
}
|
|
if (promise !== promise) {
|
|
process.exit(1);
|
|
}
|
|
});
|
|
|
|
promise = Promise.reject(new Error("error"));
|