mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 19:08:50 +00:00
Reduce memory usage in long-running processes (#14885)
This commit is contained in:
@@ -556,6 +556,12 @@ function expectBundled(
|
||||
let root = path.join(
|
||||
tempDirectory,
|
||||
id
|
||||
.replaceAll("\\", "/")
|
||||
.replaceAll(":", "-")
|
||||
.replaceAll(" ", "-")
|
||||
.replaceAll("\r\n", "-")
|
||||
.replaceAll("\n", "-")
|
||||
.replaceAll(".", "-")
|
||||
.split("/")
|
||||
.map(a => filenamify(a))
|
||||
.join("/"),
|
||||
|
||||
@@ -79,7 +79,7 @@ async function getDevServerURL() {
|
||||
readStream()
|
||||
.catch(e => reject(e))
|
||||
.finally(() => {
|
||||
dev_server.unref?.();
|
||||
dev_server?.unref?.();
|
||||
});
|
||||
await promise;
|
||||
return baseUrl;
|
||||
|
||||
@@ -15,15 +15,18 @@ describe("doesnt_crash", async () => {
|
||||
files = readdirSync(files_dir).map(file => path.join(files_dir, file));
|
||||
console.log("Tempdir", temp_dir);
|
||||
|
||||
files.map(file => {
|
||||
const outfile1 = path.join(temp_dir, file).replaceAll("\\", "/");
|
||||
const outfile2 = path.join(temp_dir, "lmao1-" + file).replaceAll("\\", "/");
|
||||
const outfile3 = path.join(temp_dir, "lmao2-" + file).replaceAll("\\", "/");
|
||||
const outfile4 = path.join(temp_dir, "lmao3-" + file).replaceAll("\\", "/");
|
||||
files.map(absolute => {
|
||||
absolute = absolute.replaceAll("\\", "/");
|
||||
const file = path.basename(absolute);
|
||||
const outfile1 = path.join(temp_dir, "file-1" + file).replaceAll("\\", "/");
|
||||
const outfile2 = path.join(temp_dir, "file-2" + file).replaceAll("\\", "/");
|
||||
const outfile3 = path.join(temp_dir, "file-3" + file).replaceAll("\\", "/");
|
||||
const outfile4 = path.join(temp_dir, "file-4" + file).replaceAll("\\", "/");
|
||||
|
||||
test(file, async () => {
|
||||
{
|
||||
const { stdout, stderr, exitCode } =
|
||||
await Bun.$`${bunExe()} build --experimental-css ${file} --outfile=${outfile1}`.quiet().env(bunEnv);
|
||||
await Bun.$`${bunExe()} build --experimental-css ${absolute} --outfile=${outfile1}`.quiet().env(bunEnv);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(stdout.toString()).not.toContain("error");
|
||||
expect(stderr.toString()).toBeEmpty();
|
||||
@@ -39,7 +42,9 @@ describe("doesnt_crash", async () => {
|
||||
test(`(minify) ${file}`, async () => {
|
||||
{
|
||||
const { stdout, stderr, exitCode } =
|
||||
await Bun.$`${bunExe()} build --experimental-css ${file} --minify --outfile=${outfile3}`.quiet().env(bunEnv);
|
||||
await Bun.$`${bunExe()} build --experimental-css ${absolute} --minify --outfile=${outfile3}`
|
||||
.quiet()
|
||||
.env(bunEnv);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(stdout.toString()).not.toContain("error");
|
||||
expect(stderr.toString()).toBeEmpty();
|
||||
|
||||
Reference in New Issue
Block a user