Skip to content

Commit

Permalink
Fix __dirname definition to not depend on __filename
Browse files Browse the repository at this point in the history
Not available in Jest
  • Loading branch information
lemilonkh committed Mar 21, 2024
1 parent 861f335 commit 2bdf7c3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions app/tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ const createTestCsvFile = async (
fileName: string,
data: string,
): Promise<string> => {
const __dirname = __filename.replace(path.basename(__filename), "");
// const __dirname = path.dirname(fileURLToPath(import.meta.url));
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const filePath = path.join(__dirname, fileName);

await fs.promises.writeFile(filePath, data, "utf8");
Expand Down

0 comments on commit 2bdf7c3

Please sign in to comment.