2021-03-18 14:10:27 +01:00
|
|
|
import {
|
|
|
|
assert,
|
|
|
|
assertEquals,
|
|
|
|
assertMatch,
|
|
|
|
unitTest,
|
|
|
|
unreachable,
|
|
|
|
} from "./test_util.ts";
|
|
|
|
|
|
|
|
const readErrorStackPattern = new RegExp(
|
|
|
|
`^.*
|
2021-03-31 16:37:38 +02:00
|
|
|
at processErr \\(.*core\\.js:.*\\)
|
|
|
|
at opAsyncHandler \\(.*core\\.js:.*\\)
|
|
|
|
at handleAsyncMsgFromRust \\(.*core\\.js:.*\\).*$`,
|
2021-03-18 14:10:27 +01:00
|
|
|
"ms",
|
|
|
|
);
|
|
|
|
|
|
|
|
unitTest(async function sendAsyncStackTrace(): Promise<void> {
|
|
|
|
const buf = new Uint8Array(10);
|
|
|
|
const rid = 10;
|
|
|
|
try {
|
|
|
|
await Deno.read(rid, buf);
|
|
|
|
unreachable();
|
|
|
|
} catch (error) {
|
|
|
|
assertMatch(error.stack, readErrorStackPattern);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
declare global {
|
|
|
|
// deno-lint-ignore no-namespace
|
|
|
|
namespace Deno {
|
|
|
|
// deno-lint-ignore no-explicit-any
|
|
|
|
var core: any; // eslint-disable-line no-var
|
|
|
|
}
|
|
|
|
}
|