Compare commits

...

5 Commits

Author SHA1 Message Date
Meghan Denny
90ed76fc6b add macOS todo 2024-05-07 14:08:23 -07:00
Meghan Denny
28de650231 add a windows todo 2024-05-06 22:15:09 -07:00
Meghan Denny
1a4679ee34 add a windows todo 2024-05-06 22:14:17 -07:00
Meghan Denny
06db4eb897 Merge branch 'main' into nektro-patch-22948 2024-05-06 22:13:53 -07:00
Meghan Denny
f5d8601ed9 windows 2024-05-06 20:57:50 -07:00
13 changed files with 44 additions and 33 deletions

View File

@@ -41,7 +41,8 @@ beforeEach(async () => {
await Promise.all(waiting);
});
it("should choose the tagged versions instead of the PATH versions when a tag is specified", async () => {
// prettier-ignore
it.todoIf(isWindows)("should choose the tagged versions instead of the PATH versions when a tag is specified", async () => {
const semverVersions = [
"7.0.0",
"7.1.0",

View File

@@ -4894,7 +4894,7 @@ for (const forceWaiterThread of isLinux ? [false, true] : [false]) {
expect(proc.resourceUsage()?.cpuTime.total).toBeLessThan(750_000);
});
test(
test.todoIf(isWindows)(
"bun pm trust",
async () => {
const dep = isWindows ? "uses-what-bin-slow-window" : "uses-what-bin-slow";

View File

@@ -13,6 +13,7 @@ export const isLinux = process.platform === "linux";
export const isPosix = isMacOS || isLinux;
export const isWindows = process.platform === "win32";
export const isIntelMacOS = isMacOS && process.arch === "x64";
export const isCI = process.env.CI !== undefined;
export const bunEnv: NodeJS.ProcessEnv = {
...process.env,

View File

@@ -1,5 +1,5 @@
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
import { bunEnv, bunExe } from "../../../harness";
import { bunEnv, bunExe, isCI, isWindows } from "../../../harness";
import { Subprocess } from "bun";
import { copyFileSync, rmSync } from "fs";
import { join } from "path";
@@ -113,7 +113,8 @@ afterAll(() => {
}
});
test("ssr works for 100-ish requests", async () => {
// prettier-ignore
test.todoIf(isWindows && isCI)("ssr works for 100-ish requests", async () => {
expect(dev_server).not.toBeUndefined();
expect(baseUrl).not.toBeUndefined();

View File

@@ -1,5 +1,5 @@
import { afterAll, beforeAll, expect, test } from "bun:test";
import { bunEnv, bunExe } from "../../../harness";
import { bunEnv, bunExe, isCI, isWindows } from "../../../harness";
import { Subprocess } from "bun";
import { copyFileSync } from "fs";
import { join } from "path";
@@ -119,7 +119,7 @@ afterAll(() => {
// https://github.com/puppeteer/puppeteer/issues/7740
const puppeteer_unsupported = process.platform === "linux" && process.arch === "arm64";
test.skipIf(puppeteer_unsupported)(
test.skipIf(puppeteer_unsupported || (isWindows && isCI))(
"hot reloading works on the client (+ tailwind hmr)",
async () => {
expect(dev_server).not.toBeUndefined();

View File

@@ -1,5 +1,5 @@
import { expect, test } from "bun:test";
import { bunEnv, bunExe, isWindows } from "../../../harness";
import { bunEnv, bunExe, isCI, isWindows } from "../../../harness";
import { copyFileSync, cpSync, mkdtempSync, readFileSync, rmSync, symlinkSync, promises as fs } from "fs";
import { tmpdir } from "os";
import { join } from "path";
@@ -79,7 +79,8 @@ function normalizeOutput(stdout: string) {
);
}
test("next build works", async () => {
// prettier-ignore
test.todoIf(isWindows && isCI)("next build works", async () => {
rmSync(join(root, ".next"), { recursive: true, force: true });
copyFileSync(join(root, "src/Counter1.txt"), join(root, "src/Counter.tsx"));

View File

@@ -1,6 +1,6 @@
import { join } from "path";
import { it, expect, beforeAll, afterAll } from "bun:test";
import { bunExe, bunEnv } from "harness";
import { bunExe, bunEnv, isWindows, isCI } from "harness";
import type { Subprocess } from "bun";
const ACCEPTABLE_MEMORY_LEAK = 2; //MB for acceptable memory leak variance
@@ -113,7 +113,7 @@ async function calculateMemoryLeak(fn: () => Promise<void>) {
}
for (const test_info of [
["#10265 should not leak memory when ignoring the body", callIgnore, false],
["#10265 should not leak memory when ignoring the body", callIgnore, isWindows], // flaky
["should not leak memory when buffering the body", callBuffering, false],
["should not leak memory when streaming the body", callStreaming, false],
["should not leak memory when streaming the body incompletely", callIncompleteStreaming, true],

View File

@@ -2,7 +2,7 @@ import { file, gc, Serve, serve, Server } from "bun";
import { afterEach, describe, it, expect, afterAll, mock } from "bun:test";
import { readFileSync, writeFileSync } from "fs";
import { join, resolve } from "path";
import { bunExe, bunEnv, dumpStats } from "harness";
import { bunExe, bunEnv, dumpStats, isMacOS, isCI } from "harness";
// import { renderToReadableStream } from "react-dom/server";
// import app_jsx from "./app.jsx";
import { spawn } from "child_process";
@@ -50,7 +50,8 @@ afterAll(() => {
describe("1000 simultaneous uploads & downloads do not leak ReadableStream", () => {
for (let isDirect of [true, false] as const) {
it(
// prettier-ignore
it.todoIf(!isDirect && isMacOS)( // flaky
isDirect ? "direct" : "default",
async () => {
const blob = new Blob([new Uint8Array(1024 * 768).fill(123)]);
@@ -1264,7 +1265,7 @@ it("#5859 text", async () => {
await server.stop(true);
});
it("#5859 json", async () => {
it.todoIf(isMacOS && isCI)("#5859 json", async () => {
const server = Bun.serve({
port: 0,
async fetch(req) {

View File

@@ -7,7 +7,7 @@
import { $ } from "bun";
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
import { mkdir, mkdtemp, realpath, rm, stat } from "fs/promises";
import { bunEnv, bunExe, runWithErrorPromise, tempDirWithFiles } from "harness";
import { bunEnv, bunExe, isWindows, runWithErrorPromise, tempDirWithFiles } from "harness";
import { tmpdir } from "os";
import { join, sep } from "path";
import { createTestBuilder, sortedShellOutput } from "./util";
@@ -981,7 +981,7 @@ describe("deno_task", () => {
}
});
test("stacktrace", async () => {
test.todoIf(isWindows)("stacktrace", async () => {
// const folder = TestBuilder.tmpdir();
const code = /* ts */ `import { $ } from 'bun'

View File

@@ -783,7 +783,7 @@ describe("close handling", () => {
}
});
it("dispose keyword works", async () => {
it.todoIf(isWindows)("dispose keyword works", async () => {
let captured;
{
await using proc = spawn({

View File

@@ -65,7 +65,7 @@ describe("ChildProcess.spawn()", () => {
describe("spawn()", () => {
it("should spawn a process", () => {
const child = spawn("echo", ["hello"]);
const child = spawn(bunExe(), ["--version"]);
expect(!!child).toBe(true);
});
@@ -147,7 +147,7 @@ describe("spawn()", () => {
expect(result.trim()).toBe(platformTmpDir);
});
it("should allow us to write to stdin", async () => {
it.skipIf(isWindows)("should allow us to write to stdin", async () => {
const child = spawn("tee");
const result: string = await new Promise(resolve => {
child.stdin.write("hello");
@@ -172,7 +172,9 @@ describe("spawn()", () => {
expect(end! - start < 2000).toBe(true);
});
it("should allow us to set env", async () => {
// https://github.com/oven-sh/bun/issues/9716
// Re-enable this once 'printenv' is in bun shell
it.todoIf(isWindows)("should allow us to set env", async () => {
async function getChildEnv(env: any): Promise<object> {
const child = spawn("printenv", {
env: env,
@@ -235,7 +237,7 @@ describe("spawn()", () => {
expect(JSON.parse(result)).toStrictEqual([bunExe(), fs.realpathSync(Bun.which("node"))]);
});
it("should allow us to spawn in a shell", async () => {
it.todoIf(isWindows)("should allow us to spawn in a shell", async () => {
const result1: string = await new Promise(resolve => {
const child1 = spawn("echo", ["$0"], { shell: true });
child1.stdout.on("data", data => {
@@ -256,8 +258,8 @@ describe("spawn()", () => {
expect(result2.trim()).toBe("bash");
});
it("should spawn a process synchronously", () => {
const { stdout } = spawnSync("echo", ["hello"], { encoding: "utf8" });
expect(stdout.trim()).toBe("hello");
const { stdout } = spawnSync(bunExe(), ["--version"], { encoding: "utf8" });
expect(stdout.trim()).toBe(Bun.version);
});
});
@@ -302,8 +304,8 @@ describe("exec()", () => {
describe("spawnSync()", () => {
it("should spawn a process synchronously", () => {
const { stdout } = spawnSync("echo", ["hello"], { encoding: "utf8" });
expect(stdout.trim()).toBe("hello");
const { stdout } = spawnSync(bunExe(), ["--version"], { encoding: "utf8" });
expect(stdout.trim()).toBe(Bun.version);
});
});
@@ -333,14 +335,14 @@ describe("execSync()", () => {
describe("Bun.spawn()", () => {
it("should return exit code 0 on successful execution", async () => {
const proc = Bun.spawn({
cmd: ["echo", "hello"],
cmd: [bunExe(), "--version"],
stdout: "pipe",
env: bunEnv,
});
for await (const chunk of proc.stdout) {
const text = new TextDecoder().decode(chunk);
expect(text.trim()).toBe("hello");
expect(text.trim()).toBe(Bun.version);
}
const result = await new Promise(resolve => {
@@ -418,7 +420,12 @@ it("it accepts stdio passthrough", async () => {
expect(stderr).toBeDefined();
const err = await new Response(stderr).text();
expect(err.split("\n")).toEqual(["$ run-p echo-hello echo-world", "$ echo hello", "$ echo world", ""]);
expect(err.replaceAll("[bun shell] ", "").split("\n")).toEqual([
"$ run-p echo-hello echo-world",
"$ echo hello",
"$ echo world",
"",
]);
expect(stdout).toBeDefined();
const out = await new Response(stdout).text();
expect(out.split("\n")).toEqual(["hello", "world", ""]);

View File

@@ -1,12 +1,11 @@
import { describe, expect, test, it } from "bun:test";
import { isCI, isWindows } from "harness";
import * as dns from "node:dns";
import * as dns_promises from "node:dns/promises";
import * as fs from "node:fs";
import * as os from "node:os";
import * as util from "node:util";
const isWindows = process.platform === "win32";
// TODO:
test("it exists", () => {
expect(dns).toBeDefined();
@@ -158,7 +157,7 @@ test("dns.resolveNs (bun.sh) ", done => {
});
});
test("dns.resolveNs (empty string) ", done => {
test.todoIf(isWindows && isCI)("dns.resolveNs (empty string) ", done => {
dns.resolveNs("", (err, results) => {
expect(err).toBeNull();
@@ -194,7 +193,7 @@ test("dns.resolvePtr (ptr.socketify.dev)", done => {
});
});
test("dns.resolveCname (cname.socketify.dev)", done => {
test.todoIf(isWindows && isCI)("dns.resolveCname (cname.socketify.dev)", done => {
dns.resolveCname("cname.socketify.dev", (err, results) => {
expect(err).toBeNull();
expect(results instanceof Array).toBe(true);

View File

@@ -1,7 +1,7 @@
import { it, expect } from "bun:test";
import tls from "tls";
import { join } from "node:path";
import { bunEnv, bunExe } from "harness";
import { bunEnv, bunExe, isCI, isWindows } from "harness";
type TLSOptions = {
cert: string;
@@ -82,7 +82,7 @@ it("fetch with valid tls and non-native checkServerIdentity should work", async
expect(count).toBe(2);
});
it("fetch with rejectUnauthorized: false should not call checkServerIdentity", async () => {
it.todoIf(isWindows && isCI)("fetch with rejectUnauthorized: false should not call checkServerIdentity", async () => {
let count = 0;
await fetch("https://bun.sh", {