Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add support for cookie auth and request proxy in jest #59

Merged

Conversation

0x62
Copy link

@0x62 0x62 commented Sep 11, 2023

Previously all tests were run using password auth, which is fragile and can cause a lot of failures. This patch adds support for using cookie-based auth, as well as HTTPS request proxying while running tests.

The following environment variables should be configured to enable cookie auth and proxy:

TWITTER_COOKIES = [
  "twid=\"u=<ACCOUNT_ID>\"; Expires=XXX; Max-Age=157680000; Domain=twitter.com; Path=/; Secure",
  "auth_token=<ACCESS_TOKEN>; Expires=XXX; Max-Age=157680000; Domain=twitter.com; Path=/; Secure; HttpOnly"
]
PROXY_URL=https://<USERNAME>:<PASSWORD>@us.smartproxy.com:10001

Previously all tests were run using password auth, which is
fragile and causes a lot of failures. Tests now default to
using cookie-based auth with support for HTTP(S) proxying.
@karashiiro
Copy link
Collaborator

Mostly looks good, just a few minor things:

  • Merge conflicts 😢
  • test-utils.ts should be added to exclude here, I think? Otherwise, it'll be present in the published module when it doesn't need to be. You can verify that it works as expected by just deleting the build output and building again, and checking if there's a test-utils.js in the result (there shouldn't be).
  • package-lock.json should be added to the gitignore but that one's on me so don't worry about it, I'll deal with that and set up Corepack after merging.

@0x62
Copy link
Author

0x62 commented Sep 12, 2023

Should be sorted!

@karashiiro karashiiro merged commit 5984d92 into the-convocation:main Sep 12, 2023
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants