From fb2fbd34b0ab9d6304e1353e7ece4991146e3ab6 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Thu, 12 Dec 2024 12:06:36 +0000 Subject: [PATCH] clean up e2e --- .../node-profiling/{build.mjs => build-cjs.mjs} | 2 +- .../{build.shimmed.mjs => build-esm.mjs} | 12 +----------- .../test-applications/node-profiling/index.mjs | 4 ++-- .../test-applications/node-profiling/package.json | 4 ++-- 4 files changed, 6 insertions(+), 16 deletions(-) rename dev-packages/e2e-tests/test-applications/node-profiling/{build.mjs => build-cjs.mjs} (96%) rename dev-packages/e2e-tests/test-applications/node-profiling/{build.shimmed.mjs => build-esm.mjs} (68%) diff --git a/dev-packages/e2e-tests/test-applications/node-profiling/build.mjs b/dev-packages/e2e-tests/test-applications/node-profiling/build-cjs.mjs similarity index 96% rename from dev-packages/e2e-tests/test-applications/node-profiling/build.mjs rename to dev-packages/e2e-tests/test-applications/node-profiling/build-cjs.mjs index 55ec0b5fae52..3fadfaad42fe 100644 --- a/dev-packages/e2e-tests/test-applications/node-profiling/build.mjs +++ b/dev-packages/e2e-tests/test-applications/node-profiling/build-cjs.mjs @@ -11,7 +11,7 @@ console.log('Running build using esbuild version', esbuild.version); esbuild.buildSync({ platform: 'node', entryPoints: ['./index.ts'], - outdir: './dist', + outfile: './dist/cjs/index.js', target: 'esnext', format: 'cjs', bundle: true, diff --git a/dev-packages/e2e-tests/test-applications/node-profiling/build.shimmed.mjs b/dev-packages/e2e-tests/test-applications/node-profiling/build-esm.mjs similarity index 68% rename from dev-packages/e2e-tests/test-applications/node-profiling/build.shimmed.mjs rename to dev-packages/e2e-tests/test-applications/node-profiling/build-esm.mjs index c45e30539bc0..397c1b468091 100644 --- a/dev-packages/e2e-tests/test-applications/node-profiling/build.shimmed.mjs +++ b/dev-packages/e2e-tests/test-applications/node-profiling/build-esm.mjs @@ -11,19 +11,9 @@ console.log('Running build using esbuild version', esbuild.version); esbuild.buildSync({ platform: 'node', entryPoints: ['./index.ts'], - outfile: './dist/index.shimmed.mjs', + outfile: './dist/esm/index.mjs', target: 'esnext', format: 'esm', bundle: true, loader: { '.node': 'copy' }, - banner: { - js: ` - import { dirname } from 'node:path'; - import { fileURLToPath } from 'node:url'; - import { createRequire } from 'node:module'; - const require = createRequire(import.meta.url); - const __filename = fileURLToPath(import.meta.url); - const __dirname = dirname(__filename); - `, - }, }); diff --git a/dev-packages/e2e-tests/test-applications/node-profiling/index.mjs b/dev-packages/e2e-tests/test-applications/node-profiling/index.mjs index 71608ef53260..bd178eb0f716 100644 --- a/dev-packages/e2e-tests/test-applications/node-profiling/index.mjs +++ b/dev-packages/e2e-tests/test-applications/node-profiling/index.mjs @@ -8,7 +8,7 @@ console.log('🧵 Starting ESM test'); const wait = ms => new Promise(resolve => setTimeout(resolve, ms)); -function assertUnpatechedRequire() { +function assertUnpatchedRequire() { if (typeof require !== 'undefined') { // Test that globalThis.require is not defined by any side effects of the profiling // https://github.com/getsentry/sentry-javascript/issues/13662 @@ -30,5 +30,5 @@ Sentry.startSpan({ name: 'Precompile test' }, async () => { await wait(500); }); -assertUnpatechedRequire(); +assertUnpatchedRequire(); console.log('✅ Require is not patched'); diff --git a/dev-packages/e2e-tests/test-applications/node-profiling/package.json b/dev-packages/e2e-tests/test-applications/node-profiling/package.json index 2029ac1370ed..0711c9b4baaa 100644 --- a/dev-packages/e2e-tests/test-applications/node-profiling/package.json +++ b/dev-packages/e2e-tests/test-applications/node-profiling/package.json @@ -4,8 +4,8 @@ "private": true, "scripts": { "typecheck": "tsc --noEmit", - "build": "node build.mjs && node build.shimmed.mjs", - "test": "node dist/index.js && node --experimental-require-module dist/index.js && node dist/index.shimmed.mjs", + "build": "node build-cjs.mjs && node build-esm.mjs", + "test": "node dist/index.js && node --experimental-require-module dist/cjs/index.js && node dist/esm/index.mjs", "clean": "npx rimraf node_modules dist", "test:electron": "$(pnpm bin)/electron-rebuild && playwright test", "test:build": "pnpm run typecheck && pnpm run build",