Skip to content

Commit 9707e3d

Browse files
author
Luca Forstner
committed
test(e2e): Enable ESM loader test
1 parent 2c161f6 commit 9707e3d

File tree

7 files changed

+18
-21
lines changed

7 files changed

+18
-21
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ jobs:
10031003
'create-remix-app-express',
10041004
'create-remix-app-express-vite-dev',
10051005
'debug-id-sourcemaps',
1006-
# 'esm-loader-node-express-app', # This is currently broken for upstream reasons. See https://github.com/getsentry/sentry-javascript/pull/11338#issuecomment-2025450675
1006+
'esm-loader-node-express-app',
10071007
'nextjs-app-dir',
10081008
'nextjs-14',
10091009
'react-create-hash-router',

dev-packages/e2e-tests/test-applications/esm-loader-node-express-app/package.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,21 @@
22
"name": "node-express-app",
33
"version": "1.0.0",
44
"private": true,
5+
"type": "module",
56
"scripts": {
6-
"start": "node --import=@sentry/node/import-hook src/app.mjs",
7+
"start": "node --import=@sentry/node/import src/app.mjs",
78
"clean": "npx rimraf node_modules,pnpm-lock.yaml",
89
"test:build": "pnpm install",
910
"test:assert": "playwright test"
1011
},
1112
"dependencies": {
1213
"@sentry/node": "latest || *",
13-
"@sentry/types": "latest || *",
14-
"express": "4.19.2",
15-
"@types/express": "4.17.17",
16-
"@types/node": "18.15.1",
17-
"typescript": "4.9.5"
14+
"@sentry/opentelemetry": "latest || *",
15+
"express": "4.19.2"
1816
},
1917
"devDependencies": {
2018
"@sentry-internal/event-proxy-server": "link:../../../event-proxy-server",
21-
"@playwright/test": "^1.27.1",
22-
"ts-node": "10.9.1"
19+
"@playwright/test": "^1.27.1"
2320
},
2421
"volta": {
2522
"extends": "../../package.json",

dev-packages/e2e-tests/test-applications/esm-loader-node-express-app/playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const config: PlaywrightTestConfig = {
5353
/* Run your local dev server before starting the tests */
5454
webServer: [
5555
{
56-
command: 'pnpm ts-node-script start-event-proxy.ts',
56+
command: 'pnpm ts-node-script start-event-proxy.mjs',
5757
port: eventProxyPort,
5858
},
5959
{

dev-packages/e2e-tests/test-applications/esm-loader-node-express-app/src/app.mjs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
import * as Sentry from '@sentry/node';
2-
3-
Sentry.init({
4-
environment: 'qa', // dynamic sampling bias to keep transactions
5-
dsn: process.env.E2E_TEST_DSN,
6-
debug: true,
7-
tunnel: `http://localhost:3031/`, // proxy server
8-
tracesSampleRate: 1,
9-
});
1+
// @ts-check
102

3+
import * as Sentry from '@sentry/node';
114
import express from 'express';
125

136
const app = express();
@@ -36,7 +29,6 @@ app.get('/test-error', function (req, res) {
3629

3730
Sentry.setupExpressErrorHandler(app);
3831

39-
// @ts-ignore
4032
app.use(function onError(err, req, res, next) {
4133
// The error id is attached to `res.sentry` to be returned
4234
// and optionally displayed to the user for support.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import * as Sentry from '@sentry/node';
2+
3+
Sentry.init({
4+
environment: 'qa', // dynamic sampling bias to keep transactions
5+
dsn: process.env.E2E_TEST_DSN,
6+
debug: true,
7+
tunnel: `http://localhost:3031/`, // proxy server
8+
tracesSampleRate: 1,
9+
});

dev-packages/e2e-tests/test-applications/esm-loader-node-express-app/tests/server.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ test('Should record exceptions captured inside handlers', async ({ request }) =>
1313

1414
test('Should record a transaction for a parameterless route', async ({ request }) => {
1515
const transactionEventPromise = waitForTransaction('esm-loader-node-express-app', transactionEvent => {
16-
console.log('txn', transactionEvent.transaction);
1716
return transactionEvent?.transaction === 'GET /test-success';
1817
});
1918

0 commit comments

Comments
 (0)