From 5f47eb6ab67e59be18d9426a63bfaaa4a01a927b Mon Sep 17 00:00:00 2001 From: Tyler <26290074+tylersayshi@users.noreply.github.com> Date: Tue, 12 Aug 2025 00:25:08 -0700 Subject: [PATCH] fix tests to create dir: --- deno.json | 1 + deno.lock | 2 ++ src/enum/enum.test.ts | 2 +- src/parameter-properties/parameter-properties.test.ts | 2 +- src/utils/test.ts | 6 +++++- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/deno.json b/deno.json index dc08052..0d31bf2 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,7 @@ { "imports": { "@std/assert": "jsr:@std/assert@1", + "@std/fs": "jsr:@std/fs@^1.0.19", "ts-morph": "jsr:@ts-morph/ts-morph@^26.0.0" }, "lint": { diff --git a/deno.lock b/deno.lock index ad6600d..dfc89b3 100644 --- a/deno.lock +++ b/deno.lock @@ -5,6 +5,7 @@ "jsr:@std/assert@*": "1.0.13", "jsr:@std/assert@1": "1.0.13", "jsr:@std/assert@^1.0.13": "1.0.13", + "jsr:@std/fs@*": "1.0.19", "jsr:@std/fs@1": "1.0.19", "jsr:@std/fs@^1.0.19": "1.0.19", "jsr:@std/internal@^1.0.10": "1.0.10", @@ -81,6 +82,7 @@ "workspace": { "dependencies": [ "jsr:@std/assert@1", + "jsr:@std/fs@^1.0.19", "jsr:@ts-morph/ts-morph@26" ] } diff --git a/src/enum/enum.test.ts b/src/enum/enum.test.ts index 82b1d67..d71c02e 100644 --- a/src/enum/enum.test.ts +++ b/src/enum/enum.test.ts @@ -1,7 +1,7 @@ import { executeTest } from "../utils/test.ts"; import { enumCodemod } from "./enum.ts"; -const testFn = executeTest(enumCodemod); +const testFn = await executeTest(enumCodemod); Deno.test("converts string enum to object", async () => { await testFn({ diff --git a/src/parameter-properties/parameter-properties.test.ts b/src/parameter-properties/parameter-properties.test.ts index c777025..ea3b148 100644 --- a/src/parameter-properties/parameter-properties.test.ts +++ b/src/parameter-properties/parameter-properties.test.ts @@ -1,7 +1,7 @@ import { executeTest } from "../utils/test.ts"; import { parameterPropertiesCodemod } from "./parameter-properties.ts"; -const testFn = executeTest(parameterPropertiesCodemod); +const testFn = await executeTest(parameterPropertiesCodemod); Deno.test("converts public parameter properties", async () => { await testFn({ diff --git a/src/utils/test.ts b/src/utils/test.ts index 6bedf23..1b5a9ea 100644 --- a/src/utils/test.ts +++ b/src/utils/test.ts @@ -1,4 +1,5 @@ import { assertEquals } from "@std/assert/equals"; +import { exists } from "@std/fs/exists"; import { spawn } from "node:child_process"; /** @@ -84,8 +85,11 @@ class TestUtils { } } -export const executeTest = (codemod: (filePath: string) => void) => { +export const executeTest = async (codemod: (filePath: string) => void) => { const utils = new TestUtils(codemod); + if (!exists("./tmp")) { + await Deno.mkdir("./tmp"); + } return async ( config: { -- 2.51.2