3.0.0 • Published 2 years ago

jest-sentry-environment v3.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

jest-sentry-environment

Adds Sentry performance monitoring to your jest test suites to find your slowest tests.

Sentry Example

Installation

First, you will need to add the jest-sentry-environment package to your application, as well as the Sentry SDKs.

npm install @sentry/node @sentry/tracing jest-sentry-environment

Then, in your jest configuration file, e.g. jest.config.js you will need to specify the path to the environment as well as some options.

{
  testEnvironment: 'jest-sentry-environment/jsdom', // or `jest-sentry-environment/node` for node environment
  testEnvironmentOptions: {
    sentryConfig: {
      // `init` will be passed to `Sentry.init()`
      init: {
        dsn: '<your DSN here>'
        environment: !!process.env.CI ? 'ci' : 'local',
        tracesSampleRate: 1.0,
      },

      transactionOptions: {
        // `tags` will be used for the test suite transaction
        tags: {
          branch: process.env.GITHUB_REF,
          commit: process.env.GITHUB_SHA,
        },
      },
    },
  },
}

You can either import the jsdom or node environments. You can also customize the base environment by specifying your own testEnvironment.

testEnvironment: './path/to/env.js',

In ./path/to/env.js:

const {createEnvironment} = require('jest-sentry-environment');

return createEnvironment({
  baseEnvironment: require('jest-environment-node'),
});
3.0.0

2 years ago

1.7.1

2 years ago

1.7.0

2 years ago

1.6.0

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.2.0

2 years ago

1.3.0

2 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.0-0

3 years ago

1.1.2

3 years ago

1.0.0

3 years ago