Skip to content

Instantly share code, notes, and snippets.

@Antoine-lb
Antoine-lb / strapi-sentry-tracing-performance.md
Last active January 12, 2022 17:51
Add Sentry tracing/Performance to Strapi

strapi-plugin-sentry does not include the tracing/performance functionality, but this can be added by adding a middelware with the code provided in the Strapi Koa documentation (https://docs.sentry.io/platforms/node/guides/koa/#monitor-performance).

Before beginning make sure that you installed strapi-plugin-sentry and that it works (i.e. it logs the errors inside of the Sentry dashboard).

Create a middelware, but don't call it sentry, because there may be a problem with the plugin. I called mine stracing.

Inside of ./middlewares/stracing/index.js:

const {
@Antoine-lb
Antoine-lb / Testing-and-Mocking-Snippets-for-Strapi.md
Last active March 26, 2024 15:23
Testing and Mocking Snippets for Strapi

Testing/Mocking Snippets for Strapi

Simple test

This test is done by using Jest and Super Test. You can follow the Strapi Documentation to set it up, or you can install the community plugin strapi-plugin-testing.

it("should not create an order because request empty", async (done) => {
  await request(strapi.server)
    .post("/orders", { cart: 12 })
    .expect(400)
@Antoine-lb
Antoine-lb / .block
Created March 2, 2020 20:03 — forked from LemoNode/.block
Multiline chart
license: gpl-3.0