Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
dylan-conway committed May 2, 2024
1 parent 459928c commit 5e65975
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/integration/next-pages/test/next-build.test.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { expect, test } from "bun:test";
import { bunEnv, bunExe, isWindows } from "../../../harness";
import { copyFileSync, cpSync, mkdtempSync, readFileSync, rmSync, symlinkSync, promises as fs } from "fs";
import { copyFileSync, cpSync, mkdtempSync, readFileSync, rmSync, symlinkSync, promises as fs, mkdirSync } from "fs";
import { tmpdir } from "os";
import { join } from "path";
import { join, resolve } from "path";
import { cp } from "fs/promises";

const root = join(import.meta.dir, "../");
const testRoot = resolve("/bun-test");

async function tempDirToBuildIn() {
const dir = mkdtempSync(join(tmpdir(), "bun-next-build-"));
const dir = mkdtempSync(join(testRoot, "bun-next-build-"));
const copy = [
".eslintrc.json",
"bun.lockb",
"next.config.js",
"next.config.js",
"package.json",
"postcss.config.js",
"public",
Expand All @@ -35,6 +35,8 @@ async function tempDirToBuildIn() {
throw new Error("Failed to install dependencies");
}

console.log("dir:", dir);

return dir;
}

Expand Down Expand Up @@ -80,7 +82,10 @@ function normalizeOutput(stdout: string) {
}

test("next build works", async () => {
rmSync(testRoot, { recursive: true, force: true });
mkdirSync(testRoot, { recursive: true });
rmSync(join(root, ".next"), { recursive: true, force: true });

copyFileSync(join(root, "src/Counter1.txt"), join(root, "src/Counter.tsx"));

const bunDir = await tempDirToBuildIn();
Expand Down

0 comments on commit 5e65975

Please sign in to comment.