diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index f638df4f..8700b899 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -36,14 +36,14 @@ function login({ email?: string; } = {}) { cy.then(() => ({ email })).as("user"); - cy.exec( - `node --require esbuild-register ./cypress/support/create-user.ts "${email}"` - ).then(({ stdout }) => { - const cookieValue = stdout - .replace(/.*(?.*)<\/cookie>.*/s, "$") - .trim(); - cy.setCookie("__session", cookieValue); - }); + cy.exec(`npx ts-node ./cypress/support/create-user.ts "${email}"`).then( + ({ stdout }) => { + const cookieValue = stdout + .replace(/.*(?.*)<\/cookie>.*/s, "$") + .trim(); + cy.setCookie("__session", cookieValue); + } + ); return cy.get("@user"); } @@ -62,9 +62,7 @@ function cleanupUser({ email }: { email?: string } = {}) { } function deleteUserByEmail(email: string) { - cy.exec( - `node --require esbuild-register ./cypress/support/delete-user.ts "${email}"` - ); + cy.exec(`npx ts-node ./cypress/support/delete-user.ts "${email}"`); cy.clearCookie("__session"); } diff --git a/cypress/support/create-user.ts b/cypress/support/create-user.ts index b9a04a22..e598dc20 100644 --- a/cypress/support/create-user.ts +++ b/cypress/support/create-user.ts @@ -1,6 +1,6 @@ // Use this to create a new user and login with that user // Simply call this with: -// node --require esbuild-register ./cypress/support/create-user.ts username@example.com +// npx ts-node ./cypress/support/create-user.ts username@example.com // and it will log out the cookie value you can use to interact with the server // as that new user. diff --git a/cypress/support/delete-user.ts b/cypress/support/delete-user.ts index bb128b9e..e14cd719 100644 --- a/cypress/support/delete-user.ts +++ b/cypress/support/delete-user.ts @@ -1,6 +1,6 @@ // Use this to delete a user by their email // Simply call this with: -// node --require esbuild-register ./cypress/support/delete-user.ts username@example.com +// npx ts-node ./cypress/support/delete-user.ts username@example.com // and that user will get deleted import { installGlobals } from "@remix-run/node/globals";