Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: v1.15.0 Causes Consumers Jest Tests To Fail #459

Open
ckifer opened this issue Oct 10, 2023 · 2 comments
Open

[Bug]: v1.15.0 Causes Consumers Jest Tests To Fail #459

ckifer opened this issue Oct 10, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@ckifer
Copy link
Contributor

ckifer commented Oct 10, 2023

Which web client version did you detect this bug with?

v1.15.0

What environment (build systems, module system, and framework) did you detect this bug with?

TypeScript v5.0.2, Webpack v4.46.0, ECMAScript modules (ESM) and React v17.1

Is your web application a single page application (SPA) or multi page application (MPA)?

SPA

Please provide your web client configuration

{
allowCookies: true,
endpoint: "https://dataplane.rum.us-west-2.amazonaws.com",
guestRoleArn: "arn:aws:iam::000000000000:role/RUM-Monitor-us-west-2-000000000000-00xx-Unauth",
identityPoolId: "us-west-2:00000000-0000-0000-0000-000000000000",
sessionSampleRate: 1,
telemetries: ['errors', 'performance', 'http']
}

Please describe the bug/issue

Previous to v1.15.0 running Jest tests in places that import from aws-rum-web worked well, but after upgrading they begin to fail with esm import errors.

Important bits:

    Details:

    ......./node_modules/aws-rum-web/node_modules/web-vitals/attribution.js:18
    export * from './dist/web-vitals.attribution.js';
    ^^^^^^

    SyntaxError: Unexpected token 'export'

    > 1 | import { AwsRum, AwsRumConfig } from 'aws-rum-web';
        | ^
      2 |
      3 | export let rum: AwsRum;
      4 |

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1728:14)
      at Object.<anonymous> (node_modules/aws-rum-web/dist/cjs/plugins/event-plugins/WebVitalsPlugin.js:20:21)
      at Object.<anonymous> (node_modules/aws-rum-web/dist/cjs/orchestration/Orchestration.js:44:25)
      at Object.<anonymous> (node_modules/aws-rum-web/dist/cjs/index.js:18:23)
      at Object.<anonymous> (src/config/rumConfig.ts:1:1)

Issue seems to be here v1.14.1...v1.15.0#diff-7f9eb043b568ee17c6e1abb8ce54754a6f6a1571604e94509f756b5a751a6e1c with the import from webvitals/attribution. Where just importing from webvitals works, webvitals/attribution does not.

@ckifer
Copy link
Contributor Author

ckifer commented Oct 10, 2023

Reproduction:

Download this https://codesandbox.io/s/react-jest-typescript-forked-pqh4vx
File -> Export to Zip
npm install
npm test
see failure

@ckifer
Copy link
Contributor Author

ckifer commented Oct 10, 2023

Solution in jest config:

   "transformIgnorePatterns": [
      "/node_modules/(?!web-vitals)"
    ]

Unfortunately this is a breaking change under certain circumstances

@qhanam qhanam added the bug Something isn't working label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants