Skip to content

Ember integration breaks the ember test environment #1708

@oskarrough

Description

@oskarrough

Package + Version

  • @sentry/browser: 4.1.1
  • ember-cli: 3.4.5

Description

When the Sentry.Ember integration is added to a fresh project the tests will fail with:

ember-qunit: Ember.onerror validation: Ember.onerror is functioning properly
    ✘ Ember.onerror handler with invalid testing behavior detected. An Ember.onerror handler _must_ r
ethrow exceptions when `Ember.testing` is `true` or the test suite is unreliable. See https://git.io/
vbine for more details.

I followed https://docs.sentry.io/platforms/javascript/ember/ and did

// app/app.js
import * as Sentry from '@sentry/browser'

if (!ENV.environment === 'test') {
	Sentry.init({
		dsn: 'abc123',
		integrations: [new Sentry.Integrations.Ember()]
	})
}

To fix it, I added a conditional to not load sentry while testing.

import ENV from 'my-app/config/environment'
if (!ENV.environment === 'test') {
	Sentry.init({
		dsn: 'abc123',
		integrations: [new Sentry.Integrations.Ember()]
	})
}`

Should this be handled in the integration or just update the docs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions