Skip to content

Commit

Permalink
remove esbuild-register for realz
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Mar 24, 2022
1 parent 89be8ec commit 477c7fe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
20 changes: 9 additions & 11 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(
`node --require esbuild-register ./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 ./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,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");
}

Expand Down
2 changes: 1 addition & 1 deletion cypress/support/create-user.ts
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion cypress/support/delete-user.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down

0 comments on commit 477c7fe

Please sign in to comment.