Wirepig helps you test software that relies on something over a network. If your code talks to any of the following, then wirepig can help: Wirepig sp

griffinmyers/wirepig

submited by
Style Pass
2023-03-16 17:30:04

Wirepig helps you test software that relies on something over a network. If your code talks to any of the following, then wirepig can help:

Wirepig spins up an HTTP or TCP server that can programmatically behave like your software's actual dependencies. Simply tell wirepig what kinds of requests to emulate and point your application at it. No monkey-patching the runtime, no external processes, no dependency injection, just honest-to-goodness sockets.

Alternatively, a tool like Wireshark can help you monitor all packets flowing between your application and wirepig, and might yield a clue.

Wirepig occupies a space similar to nock except instead of overriding node internals, wirepig operates as an independent server your application sends real requests to. Since you spin up wirepig in the same process as your tests, you still have programmatic control over it.

The wirepig API strives to offer every desirable feature in a simple package, often at the expense of terseness. For example, there's no built-in magic for handling JSON, even though it's an exceptionally common serialization format (there are some handy helpers, though). First and foremost, wirepig wants to be a strong foundation other projects can build on top of (for example, a redis-specific mocking library).

Leave a Comment
Related Posts