Skip to content

Commit

Permalink
fix: correct path to fixtures when using function from another package (
Browse files Browse the repository at this point in the history
#652)

* fix: correct path to fixtures

* fix: actually fix the FileNotFoundError
  • Loading branch information
wolfy1339 committed Apr 9, 2024
1 parent 42c964d commit 5aa66e4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ import { diffString } from "json-diff";
import { readFileSync } from "fs";

export default {
// don’t use short syntax for node@4 compatibility
get,
mock,
nock,
};

function get(name) {
return JSON.parse(
readFileSync(`./scenarios/${name}/normalized-fixture.json`),
readFileSync(
new URL(`./scenarios/${name}/normalized-fixture.json`, import.meta.url),
).toString(),
);
}

Expand Down

0 comments on commit 5aa66e4

Please sign in to comment.