Skip to content

Commit

Permalink
fix: use ESM-compatible __dirname reference in e2e/tests/api-driven (
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak authored Jan 7, 2025
1 parent 2984d2a commit 9ab99a3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions e2e/tests/api-driven/src/invite-to-pay/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import type {
import axios from "axios";
import { gql } from "graphql-tag";
import { readFileSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { $admin } from "../client.js";
import { createTeam, createUser, TEST_EMAIL } from "../globalHelpers.js";
import {
Expand All @@ -16,6 +18,10 @@ import {
import { CustomWorld } from "./steps.js";

export async function setUpMocks() {
// we can't directly access `__dirname` in ESM, so get equivalent using fileURLToPath
const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
const __dirname = path.dirname(__filename); // get the name of the directory

const serverMockFile = readFileSync(`${__dirname}/mocks/server-mocks.yaml`);
return axios({
method: "POST",
Expand Down

0 comments on commit 9ab99a3

Please sign in to comment.