Skip to content

Jest starts throwing Jest encountered an unexpected token in Angular #9448

Closed
@timonmasberg

Description

@timonmasberg

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/angular-ivy

SDK Version

7.77.0

Framework Version

Angular 16.2

Link to Sentry event

No response

SDK Setup

No response

Steps to Reproduce

  1. Updating @sentry/angular-ivy to 7.77.0 (from 7.57.0)
  2. Running tests with jests where something is imported from @sentry/angular-ivy

You can use this branch to reproduce it.
You can see the error here in the pipeline.

Expected Result

The tests should work without any special modification to the Jest configuration (such as enabling experimental ESM support).

Actual Result

Running the jest test no throw an error:

...
/node_modules/@sentry/angular-ivy/sentry-angular-ivy.d.ts:5
    export * from './index';
    ^^^^^^
 SyntaxError: Unexpected token 'export'
...

Maybe this change introduced this behavior. Or perhaps I am missing something I could not find in the changes. Any idea why this might fail?

Metadata

Metadata

Assignees

Labels

Package: angularIssues related to the Sentry Angular SDK

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions