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

test(browser): Port unhandledrejection tests to playwright #11758

Merged
merged 7 commits into from
Apr 24, 2024

Conversation

AbhiPrasad
Copy link
Member

ref #11084

This test ports packages/browser/test/integration/suites/onunhandledrejection.js playwright. Because of the same limitations as outlined with the on error tests #11666, I had to use calls to window.onunhandledrejection to simulate these tests instead of just using Promise.reject to test the handler.

#11678 tracks being able to fix this so we can avoid directly calling window.onunhandledrejection to test.

As onunhandledrejection.js was the last suite to use the old integration tests, I fully removed that code and the corresponding GH action workflow. I also removed the monorepo deps on karma, chai and sinon. Extremely satisfying.

@AbhiPrasad AbhiPrasad requested review from a team, mydea and stephanie-anderson and removed request for a team April 23, 2024 17:46
@AbhiPrasad AbhiPrasad self-assigned this Apr 23, 2024
@AbhiPrasad
Copy link
Member Author

$ node ./scripts/verify-packages-versions.js && lerna run build:transpile,build:types,build:bundle
/Users/abhijeetprasad/workspace/sentry-javascript/node_modules/gauge/lib/wide-truncate.js:3
var stripAnsi = require('strip-ansi')
                ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/abhijeetprasad/workspace/sentry-javascript/node_modules/strip-ansi/index.js from /Users/abhijeetprasad/workspace/sentry-javascript/node_modules/gauge/lib/wide-truncate.js not supported.
Instead change the require of index.js in /Users/abhijeetprasad/workspace/sentry-javascript/node_modules/gauge/lib/wide-truncate.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/Users/abhijeetprasad/workspace/sentry-javascript/node_modules/gauge/lib/wide-truncate.js:3:17)
    at Object.<anonymous> (/Users/abhijeetprasad/workspace/sentry-javascript/node_modules/gauge/lib/render-template.js:4:20)
    at Object.<anonymous> (/Users/abhijeetprasad/workspace/sentry-javascript/node_modules/gauge/lib/plumbing.js:3:22)
    at Object.<anonymous> (/Users/abhijeetprasad/workspace/sentry-javascript/node_modules/gauge/lib/index.js:2:16)
    at Object.<anonymous> (/Users/abhijeetprasad/workspace/sentry-javascript/node_modules/npmlog/lib/log.js:3:13)
    at Object.<anonymous> (/Users/abhijeetprasad/workspace/sentry-javascript/node_modules/lerna/dist/index.js:10846:31)
    at Object.<anonymous> (/Users/abhijeetprasad/workspace/sentry-javascript/node_modules/lerna/dist/cli.js:12:3) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v18.18.0

:(

@AbhiPrasad
Copy link
Member Author

Fixed ESM error with an explicit resolution 91023c8

Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty much a rubberstamp, but all looks good to me! 🚀

@AbhiPrasad AbhiPrasad merged commit 3eea537 into develop Apr 24, 2024
94 checks passed
@AbhiPrasad AbhiPrasad deleted the abhi-port-unhandledrejection-tests branch April 24, 2024 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants