Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion test/bundler/esbuild/dce.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,6 @@ describe("bundler", () => {
},
});
itBundled("dce/PackageJsonSideEffectsArrayKeepModuleImplicitMain", {
todo: true,
files: {
"/Users/user/project/src/entry.js": /* js */ `
import {foo} from "demo-pkg"
Expand Down
2 changes: 0 additions & 2 deletions test/bundler/esbuild/default.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4752,7 +4752,6 @@ describe.concurrent("bundler", () => {
},
});
itBundled("default/CharFreqIgnoreComments", {
todo: true,
files: {
"/a.js": /* js */ `
export default function(one, two, three, four) {
Expand Down Expand Up @@ -5477,7 +5476,6 @@ describe.concurrent("bundler", () => {
minifySyntax: true,
});
itBundled("default/BuiltInNodeModulePrecedence", {
todo: true,
files: {
"/entry.js": /* js */ `
console.log([
Expand Down
1 change: 0 additions & 1 deletion test/bundler/esbuild/packagejson.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,6 @@ describe("bundler", () => {
},
});
itBundled("packagejson/DualPackageHazardImportAndRequireBrowser", {
todo: true,
files: {
"/Users/user/project/src/entry.js": /* js */ `
import './test-main'
Expand Down
1 change: 0 additions & 1 deletion test/bundler/esbuild/splitting.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ describe("bundler", () => {
],
});
itBundled("splitting/CircularReferenceESBuildIssue251", {
todo: true,
files: {
"/a.js": /* js */ `
export * from './b.js';
Expand Down
3 changes: 0 additions & 3 deletions test/bundler/esbuild/ts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2025,9 +2025,6 @@ describe("bundler", () => {
minifySyntax: false, // intentionally disabled. enum inlining always happens
});
itBundled("ts/EnumJSX", {
// Blocking:
// - jsx bugs (configuration does not seem to be respected)
todo: true,
files: {
"/element.tsx": /* tsx */ `
import { create } from 'not-react'
Expand Down
2 changes: 1 addition & 1 deletion test/bundler/transpiler/transpiler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2898,7 +2898,7 @@ console.log(a)
`);
});

it.todo("macros can return a promise", () => {
it("macros can return a promise", () => {
var object = {
helloooooooo: {
message: [12345],
Expand Down
2 changes: 1 addition & 1 deletion test/cli/run/preload-test.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ plugin({
});
`;

test.todo("works from CLI", async () => {
test("works from CLI", async () => {
const preloadDir = join(realpathSync(tmpdir()), "bun-preload-test6");
mkdirSync(preloadDir, { recursive: true });
const preloadPath = join(preloadDir, "preload.js");
Expand Down
5 changes: 2 additions & 3 deletions test/cli/test/bun-test.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ describe("bun test", () => {
});
expect(stderr).toContain(path);
});
// This fails on macOS because /private/var symlinks to /var
test.todo("can provide an absolute file", () => {
test("can provide an absolute file", () => {
const path = join("path", "to", "absolute.test.ts");
const cwd = createTest(
`
Expand Down Expand Up @@ -95,7 +94,7 @@ describe("bun test", () => {
});
expect(stderr).toContain(dir);
});
test.todo("can provide an absolute directory", () => {
test("can provide an absolute directory", () => {
const path = join("path", "to", "absolute.test.ts");
const cwd = createTest(
`
Expand Down
4 changes: 4 additions & 0 deletions test/config/bunfig/fixtures/preload/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ import assert from "node:assert";
import foo from "./foo.yaml";
assert(foo);
assert.equal(typeof foo, "object");
// bun-plugin-yaml only exports a plugin factory (it registers nothing), and
// .yaml imports work natively, so the import above does not prove the preload
// ran. Its presence in the module cache does.
assert(require.resolve("bun-plugin-yaml") in require.cache, "bunfig preload was not loaded");
2 changes: 1 addition & 1 deletion test/config/bunfig/preload.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe("Given a `bunfig.toml` with a list of preloads", () => {
describe("Given a `bunfig.toml` with a plugin preload", () => {
const dir = fixturePath("plugin");

it.todo("When `bun run` is run, preloads are run", async () => {
it("When `bun run` is run, preloads are run", async () => {
const [out, err, code] = await run("index.ts", { cwd: dir });
expect(err).toBeEmpty();
expect(out).toBeEmpty();
Expand Down
20 changes: 8 additions & 12 deletions test/js/bun/http/bun-serve-file.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,23 +298,18 @@ describe("Bun.file in serve routes", () => {
});
});

describe.todo("Range requests", () => {
describe.concurrent("Range requests", () => {
it("supports partial content requests", async () => {
const res = await fetch(new URL(`/hello.txt`, server.url), {
headers: {
"Range": "bytes=0-4",
},
});

if (res.status === 206) {
expect(await res.text()).toBe("Hello");
expect(res.headers.get("Content-Range")).toMatch(/bytes 0-4\/13/);
expect(res.headers.get("Accept-Ranges")).toBe("bytes");
} else {
// If range requests aren't supported, should return full content
expect(res.status).toBe(200);
expect(await res.text()).toBe("Hello, World!");
}
expect(res.status).toBe(206);
expect(res.headers.get("Content-Range")).toBe("bytes 0-4/13");
expect(res.headers.get("Accept-Ranges")).toBe("bytes");
expect(await res.text()).toBe("Hello");
});

it("handles invalid range requests", async () => {
Expand All @@ -324,8 +319,9 @@ describe("Bun.file in serve routes", () => {
},
});

// Should either return 416 Range Not Satisfiable or 200 with full content
expect([200, 416]).toContain(res.status);
expect(res.status).toBe(416);
expect(res.headers.get("Content-Range")).toBe("bytes */13");
expect(await res.text()).toBe("");
});
});

Expand Down
52 changes: 16 additions & 36 deletions test/js/bun/spawn/spawn-stdin-readable-stream-edge-cases.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,58 +175,38 @@ describe("spawn stdin ReadableStream edge cases", () => {
expect(await proc.exited).toBe(0);
});

test.todo("ReadableStream with cancel callback verification", async () => {
let cancelReason: any = null;
let cancelCalled = false;
test("ReadableStream with cancel callback verification", async () => {
const cancelled = Promise.withResolvers<void>();

// Never closes: the only way this stream ends is spawn cancelling it.
const stream = new ReadableStream({
start(controller) {
// Start sending data
let count = 0;
const interval = setInterval(() => {
count++;
try {
controller.enqueue(`data ${count}\n`);
} catch (e) {
clearInterval(interval);
}
}, 50);

// Store interval for cleanup
(controller as any).interval = interval;
controller.enqueue("data\n");
},
cancel(reason) {
cancelCalled = true;
cancelReason = reason;
// Clean up interval if exists
if ((this as any).interval) {
clearInterval((this as any).interval);
}
pull() {},
cancel() {
cancelled.resolve();
},
});

// Kill the process after some data
const proc = spawn({
cmd: [bunExe(), "-e", "process.stdin.pipe(process.stdout)"],
stdin: stream,
stdout: "pipe",
env: bunEnv,
});

// Wait a bit then kill
await Bun.sleep(150);
proc.kill();

try {
await proc.exited;
} catch (e) {
// Expected - process was killed
}
// Kill only once the chunk has made the round trip, so the stream is
// attached to stdin and waiting for more data at that point.
const reader = proc.stdout.getReader();
const { value } = await reader.read();
expect(new TextDecoder().decode(value)).toBe("data\n");
reader.releaseLock();

// Give time for cancel to be called
await Bun.sleep(50);
proc.kill();
await proc.exited;

expect(cancelCalled).toBe(true);
await cancelled.promise;
});

test("ReadableStream with high frequency small chunks", async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/js/bun/yaml/yaml.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4323,7 +4323,7 @@ refs:
expect(yaml2).toBe("counter: 4");
});

test.todo("handles circular getters", () => {
test("handles circular getters", () => {
const obj = {
get self() {
return obj;
Expand Down
3 changes: 1 addition & 2 deletions test/js/node/child_process/child_process-node.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,7 @@ describe("fork", () => {
// https://github.com/nodejs/node/blob/v20.5.0/test/parallel/test-child-process-fork-stdio.js
});
describe("fork", () => {
it.todo("message", done => {
// TODO - bun has no `send` method in the process
it("message", done => {
const { mustCall } = createCallCheckCtx(done);
const args = ["foo", "bar"];
const n = fork(fixtures.path("child-process-spawn-node.js"), args);
Expand Down
7 changes: 4 additions & 3 deletions test/js/node/http/node-http-connect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,15 @@ describe("HTTP server CONNECT", () => {
expect(response).toContain("502 Bad Gateway");
});

// TODO: timeout is not supported in bun socket yet
test.todo("should handle socket timeout", async () => {
test("should handle socket timeout", async () => {
await using proxyServer = http.createServer();
let timeoutFired = false;

proxyServer.on("connect", (req, socket, head) => {
socket.setTimeout(100);
socket.on("timeout", () => {
// The idle timer re-arms after the write below, so a slow close fires
// 'timeout' again; a second handler run would write after end().
socket.once("timeout", () => {
timeoutFired = true;
socket.write("HTTP/1.1 408 Request Timeout\r\n\r\n");
socket.end();
Expand Down
16 changes: 8 additions & 8 deletions test/js/node/stream/node-stream.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ describe("Readable", () => {
stream.pipe(writable);
});

it.todo("should have the correct fields in _events", () => {
it("should have the correct fields in _events", () => {
const s = Readable({});
expect(s._events).toHaveProperty("close");
expect(s._events).toHaveProperty("error");
expect(s._events).toHaveProperty("prefinish");
expect(s._events).toHaveProperty("finish");
expect(s._events).toHaveProperty("drain");
expect(s._events).toHaveProperty("data");
expect(s._events).toHaveProperty("end");
expect(s._events).toHaveProperty("readable");
});
});

Expand Down Expand Up @@ -205,7 +205,7 @@ describe("createReadStream", () => {
});

describe("Writable", () => {
it.todo("should have the correct fields in _events", () => {
it("should have the correct fields in _events", () => {
const s = Writable({});
expect(s._events).toHaveProperty("close");
expect(s._events).toHaveProperty("error");
Expand All @@ -229,7 +229,7 @@ describe("Duplex", () => {
expect(subclass instanceof Duplex).toBe(true);
});

it.todo("should have the correct fields in _events", () => {
it("should have the correct fields in _events", () => {
const s = Duplex({});
expect(s._events).toHaveProperty("close");
expect(s._events).toHaveProperty("error");
Expand All @@ -256,7 +256,7 @@ describe("Transform", () => {
expect(subclass instanceof Transform).toBe(true);
});

it.todo("should have the correct fields in _events", () => {
it("should have the correct fields in _events", () => {
const s = Transform({});
expect(s._events).toHaveProperty("close");
expect(s._events).toHaveProperty("error");
Expand All @@ -283,7 +283,7 @@ describe("PassThrough", () => {
expect(subclass instanceof PassThrough).toBe(true);
});

it.todo("should have the correct fields in _events", () => {
it("should have the correct fields in _events", () => {
const s = PassThrough({});
expect(s._events).toHaveProperty("close");
expect(s._events).toHaveProperty("error");
Expand Down
6 changes: 2 additions & 4 deletions test/js/node/url/url-pathtofileurl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ describe("url.pathToFileURL", () => {
// }
});

// TODO: Support UNC paths across platforms.
test.todo("UNC paths", () => {
test("UNC paths", () => {
if (isWindows) {
// UNC path: \\server\share\resource

Expand Down Expand Up @@ -171,8 +170,7 @@ describe("url.pathToFileURL", () => {
}
});

// TODO: Support throwing correct exception for non-string params.
test.todo("non-string parameter", () => {
test("non-string parameter", () => {
for (const badPath of [
undefined,
null,
Expand Down
3 changes: 1 addition & 2 deletions test/js/node/url/url-revokeobjecturl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { describe, test } from "bun:test";
import assert from "node:assert";
import { URL } from "node:url";

// TODO: Support throwing appropriate error.
describe.todo("URL.revokeObjectURL", () => {
describe("URL.revokeObjectURL", () => {
test("invalid input", () => {
// Test ensures that the function receives the url argument.
assert.throws(
Expand Down
8 changes: 4 additions & 4 deletions test/js/third_party/express/express.json.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("express.json()", function () {
.expect(200, "{}", done);
});

it.todo("should handle empty message-body", function (done) {
it("should handle empty message-body", function (done) {
request(createApp())
.post("/")
.set("Content-Type", "application/json")
Expand Down Expand Up @@ -201,7 +201,7 @@ describe("express.json()", function () {
app = createApp({ inflate: false });
});

it.todo("should not accept content-encoding", function (done) {
it("should not accept content-encoding", function (done) {
var test = request(app).post("/");
test.set("Content-Encoding", "gzip");
test.set("Content-Type", "application/json");
Expand Down Expand Up @@ -245,7 +245,7 @@ describe("express.json()", function () {
app = createApp({ strict: false });
});

it.todo("should parse primitives", function (done) {
it("should parse primitives", function (done) {
request(app).post("/").set("Content-Type", "application/json").send("true").expect(200, "true", done);
});
});
Expand Down Expand Up @@ -326,7 +326,7 @@ describe("express.json()", function () {
.expect(200, '{"user":"tobi"}', done);
});

it.todo('should parse JSON for "application/vnd.api+json"', function (done) {
it('should parse JSON for "application/vnd.api+json"', function (done) {
request(app)
.post("/")
.set("Content-Type", "application/vnd.api+json")
Expand Down
Loading
Loading