From 505e4b80fd4bb0ecd78b983f2e62a6ec37af3e45 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Wed, 19 Jan 2022 02:39:25 -0800 Subject: Update fs.test.js --- integration/bunjs-only-snippets/fs.test.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'integration/bunjs-only-snippets') 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"); }); }); -- cgit v1.2.3 n value='ciro/http2'>ciro/http2 Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/macro-check.js (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2022-12-04content-range is inclusiveGravatar Jarred Sumner 1-1/+1
2022-12-04Update README.mdGravatar Jarred Sumner 1-6/+33
2022-12-04[Bun.serve] Implement `Content-Range` support with `Bun.file()`Gravatar Jarred Sumner 5-16/+286
2022-12-04[may revert later] Coerce Infinity to max int 64, -Infinity & NaN to min int64Gravatar Jarred Sumner 1-2/+22
2022-12-03Update .gitignoreGravatar Jarred Sumner 1-0/+1
2022-12-03[test] Add a couple tests for subarray toEqualGravatar Jarred Sumner 1-0/+3
2022-12-03[fetch] Fix bug where .arrayBuffer() on an empty Response body returned a `Ui...Gravatar Jarred Sumner 1-1/+1
2022-12-03Don't invalidate previous file descriptro to avoid tripping assertionGravatar Jarred Sumner 1-5/+0
2022-12-03miscGravatar Jarred Sumner 3-1/+31
2022-12-03Add missing typeGravatar Jarred Sumner 1-0/+5
2022-12-03`process.stdout` and `process.stderr`Gravatar Jarred Sumner 15-564/+1537
2022-12-03simdutf ascii validation is about 20% faster on arm64 than our zig simd @Vect...Gravatar Jarred Sumner 1-0/+3
2022-12-03typo in readme (#1576)Gravatar Reed Jones 1-2/+2