mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
* fix valid status code range * update path * highwatermark option * throw DOMException * remove extra transpiler output * more transpiler tests * comment * get index not quickly * replace with `getDirectIndex` * update abort test * throw out of range status code * promisify test fix * move stdio test instance files * working crypto tests * allow duplicate set-cookie headers * different formatting * revert, fix will be in different pr * it is called * use min buffer size * fix url tests * null origin for other protocols * remove overload * add very large file test * await * coerce to int64 * 64 * no cast * add todo blob url tests * use `tryConvertToInt52`
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
import { expect, test } from "bun:test";
|
|
|
|
test("not implemented yet module masquerades as undefined and throws an error", () => {
|
|
const worker_threads = import.meta.require("worker_threads");
|
|
|
|
expect(typeof worker_threads).toBe("undefined");
|
|
expect(typeof worker_threads.getEnvironmentData).toBe("undefined");
|
|
});
|
|
|
|
test("AsyncLocalStorage polyfill", () => {
|
|
const { AsyncLocalStorage } = import.meta.require("async_hooks");
|
|
|
|
const store = new AsyncLocalStorage();
|
|
var called = false;
|
|
expect(store.getStore()).toBe(null);
|
|
store.run({ foo: "bar" }, () => {
|
|
expect(store.getStore()).toEqual({ foo: "bar" });
|
|
called = true;
|
|
});
|
|
expect(store.getStore()).toBe(null);
|
|
expect(called).toBe(true);
|
|
});
|
|
|
|
test("AsyncResource polyfill", () => {
|
|
const { AsyncResource } = import.meta.require("async_hooks");
|
|
|
|
const resource = new AsyncResource("prisma-client-request");
|
|
var called = false;
|
|
resource.runInAsyncScope(
|
|
() => {
|
|
called = true;
|
|
},
|
|
null,
|
|
"foo",
|
|
"bar",
|
|
);
|
|
expect(called).toBe(true);
|
|
});
|