From 2f255a06e424215ea827c629aef512cfe165e24b Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Sat, 2 Aug 2025 11:04:47 +0000 Subject: [PATCH] test(napi/parser): ensure `target` dir exists (#12751) In tests for `napi/parser`, don't assume `target` dir exists. It generally should, because you'll have built the `.node` binary. But it `cargo clean` will remove it, and it can also not exist on CI if running build and test in separate jobs. --- napi/parser/test/parse-raw.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/napi/parser/test/parse-raw.test.ts b/napi/parser/test/parse-raw.test.ts index 977c80814cc0d..fda720a893849 100644 --- a/napi/parser/test/parse-raw.test.ts +++ b/napi/parser/test/parse-raw.test.ts @@ -1,6 +1,6 @@ // Tests for raw transfer. -import { readdir, readFile, stat, writeFile } from 'node:fs/promises'; +import { mkdir, readdir, readFile, stat, writeFile } from 'node:fs/promises'; import { basename, join as pathJoin } from 'node:path'; import Tinypool from 'tinypool'; import { describe, expect, it } from 'vitest'; @@ -72,6 +72,8 @@ const benchFixtureUrls = [ 'https://cdn.jsdelivr.net/npm/antd@5.12.5/dist/antd.js', ]; +await mkdir(TARGET_DIR_PATH, { recursive: true }); + const benchFixturePaths = await Promise.all(benchFixtureUrls.map(async (url) => { const filename = url.split('/').at(-1), path = pathJoin(TARGET_DIR_PATH, filename);