Skip to content

Commit bef74c7

Browse files
committed
__dirname
1 parent c0db1a3 commit bef74c7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

__tests__/projects.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { describe, it, expect } from "vitest";
66
describe("getProjects", () => {
77
it("gets projects from json file", async () => {
88
const projects = await getProjects();
9-
const projectsJsonPath = path.join(__dirname, "..", "projects.json");
9+
const projectsJsonPath = path.join(import.meta.dirname, "../projects.json");
1010
const data = JSON.parse(await fs.readFile(projectsJsonPath, "utf-8"));
1111
expect(projects).toEqual(data);
1212
});

src/projects.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export async function getProjects(): Promise<Project[]> {
4545
if (data) {
4646
return data;
4747
}
48-
const projectJsonPath = path.join(__dirname, "..", "projects.json");
48+
const projectJsonPath = path.join(import.meta.dirname, "../projects.json");
4949
data = JSON.parse(await fs.readFile(projectJsonPath, "utf-8"));
5050
if (validateProjects(data)) {
5151
return data as Project[];

0 commit comments

Comments
 (0)