Tuesday, 11 December, 2018 UTC


Summary

It’s that time of year again… The leaves have fallen from the trees, every department store is playing “All I Want for Christmas is You” on a loop, and I can finally justify wearing that hand-knit beanie I bought on Etsy (even though I live in California and wear it almost every single day anyway).
To celebrate, Sentry is highlighting twelve of our many partners with an ornament hung with care each day on our festive Sen-Tree. We hope you return every day to enjoy these GIFs with your holiday feast, egg nog, Manischewitz, pour-over artisan coffee, or pour-under artisan coffee.
Most developers agree that using Sentry is great for tracking and monitoring code errors and crashes. Sentry easily integrates into code, allowing you to control where and when to leave breadcrumbs and report the error just before everything crashes.
But what if you, like Wix, are working in a test-driven development (TDD) environment? You could use Sentry to reduce the noise and help you log errors offline. Again, just like Wix.
And that’s why our third featured partner is Wix.
Earlier this year, Wix introduced Wix Code. Wix Code empowers website creators to develop web applications and insert code into their own sites. By giving customers a complete development environment for client and server sides, Wix provides space to manipulate content and apply business logic.
While creating Wix Code, Wix developers found their Sentry reports overloaded with errors that are a natural byproduct of working in a TDD environment. In addition to this natural noise, users of Wix Code essentially add code along side Wix developers, resulting in Sentry reports that don’t paint an accurate picture of errors.
To solve this issue, they needed a test kit to intercept the sent items and determine if the errors were actually bugs that needed attention. Wix developers also needed every piece of context they could possibly get, including error information, the stack trace, and the event trail leading up to the crash.
Wix developers didn’t find a solution that met all of their requirements, so they got crafty and made their own: a public open source repository on GitHub, Raven-testkit. The API is simple and easy to use. In fact, we’ve found it so useful that we added it to our Tips & Tricks documentation. Installation is as quick as adding one line:
$ npm install raven-testkit --save-dev 
Then create a testkit instance and validate your reports against it:
import testKitInitializer from 'raven-testkit' const testKit = testKitInitializer(Raven) // any scenario that should call Raven.catchException(...) expect(testKit.reports()).to.have.lengthOf(1) const report = testKit.reports()[0] expect(report).to.have.property('release').to.equal('test') 
You can also pass your own shouldSendCallback logic.
const shouldSendCallback = data => { return /* your own logic */ } const testKit = testKitInitializer(Raven, shouldSendCallback) 
Additional API usage examples and updates can be found here.
Learn more about some of Sentry’s other various partners and integrations on our aptly named Integrations page.