aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/harness.ts14
-rw-r--r--test/js/node/path/path.test.js1
2 files changed, 9 insertions, 6 deletions
diff --git a/test/harness.ts b/test/harness.ts
index ab3ae5ca2..2da12e094 100644
--- a/test/harness.ts
+++ b/test/harness.ts
@@ -1,8 +1,4 @@
import { gc as bunGC, unsafe, which } from "bun";
-import { heapStats } from "bun:jsc";
-import path from "path";
-import fs from "fs";
-import os from "os";
export const bunEnv: any = {
...process.env,
@@ -43,6 +39,8 @@ export async function expectMaxObjectTypeCount(
count: number,
maxWait = 1000,
) {
+ var { heapStats } = require("bun:jsc");
+
gc();
if (heapStats().objectTypeCounts[type] <= count) return;
gc(true);
@@ -85,7 +83,11 @@ export function hideFromStackTrace(block: CallableFunction) {
}
export function tempDirWithFiles(basename: string, files: Record<string, string | Record<string, string>>) {
- const dir = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), basename + "_"));
+ var fs = require("fs");
+ var path = require("path");
+ var { tmpdir } = require("os");
+
+ const dir = fs.mkdtempSync(path.join(fs.realpathSync(tmpdir()), basename + "_"));
for (const [name, contents] of Object.entries(files)) {
if (typeof contents === "object") {
fs.mkdirSync(path.join(dir, name));
@@ -100,6 +102,7 @@ export function tempDirWithFiles(basename: string, files: Record<string, string
}
export function bunRun(file: string, env?: Record<string, string>) {
+ var path = require("path");
const result = Bun.spawnSync([bunExe(), file], {
cwd: path.dirname(file),
env: {
@@ -116,6 +119,7 @@ export function bunRun(file: string, env?: Record<string, string>) {
}
export function bunTest(file: string, env?: Record<string, string>) {
+ var path = require("path");
const result = Bun.spawnSync([bunExe(), "test", path.basename(file)], {
cwd: path.dirname(file),
env: {
diff --git a/test/js/node/path/path.test.js b/test/js/node/path/path.test.js
index 103809d2e..fb6063968 100644
--- a/test/js/node/path/path.test.js
+++ b/test/js/node/path/path.test.js
@@ -547,7 +547,6 @@ it("path.normalize", () => {
// "..\\..\\..\\..\\baz"
// );
// strictEqual(path.win32.normalize("foo/bar\\baz"), "foo\\bar\\baz");
-
strictEqual(path.posix.normalize("./fixtures///b/../b/c.js"), "fixtures/b/c.js");
strictEqual(path.posix.normalize("/foo/../../../bar"), "/bar");
strictEqual(path.posix.normalize("a//b//../b"), "a/b");