Skip to content

Commit

Permalink
actually require it
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Mar 24, 2022
1 parent 38b0763 commit d725c62
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ function login({
email?: string;
} = {}) {
cy.then(() => ({ email })).as("user");
cy.exec(`npx ts-node ./cypress/support/create-user.ts "${email}"`).then(
({ stdout }) => {
const cookieValue = stdout
.replace(/.*<cookie>(?<cookieValue>.*)<\/cookie>.*/s, "$<cookieValue>")
.trim();
cy.setCookie("__session", cookieValue);
}
);
cy.exec(
`npx ts-node --require tsconfig-paths/register ./cypress/support/create-user.ts "${email}"`
).then(({ stdout }) => {
const cookieValue = stdout
.replace(/.*<cookie>(?<cookieValue>.*)<\/cookie>.*/s, "$<cookieValue>")
.trim();
cy.setCookie("__session", cookieValue);
});
return cy.get("@user");
}

Expand All @@ -62,7 +62,9 @@ function cleanupUser({ email }: { email?: string } = {}) {
}

function deleteUserByEmail(email: string) {
cy.exec(`npx ts-node ./cypress/support/delete-user.ts "${email}"`);
cy.exec(
`npx ts-node --require tsconfig-paths/register ./cypress/support/delete-user.ts "${email}"`
);
cy.clearCookie("__session");
}

Expand Down

0 comments on commit d725c62

Please sign in to comment.