aboutsummaryrefslogtreecommitdiff
path: root/integration/bunjs-only-snippets/fs.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'integration/bunjs-only-snippets/fs.test.js')
-rw-r--r--integration/bunjs-only-snippets/fs.test.js18
1 files changed, 6 insertions, 12 deletions
diff --git a/integration/bunjs-only-snippets/fs.test.js b/integration/bunjs-only-snippets/fs.test.js
index 4fc5c9e91..513132450 100644
--- a/integration/bunjs-only-snippets/fs.test.js
+++ b/integration/bunjs-only-snippets/fs.test.js
@@ -1,17 +1,9 @@
import { describe, it, expect } from "bun:test";
-import {
- mkdirSync,
- existsSync,
- readFileSync,
- mkdtempSync,
- writeFileSync,
-} from "node:fs";
-
-const tmp = mkdtempSync("fs-test");
+import { mkdirSync, existsSync, readFileSync, writeFileSync } from "node:fs";
describe("mkdirSync", () => {
it("should create a directory", () => {
- const tempdir = `${tmp}/1234/hi`;
+ const tempdir = `/tmp/fs.test.js/${Date.now()}/1234/hi`;
expect(existsSync(tempdir)).toBe(false);
expect(tempdir.includes(mkdirSync(tempdir, { recursive: true }))).toBe(
true
@@ -29,7 +21,9 @@ describe("readFileSync", () => {
describe("writeFileSync", () => {
it("works", () => {
- const text = writeFileSync(`${tmp}/writeFileSync.txt`, "utf8");
- expect(text).toBe("File read successfully");
+ const path = `/tmp/${Date.now()}.writeFileSync.txt`;
+ writeFileSync(path, "File written successfully", "utf8");
+
+ expect(readFileSync(path, "utf8")).toBe("File written successfully");
});
});