Skip to content

Commit

Permalink
test: add support for cookie auth and request proxy in jest
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
0x62 committed Sep 11, 2023
1 parent e9e1e8f commit 094700a
Show file tree
Hide file tree
Showing 10 changed files with 12,819 additions and 4,728 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,23 @@ const scraper = new Scraper({
});
```

## Testing
This package includes unit tests for all major functionality. Given the speed at which Twitter's private API
changes, failing tests are to be expected.

```sh
npm run test
```

Before running tests, you should configure environment variables for authentication.

```
TWITTER_USERNAME= # Account username
TWITTER_PASSWORD= # Account password
TWITTER_EMAIL= # Account email
TWITTER_COOKIES= # JSON-serialized array of cookies of an authenticated session
PROXY_URL= # HTTP(s) proxy for requests (optional)
```

## Contributing
We use [Conventional Commits](https://www.conventionalcommits.org), and enforce this with precommit checks.
Loading

0 comments on commit 094700a

Please sign in to comment.