From 513e42d9c69e8cd5d83ee6c33f9c7fdd5f68a944 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 18 Dec 2024 09:56:17 +0100 Subject: [PATCH] remove conditional test stuff --- .../node-integration-tests/package.json | 2 +- .../node-integration-tests/suites/anr/test.ts | 3 +-- .../suites/contextLines/test.ts | 3 +-- .../suites/esm/import-in-the-middle/test.ts | 3 +-- .../suites/esm/modules-integration/test.ts | 3 +-- .../suites/no-code/test.ts | 3 +-- .../suites/public-api/LocalVariables/test.ts | 2 +- .../suites/tracing/ai/test.ts | 3 +-- .../suites/tracing/prisma-orm/setup.ts | 18 ------------------ .../suites/tracing/prisma-orm/test.ts | 3 +-- .../tracing/requests/fetch-breadcrumbs/test.ts | 3 +-- .../tracing/requests/fetch-no-tracing/test.ts | 3 +-- .../fetch-sampled-no-active-span/test.ts | 3 +-- .../tracing/requests/fetch-unsampled/test.ts | 3 +-- .../tracing/requests/http-sampled-esm/test.ts | 3 +-- .../suites/tracing/tedious/test.ts | 3 +-- packages/nextjs/test/types/package.json | 2 +- packages/nextjs/test/types/test.ts | 12 ------------ 18 files changed, 16 insertions(+), 59 deletions(-) delete mode 100755 dev-packages/node-integration-tests/suites/tracing/prisma-orm/setup.ts delete mode 100644 packages/nextjs/test/types/test.ts diff --git a/dev-packages/node-integration-tests/package.json b/dev-packages/node-integration-tests/package.json index 25f5760632f2..4ad8ed2145aa 100644 --- a/dev-packages/node-integration-tests/package.json +++ b/dev-packages/node-integration-tests/package.json @@ -16,7 +16,7 @@ "build:types": "tsc -p tsconfig.types.json", "clean": "rimraf -g **/node_modules && run-p clean:script", "clean:script": "node scripts/clean.js", - "prisma:init": "(cd suites/tracing/prisma-orm && ts-node ./setup.ts)", + "prisma:init": "cd suites/tracing/prisma-orm && yarn && yarn setup", "lint": "eslint . --format stylish", "fix": "eslint . --format stylish --fix", "type-check": "tsc", diff --git a/dev-packages/node-integration-tests/suites/anr/test.ts b/dev-packages/node-integration-tests/suites/anr/test.ts index d1d9c684bf60..1366600d5280 100644 --- a/dev-packages/node-integration-tests/suites/anr/test.ts +++ b/dev-packages/node-integration-tests/suites/anr/test.ts @@ -1,5 +1,4 @@ import type { Event } from '@sentry/core'; -import { conditionalTest } from '../../utils'; import { cleanupChildProcesses, createRunner } from '../../utils/runner'; const ANR_EVENT = { @@ -107,7 +106,7 @@ const ANR_EVENT_WITH_DEBUG_META: Event = { }, }; -conditionalTest({ min: 16 })('should report ANR when event loop blocked', () => { +describe('should report ANR when event loop blocked', () => { afterAll(() => { cleanupChildProcesses(); }); diff --git a/dev-packages/node-integration-tests/suites/contextLines/test.ts b/dev-packages/node-integration-tests/suites/contextLines/test.ts index 1912f0b57f04..06591bcfbe8e 100644 --- a/dev-packages/node-integration-tests/suites/contextLines/test.ts +++ b/dev-packages/node-integration-tests/suites/contextLines/test.ts @@ -1,8 +1,7 @@ import { join } from 'path'; -import { conditionalTest } from '../../utils'; import { createRunner } from '../../utils/runner'; -conditionalTest({ min: 18 })('ContextLines integration in ESM', () => { +describe('ContextLines integration in ESM', () => { test('reads encoded context lines from filenames with spaces', done => { expect.assertions(1); const instrumentPath = join(__dirname, 'instrument.mjs'); diff --git a/dev-packages/node-integration-tests/suites/esm/import-in-the-middle/test.ts b/dev-packages/node-integration-tests/suites/esm/import-in-the-middle/test.ts index d1584c2ea32d..828ff702f45b 100644 --- a/dev-packages/node-integration-tests/suites/esm/import-in-the-middle/test.ts +++ b/dev-packages/node-integration-tests/suites/esm/import-in-the-middle/test.ts @@ -1,13 +1,12 @@ import { spawnSync } from 'child_process'; import { join } from 'path'; -import { conditionalTest } from '../../../utils'; import { cleanupChildProcesses } from '../../../utils/runner'; afterAll(() => { cleanupChildProcesses(); }); -conditionalTest({ min: 18 })('import-in-the-middle', () => { +describe('import-in-the-middle', () => { test('onlyIncludeInstrumentedModules', () => { const result = spawnSync('node', [join(__dirname, 'app.mjs')], { encoding: 'utf-8' }); expect(result.stderr).not.toMatch('should be the only hooked modules but we just hooked'); diff --git a/dev-packages/node-integration-tests/suites/esm/modules-integration/test.ts b/dev-packages/node-integration-tests/suites/esm/modules-integration/test.ts index 556ec1d52a57..eaee003781f3 100644 --- a/dev-packages/node-integration-tests/suites/esm/modules-integration/test.ts +++ b/dev-packages/node-integration-tests/suites/esm/modules-integration/test.ts @@ -1,11 +1,10 @@ -import { conditionalTest } from '../../../utils'; import { cleanupChildProcesses, createRunner } from '../../../utils/runner'; afterAll(() => { cleanupChildProcesses(); }); -conditionalTest({ min: 18 })('modulesIntegration', () => { +describe('modulesIntegration', () => { test('does not crash ESM setups', done => { createRunner(__dirname, 'app.mjs').ensureNoErrorOutput().start(done); }); diff --git a/dev-packages/node-integration-tests/suites/no-code/test.ts b/dev-packages/node-integration-tests/suites/no-code/test.ts index dfaae9de7cdc..fdcd5bd25fc6 100644 --- a/dev-packages/node-integration-tests/suites/no-code/test.ts +++ b/dev-packages/node-integration-tests/suites/no-code/test.ts @@ -1,4 +1,3 @@ -import { conditionalTest } from '../../utils'; import { cleanupChildProcesses, createRunner } from '../../utils/runner'; const EVENT = { @@ -25,7 +24,7 @@ describe('no-code init', () => { .start(done); }); - conditionalTest({ min: 18 })('--import', () => { + describe('--import', () => { test('ESM', done => { createRunner(__dirname, 'app.mjs') .withFlags('--import=@sentry/node/init') diff --git a/dev-packages/node-integration-tests/suites/public-api/LocalVariables/test.ts b/dev-packages/node-integration-tests/suites/public-api/LocalVariables/test.ts index 779b341d9f40..7ed9d352474a 100644 --- a/dev-packages/node-integration-tests/suites/public-api/LocalVariables/test.ts +++ b/dev-packages/node-integration-tests/suites/public-api/LocalVariables/test.ts @@ -37,7 +37,7 @@ const EXPECTED_LOCAL_VARIABLES_EVENT = { }, }; -conditionalTest({ min: 18 })('LocalVariables integration', () => { +describe('LocalVariables integration', () => { afterAll(() => { cleanupChildProcesses(); }); diff --git a/dev-packages/node-integration-tests/suites/tracing/ai/test.ts b/dev-packages/node-integration-tests/suites/tracing/ai/test.ts index e269f9da9db3..bc263e9fc610 100644 --- a/dev-packages/node-integration-tests/suites/tracing/ai/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/ai/test.ts @@ -1,8 +1,7 @@ -import { conditionalTest } from '../../../utils'; import { cleanupChildProcesses, createRunner } from '../../../utils/runner'; // `ai` SDK only support Node 18+ -conditionalTest({ min: 18 })('ai', () => { +describe('ai', () => { afterAll(() => { cleanupChildProcesses(); }); diff --git a/dev-packages/node-integration-tests/suites/tracing/prisma-orm/setup.ts b/dev-packages/node-integration-tests/suites/tracing/prisma-orm/setup.ts deleted file mode 100755 index a0052511b380..000000000000 --- a/dev-packages/node-integration-tests/suites/tracing/prisma-orm/setup.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { execSync } from 'child_process'; -import { parseSemver } from '@sentry/core'; - -const NODE_VERSION = parseSemver(process.versions.node); - -// Prisma v5 requires Node.js v16+ -// https://www.prisma.io/docs/orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-5#nodejs-minimum-version-change -if (NODE_VERSION.major && NODE_VERSION.major < 16) { - // eslint-disable-next-line no-console - console.warn(`Skipping Prisma tests on Node: ${NODE_VERSION.major}`); - process.exit(0); -} - -try { - execSync('yarn && yarn setup'); -} catch (_) { - process.exit(1); -} diff --git a/dev-packages/node-integration-tests/suites/tracing/prisma-orm/test.ts b/dev-packages/node-integration-tests/suites/tracing/prisma-orm/test.ts index dd92de5d0292..14cacdafb756 100644 --- a/dev-packages/node-integration-tests/suites/tracing/prisma-orm/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/prisma-orm/test.ts @@ -1,7 +1,6 @@ -import { conditionalTest } from '../../../utils'; import { createRunner } from '../../../utils/runner'; -conditionalTest({ min: 16 })('Prisma ORM Tests', () => { +describe('Prisma ORM Tests', () => { test('CJS - should instrument PostgreSQL queries from Prisma ORM', done => { const EXPECTED_TRANSACTION = { transaction: 'Test Transaction', diff --git a/dev-packages/node-integration-tests/suites/tracing/requests/fetch-breadcrumbs/test.ts b/dev-packages/node-integration-tests/suites/tracing/requests/fetch-breadcrumbs/test.ts index c0d783aaa594..254d197c85c3 100644 --- a/dev-packages/node-integration-tests/suites/tracing/requests/fetch-breadcrumbs/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/requests/fetch-breadcrumbs/test.ts @@ -1,8 +1,7 @@ -import { conditionalTest } from '../../../../utils'; import { createRunner } from '../../../../utils/runner'; import { createTestServer } from '../../../../utils/server'; -conditionalTest({ min: 18 })('outgoing fetch', () => { +describe('outgoing fetch', () => { test('outgoing fetch requests create breadcrumbs', done => { createTestServer(done) .start() diff --git a/dev-packages/node-integration-tests/suites/tracing/requests/fetch-no-tracing/test.ts b/dev-packages/node-integration-tests/suites/tracing/requests/fetch-no-tracing/test.ts index 9c732d899cde..906fa6541dd6 100644 --- a/dev-packages/node-integration-tests/suites/tracing/requests/fetch-no-tracing/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/requests/fetch-no-tracing/test.ts @@ -1,8 +1,7 @@ -import { conditionalTest } from '../../../../utils'; import { createRunner } from '../../../../utils/runner'; import { createTestServer } from '../../../../utils/server'; -conditionalTest({ min: 18 })('outgoing fetch', () => { +describe('outgoing fetch', () => { test('outgoing fetch requests are correctly instrumented with tracing disabled', done => { expect.assertions(11); diff --git a/dev-packages/node-integration-tests/suites/tracing/requests/fetch-sampled-no-active-span/test.ts b/dev-packages/node-integration-tests/suites/tracing/requests/fetch-sampled-no-active-span/test.ts index fde1c787829a..afe60d27b22a 100644 --- a/dev-packages/node-integration-tests/suites/tracing/requests/fetch-sampled-no-active-span/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/requests/fetch-sampled-no-active-span/test.ts @@ -1,8 +1,7 @@ -import { conditionalTest } from '../../../../utils'; import { createRunner } from '../../../../utils/runner'; import { createTestServer } from '../../../../utils/server'; -conditionalTest({ min: 18 })('outgoing fetch', () => { +describe('outgoing fetch', () => { test('outgoing sampled fetch requests without active span are correctly instrumented', done => { expect.assertions(11); diff --git a/dev-packages/node-integration-tests/suites/tracing/requests/fetch-unsampled/test.ts b/dev-packages/node-integration-tests/suites/tracing/requests/fetch-unsampled/test.ts index d288e9a03fbf..cb85ca98ca0b 100644 --- a/dev-packages/node-integration-tests/suites/tracing/requests/fetch-unsampled/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/requests/fetch-unsampled/test.ts @@ -1,8 +1,7 @@ -import { conditionalTest } from '../../../../utils'; import { createRunner } from '../../../../utils/runner'; import { createTestServer } from '../../../../utils/server'; -conditionalTest({ min: 18 })('outgoing fetch', () => { +describe('outgoing fetch', () => { test('outgoing fetch requests are correctly instrumented when not sampled', done => { expect.assertions(11); diff --git a/dev-packages/node-integration-tests/suites/tracing/requests/http-sampled-esm/test.ts b/dev-packages/node-integration-tests/suites/tracing/requests/http-sampled-esm/test.ts index 72f625aedeb7..f3d58877c8f3 100644 --- a/dev-packages/node-integration-tests/suites/tracing/requests/http-sampled-esm/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/requests/http-sampled-esm/test.ts @@ -1,9 +1,8 @@ import { join } from 'path'; -import { conditionalTest } from '../../../../utils'; import { createRunner } from '../../../../utils/runner'; import { createTestServer } from '../../../../utils/server'; -conditionalTest({ min: 18 })('outgoing http in ESM', () => { +describe('outgoing http in ESM', () => { test('outgoing sampled http requests are correctly instrumented in ESM', done => { expect.assertions(11); diff --git a/dev-packages/node-integration-tests/suites/tracing/tedious/test.ts b/dev-packages/node-integration-tests/suites/tracing/tedious/test.ts index c4a0ae29fe38..6c5fd17f833a 100644 --- a/dev-packages/node-integration-tests/suites/tracing/tedious/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/tedious/test.ts @@ -1,11 +1,10 @@ -import { conditionalTest } from '../../../utils'; import { cleanupChildProcesses, createRunner } from '../../../utils/runner'; jest.setTimeout(75000); // Tedious version we are testing against only supports Node 18+ // https://github.com/tediousjs/tedious/blob/8310c455a2cc1cba83c1ca3c16677da4f83e12a9/package.json#L38 -conditionalTest({ min: 18 })('tedious auto instrumentation', () => { +describe('tedious auto instrumentation', () => { afterAll(() => { cleanupChildProcesses(); }); diff --git a/packages/nextjs/test/types/package.json b/packages/nextjs/test/types/package.json index 86f74bfe060a..a3df1aed6d76 100644 --- a/packages/nextjs/test/types/package.json +++ b/packages/nextjs/test/types/package.json @@ -1,7 +1,7 @@ { "description": "This is used to install the nextjs v12 so we can test against those types", "scripts": { - "test": "ts-node test.ts" + "test": "yarn && yarn tsc --noEmit --project tsconfig.json" }, "dependencies": { "next": "13.2.0" diff --git a/packages/nextjs/test/types/test.ts b/packages/nextjs/test/types/test.ts deleted file mode 100644 index f9f45d29f29b..000000000000 --- a/packages/nextjs/test/types/test.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { execSync } from 'child_process'; -/* eslint-disable no-console */ -import { parseSemver } from '@sentry/core'; - -const NODE_VERSION = parseSemver(process.versions.node); - -if (NODE_VERSION.major && NODE_VERSION.major >= 12) { - console.log('Installing next@v12...'); - execSync('yarn install', { stdio: 'inherit' }); - console.log('Testing some types...'); - execSync('tsc --noEmit --project tsconfig.json', { stdio: 'inherit' }); -}