From 5aa66e46e3f3475c4c1eb521cd402dfd85091b52 Mon Sep 17 00:00:00 2001 From: wolfy1339 <4595477+wolfy1339@users.noreply.github.com> Date: Tue, 9 Apr 2024 17:09:55 -0400 Subject: [PATCH] fix: correct path to fixtures when using function from another package (#652) * fix: correct path to fixtures * fix: actually fix the FileNotFoundError --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index d92de024..bc0c5250 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,6 @@ import { diffString } from "json-diff"; import { readFileSync } from "fs"; export default { - // don’t use short syntax for node@4 compatibility get, mock, nock, @@ -17,7 +16,9 @@ export default { function get(name) { return JSON.parse( - readFileSync(`./scenarios/${name}/normalized-fixture.json`), + readFileSync( + new URL(`./scenarios/${name}/normalized-fixture.json`, import.meta.url), + ).toString(), ); }