diff --git a/.craft.yml b/.craft.yml index 66fc8fca329c..2ee55c49d35d 100644 --- a/.craft.yml +++ b/.craft.yml @@ -97,6 +97,9 @@ targets: - name: npm id: '@sentry/bun' includeNames: /^sentry-bun-\d.*\.tgz$/ + - name: npm + id: '@sentry/nestjs' + includeNames: /^sentry-nestjs-\d.*\.tgz$/ ## 6. Fullstack/Meta Frameworks (depending on Node and Browser or Framework SDKs) - name: npm diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8505ab3a022..445c57284056 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1067,7 +1067,7 @@ jobs: 'generic-ts3.8', 'node-fastify', 'node-hapi', - 'node-nestjs', + 'nestjs', 'node-exports-test-app', 'node-koa', 'node-connect', diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/.gitignore b/dev-packages/e2e-tests/test-applications/nestjs/.gitignore similarity index 100% rename from dev-packages/e2e-tests/test-applications/node-nestjs/.gitignore rename to dev-packages/e2e-tests/test-applications/nestjs/.gitignore diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/.npmrc b/dev-packages/e2e-tests/test-applications/nestjs/.npmrc similarity index 100% rename from dev-packages/e2e-tests/test-applications/node-nestjs/.npmrc rename to dev-packages/e2e-tests/test-applications/nestjs/.npmrc diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/nest-cli.json b/dev-packages/e2e-tests/test-applications/nestjs/nest-cli.json similarity index 100% rename from dev-packages/e2e-tests/test-applications/node-nestjs/nest-cli.json rename to dev-packages/e2e-tests/test-applications/nestjs/nest-cli.json diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/package.json b/dev-packages/e2e-tests/test-applications/nestjs/package.json similarity index 95% rename from dev-packages/e2e-tests/test-applications/node-nestjs/package.json rename to dev-packages/e2e-tests/test-applications/nestjs/package.json index c21b312d1c13..6ad2576fc3cc 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs/package.json +++ b/dev-packages/e2e-tests/test-applications/nestjs/package.json @@ -1,5 +1,5 @@ { - "name": "node-nestjs", + "name": "nestjs", "version": "0.0.1", "private": true, "scripts": { @@ -18,7 +18,7 @@ "@nestjs/common": "^10.0.0", "@nestjs/core": "^10.0.0", "@nestjs/platform-express": "^10.0.0", - "@sentry/node": "latest || *", + "@sentry/nestjs": "latest || *", "@sentry/types": "latest || *", "reflect-metadata": "^0.2.0", "rxjs": "^7.8.1" diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/nestjs/playwright.config.mjs similarity index 100% rename from dev-packages/e2e-tests/test-applications/node-nestjs/playwright.config.mjs rename to dev-packages/e2e-tests/test-applications/nestjs/playwright.config.mjs diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/src/app.controller.ts b/dev-packages/e2e-tests/test-applications/nestjs/src/app.controller.ts similarity index 100% rename from dev-packages/e2e-tests/test-applications/node-nestjs/src/app.controller.ts rename to dev-packages/e2e-tests/test-applications/nestjs/src/app.controller.ts diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/src/app.module.ts b/dev-packages/e2e-tests/test-applications/nestjs/src/app.module.ts similarity index 100% rename from dev-packages/e2e-tests/test-applications/node-nestjs/src/app.module.ts rename to dev-packages/e2e-tests/test-applications/nestjs/src/app.module.ts diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/src/app.service.ts b/dev-packages/e2e-tests/test-applications/nestjs/src/app.service.ts similarity index 97% rename from dev-packages/e2e-tests/test-applications/node-nestjs/src/app.service.ts rename to dev-packages/e2e-tests/test-applications/nestjs/src/app.service.ts index 79b01f26f51c..01a96549546b 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs/src/app.service.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs/src/app.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@nestjs/common'; -import * as Sentry from '@sentry/node'; +import * as Sentry from '@sentry/nestjs'; import { makeHttpRequest } from './utils'; @Injectable() diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/src/instrument.ts b/dev-packages/e2e-tests/test-applications/nestjs/src/instrument.ts similarity index 86% rename from dev-packages/e2e-tests/test-applications/node-nestjs/src/instrument.ts rename to dev-packages/e2e-tests/test-applications/nestjs/src/instrument.ts index 09376810454f..b5ca047e497c 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs/src/instrument.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs/src/instrument.ts @@ -1,4 +1,4 @@ -import * as Sentry from '@sentry/node'; +import * as Sentry from '@sentry/nestjs'; Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/src/main.ts b/dev-packages/e2e-tests/test-applications/nestjs/src/main.ts similarity index 93% rename from dev-packages/e2e-tests/test-applications/node-nestjs/src/main.ts rename to dev-packages/e2e-tests/test-applications/nestjs/src/main.ts index 39bfec94b507..c2682662154d 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs/src/main.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs/src/main.ts @@ -3,7 +3,7 @@ import './instrument'; // Import other modules import { BaseExceptionFilter, HttpAdapterHost, NestFactory } from '@nestjs/core'; -import * as Sentry from '@sentry/node'; +import * as Sentry from '@sentry/nestjs'; import { AppModule1, AppModule2 } from './app.module'; const app1Port = 3030; diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/src/utils.ts b/dev-packages/e2e-tests/test-applications/nestjs/src/utils.ts similarity index 100% rename from dev-packages/e2e-tests/test-applications/node-nestjs/src/utils.ts rename to dev-packages/e2e-tests/test-applications/nestjs/src/utils.ts diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/nestjs/start-event-proxy.mjs similarity index 76% rename from dev-packages/e2e-tests/test-applications/node-nestjs/start-event-proxy.mjs rename to dev-packages/e2e-tests/test-applications/nestjs/start-event-proxy.mjs index 3714932358a5..e9917b9273da 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs/start-event-proxy.mjs +++ b/dev-packages/e2e-tests/test-applications/nestjs/start-event-proxy.mjs @@ -2,5 +2,5 @@ import { startEventProxyServer } from '@sentry-internal/test-utils'; startEventProxyServer({ port: 3031, - proxyServerName: 'node-nestjs', + proxyServerName: 'nestjs', }); diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/nestjs/tests/errors.test.ts similarity index 93% rename from dev-packages/e2e-tests/test-applications/node-nestjs/tests/errors.test.ts rename to dev-packages/e2e-tests/test-applications/nestjs/tests/errors.test.ts index 40ed8e49718a..aa46f77815d4 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs/tests/errors.test.ts @@ -2,7 +2,7 @@ import { expect, test } from '@playwright/test'; import { waitForError } from '@sentry-internal/test-utils'; test('Sends exception to Sentry', async ({ baseURL }) => { - const errorEventPromise = waitForError('node-nestjs', event => { + const errorEventPromise = waitForError('nestjs', event => { return !event.type && event.exception?.values?.[0]?.value === 'This is an exception with id 123'; }); diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/tests/propagation.test.ts b/dev-packages/e2e-tests/test-applications/nestjs/tests/propagation.test.ts similarity index 94% rename from dev-packages/e2e-tests/test-applications/node-nestjs/tests/propagation.test.ts rename to dev-packages/e2e-tests/test-applications/nestjs/tests/propagation.test.ts index d100b725283f..2922435c542b 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs/tests/propagation.test.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs/tests/propagation.test.ts @@ -6,14 +6,14 @@ import { SpanJSON } from '@sentry/types'; test('Propagates trace for outgoing http requests', async ({ baseURL }) => { const id = crypto.randomUUID(); - const inboundTransactionPromise = waitForTransaction('node-nestjs', transactionEvent => { + const inboundTransactionPromise = waitForTransaction('nestjs', transactionEvent => { return ( transactionEvent.contexts?.trace?.op === 'http.server' && transactionEvent.contexts?.trace?.data?.['http.target'] === `/test-inbound-headers/${id}` ); }); - const outboundTransactionPromise = waitForTransaction('node-nestjs', transactionEvent => { + const outboundTransactionPromise = waitForTransaction('nestjs', transactionEvent => { return ( transactionEvent.contexts?.trace?.op === 'http.server' && transactionEvent.contexts?.trace?.data?.['http.target'] === `/test-outgoing-http/${id}` @@ -121,14 +121,14 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => { test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => { const id = crypto.randomUUID(); - const inboundTransactionPromise = waitForTransaction('node-nestjs', transactionEvent => { + const inboundTransactionPromise = waitForTransaction('nestjs', transactionEvent => { return ( transactionEvent?.contexts?.trace?.op === 'http.server' && transactionEvent.contexts?.trace?.data?.['http.target'] === `/test-inbound-headers/${id}` ); }); - const outboundTransactionPromise = waitForTransaction('node-nestjs', transactionEvent => { + const outboundTransactionPromise = waitForTransaction('nestjs', transactionEvent => { return ( transactionEvent?.contexts?.trace?.op === 'http.server' && transactionEvent.contexts?.trace?.data?.['http.target'] === `/test-outgoing-fetch/${id}` @@ -234,7 +234,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => { }); test('Propagates trace for outgoing external http requests', async ({ baseURL }) => { - const inboundTransactionPromise = waitForTransaction('node-nestjs', transactionEvent => { + const inboundTransactionPromise = waitForTransaction('nestjs', transactionEvent => { return ( transactionEvent?.contexts?.trace?.op === 'http.server' && transactionEvent.contexts?.trace?.data?.['http.target'] === `/test-outgoing-http-external-allowed` @@ -271,7 +271,7 @@ test('Propagates trace for outgoing external http requests', async ({ baseURL }) }); test('Does not propagate outgoing http requests not covered by tracePropagationTargets', async ({ baseURL }) => { - const inboundTransactionPromise = waitForTransaction('node-nestjs', transactionEvent => { + const inboundTransactionPromise = waitForTransaction('nestjs', transactionEvent => { return ( transactionEvent?.contexts?.trace?.op === 'http.server' && transactionEvent.contexts?.trace?.data?.['http.target'] === `/test-outgoing-http-external-disallowed` @@ -295,7 +295,7 @@ test('Does not propagate outgoing http requests not covered by tracePropagationT }); test('Propagates trace for outgoing external fetch requests', async ({ baseURL }) => { - const inboundTransactionPromise = waitForTransaction('node-nestjs', transactionEvent => { + const inboundTransactionPromise = waitForTransaction('nestjs', transactionEvent => { return ( transactionEvent?.contexts?.trace?.op === 'http.server' && transactionEvent.contexts?.trace?.data?.['http.target'] === `/test-outgoing-fetch-external-allowed` @@ -332,7 +332,7 @@ test('Propagates trace for outgoing external fetch requests', async ({ baseURL } }); test('Does not propagate outgoing fetch requests not covered by tracePropagationTargets', async ({ baseURL }) => { - const inboundTransactionPromise = waitForTransaction('node-nestjs', transactionEvent => { + const inboundTransactionPromise = waitForTransaction('nestjs', transactionEvent => { return ( transactionEvent?.contexts?.trace?.op === 'http.server' && transactionEvent.contexts?.trace?.data?.['http.target'] === `/test-outgoing-fetch-external-disallowed` diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/nestjs/tests/transactions.test.ts similarity index 97% rename from dev-packages/e2e-tests/test-applications/node-nestjs/tests/transactions.test.ts rename to dev-packages/e2e-tests/test-applications/nestjs/tests/transactions.test.ts index 593c5e383f2b..22cb0f8e6a8c 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs/tests/transactions.test.ts @@ -2,7 +2,7 @@ import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; test('Sends an API route transaction', async ({ baseURL }) => { - const pageloadTransactionEventPromise = waitForTransaction('node-nestjs', transactionEvent => { + const pageloadTransactionEventPromise = waitForTransaction('nestjs', transactionEvent => { return ( transactionEvent?.contexts?.trace?.op === 'http.server' && transactionEvent?.transaction === 'GET /test-transaction' diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/tsconfig.build.json b/dev-packages/e2e-tests/test-applications/nestjs/tsconfig.build.json similarity index 100% rename from dev-packages/e2e-tests/test-applications/node-nestjs/tsconfig.build.json rename to dev-packages/e2e-tests/test-applications/nestjs/tsconfig.build.json diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs/tsconfig.json b/dev-packages/e2e-tests/test-applications/nestjs/tsconfig.json similarity index 100% rename from dev-packages/e2e-tests/test-applications/node-nestjs/tsconfig.json rename to dev-packages/e2e-tests/test-applications/nestjs/tsconfig.json diff --git a/dev-packages/e2e-tests/verdaccio-config/config.yaml b/dev-packages/e2e-tests/verdaccio-config/config.yaml index 26dfeb85e506..5f77ba7cccea 100644 --- a/dev-packages/e2e-tests/verdaccio-config/config.yaml +++ b/dev-packages/e2e-tests/verdaccio-config/config.yaml @@ -80,6 +80,12 @@ packages: unpublish: $all # proxy: npmjs # Don't proxy for E2E tests! + '@sentry/nestjs': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + '@sentry/nextjs': access: $all publish: $all diff --git a/package.json b/package.json index 43891c4ef0cf..eab00cafbd18 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "packages/gatsby", "packages/google-cloud-serverless", "packages/integration-shims", + "packages/nestjs", "packages/nextjs", "packages/node", "packages/nuxt", diff --git a/packages/nestjs/.eslintrc.js b/packages/nestjs/.eslintrc.js new file mode 100644 index 000000000000..fdb9952bae52 --- /dev/null +++ b/packages/nestjs/.eslintrc.js @@ -0,0 +1,6 @@ +module.exports = { + env: { + node: true, + }, + extends: ['../../.eslintrc.js'], +}; diff --git a/packages/nestjs/LICENSE b/packages/nestjs/LICENSE new file mode 100644 index 000000000000..63e7eb28e19c --- /dev/null +++ b/packages/nestjs/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Functional Software, Inc. dba Sentry + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/nestjs/README.md b/packages/nestjs/README.md new file mode 100644 index 000000000000..58ab6bc95372 --- /dev/null +++ b/packages/nestjs/README.md @@ -0,0 +1,43 @@ +

+ + Sentry + +

+ +# Official Sentry SDK for NestJS (EXPERIMENTAL) + +[![npm version](https://img.shields.io/npm/v/@sentry/nestjs.svg)](https://www.npmjs.com/package/@sentry/nestjs) +[![npm dm](https://img.shields.io/npm/dm/@sentry/nestjs.svg)](https://www.npmjs.com/package/@sentry/nestjs) +[![npm dt](https://img.shields.io/npm/dt/@sentry/nestjs.svg)](https://www.npmjs.com/package/@sentry/nestjs) + +This SDK is considered **experimental and in an alpha state**. It may experience breaking changes. Please reach out on +[GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose) if you have any feedback or concerns. + +## Installation + +```bash +npm install @sentry/nestjs + +# Or yarn +yarn add @sentry/nestjs +``` + +## Usage + +```js +// CJS Syntax +const Sentry = require('@sentry/nestjs'); +// ESM Syntax +import * as Sentry from '@sentry/nestjs'; + +Sentry.init({ + dsn: '__DSN__', + // ... +}); +``` + +Note that it is necessary to initialize Sentry **before you import any package that may be instrumented by us**. + +## Links + +- [Official SDK Docs](https://docs.sentry.io/platforms/javascript/guides/nestjs/) diff --git a/packages/nestjs/package.json b/packages/nestjs/package.json new file mode 100644 index 000000000000..c51263c1fc2a --- /dev/null +++ b/packages/nestjs/package.json @@ -0,0 +1,71 @@ +{ + "name": "@sentry/nestjs", + "version": "8.12.0", + "description": "Official Sentry SDK for NestJS", + "repository": "git://github.com/getsentry/sentry-javascript.git", + "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/nestjs", + "author": "Sentry", + "license": "MIT", + "engines": { + "node": ">=16" + }, + "files": [ + "/build", + "LICENSE", + "README.md" + ], + "main": "build/cjs/nestjs/index.js", + "module": "build/esm/nestjs/index.js", + "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/types/index.d.ts", + "default": "./build/esm/index.js" + }, + "require": { + "types": "./build/types/index.d.ts", + "default": "./build/cjs/index.js" + } + } + }, + "typesVersions": { + "<4.9": { + "build/types/index.d.ts": [ + "build/types-ts3.8/index.d.ts" + ] + } + }, + "publishConfig": { + "access": "public" + }, + "dependencies": { + "@sentry/core": "8.12.0", + "@sentry/node": "8.12.0" + }, + "scripts": { + "build": "run-p build:transpile build:types", + "build:dev": "yarn build", + "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:types": "run-s build:types:core build:types:downlevel", + "build:types:core": "tsc -p tsconfig.types.json", + "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", + "build:watch": "run-p build:transpile:watch build:types:watch", + "build:dev:watch": "yarn build:watch", + "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", + "build:types:watch": "tsc -p tsconfig.types.json --watch", + "build:tarball": "npm pack", + "circularDepCheck": "madge --circular src/index.ts", + "clean": "rimraf build coverage sentry-node-*.tgz", + "fix": "eslint . --format stylish --fix", + "lint": "eslint . --format stylish", + "test": "vitest run", + "test:watch": "vitest --watch", + "yalc:publish": "yalc publish --push --sig" + }, + "volta": { + "extends": "../../package.json" + }, + "sideEffects": false +} diff --git a/packages/nestjs/rollup.npm.config.mjs b/packages/nestjs/rollup.npm.config.mjs new file mode 100644 index 000000000000..84a06f2fb64a --- /dev/null +++ b/packages/nestjs/rollup.npm.config.mjs @@ -0,0 +1,3 @@ +import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; + +export default makeNPMConfigVariants(makeBaseNPMConfig()); diff --git a/packages/nestjs/src/index.ts b/packages/nestjs/src/index.ts new file mode 100644 index 000000000000..6ac8d97b4241 --- /dev/null +++ b/packages/nestjs/src/index.ts @@ -0,0 +1,3 @@ +export * from '@sentry/node'; + +export { init } from './sdk'; diff --git a/packages/nestjs/src/sdk.ts b/packages/nestjs/src/sdk.ts new file mode 100644 index 000000000000..8d5ca21b1706 --- /dev/null +++ b/packages/nestjs/src/sdk.ts @@ -0,0 +1,16 @@ +import { applySdkMetadata } from '@sentry/core'; +import type { NodeClient, NodeOptions } from '@sentry/node'; +import { init as nodeInit } from '@sentry/node'; + +/** + * Initializes the NestJS SDK + */ +export function init(options: NodeOptions | undefined = {}): NodeClient | undefined { + const opts: NodeOptions = { + ...options, + }; + + applySdkMetadata(opts, 'nestjs'); + + return nodeInit(opts); +} diff --git a/packages/nestjs/test/sdk.test.ts b/packages/nestjs/test/sdk.test.ts new file mode 100644 index 000000000000..c6bf7166444d --- /dev/null +++ b/packages/nestjs/test/sdk.test.ts @@ -0,0 +1,34 @@ +import * as SentryNode from '@sentry/node'; +import { SDK_VERSION } from '@sentry/utils'; + +import { vi } from 'vitest'; +import { init as nestInit } from '../src/sdk'; + +const nodeInit = vi.spyOn(SentryNode, 'init'); +const PUBLIC_DSN = 'https://username@domain/123'; + +describe('Initialize Nest SDK', () => { + beforeEach(() => { + vi.clearAllMocks(); + }); + + it('has the correct metadata', () => { + const client = nestInit({ + dsn: PUBLIC_DSN, + }); + + const expectedMetadata = { + _metadata: { + sdk: { + name: 'sentry.javascript.nestjs', + packages: [{ name: 'npm:@sentry/nestjs', version: SDK_VERSION }], + version: SDK_VERSION, + }, + }, + }; + + expect(client).not.toBeUndefined(); + expect(nodeInit).toHaveBeenCalledTimes(1); + expect(nodeInit).toHaveBeenLastCalledWith(expect.objectContaining(expectedMetadata)); + }); +}); diff --git a/packages/nestjs/tsconfig.json b/packages/nestjs/tsconfig.json new file mode 100644 index 000000000000..b0eb9ecb6476 --- /dev/null +++ b/packages/nestjs/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.json", + + "include": ["src/**/*"], + + "compilerOptions": {} +} diff --git a/packages/nestjs/tsconfig.test.json b/packages/nestjs/tsconfig.test.json new file mode 100644 index 000000000000..fc9e549d35ce --- /dev/null +++ b/packages/nestjs/tsconfig.test.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + + "include": ["test/**/*", "vite.config.ts"], + + "compilerOptions": { + // should include all types from `./tsconfig.json` plus types for all test frameworks used + "types": ["vitest/globals"] + + // other package-specific, test-specific options + } +} diff --git a/packages/nestjs/tsconfig.types.json b/packages/nestjs/tsconfig.types.json new file mode 100644 index 000000000000..65455f66bd75 --- /dev/null +++ b/packages/nestjs/tsconfig.types.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "build/types" + } +} diff --git a/packages/nestjs/vite.config.ts b/packages/nestjs/vite.config.ts new file mode 100644 index 000000000000..d82e61610307 --- /dev/null +++ b/packages/nestjs/vite.config.ts @@ -0,0 +1,13 @@ +import type { UserConfig } from 'vitest'; +import { defineConfig } from 'vitest/config'; +import baseConfig from '../../vite/vite.config'; + +export default defineConfig({ + ...baseConfig, + test: { + // test exists, no idea why TS doesn't recognize it + // eslint-disable-next-line @typescript-eslint/no-explicit-any + ...(baseConfig as UserConfig & { test: any }).test, + environment: 'node', + }, +}); diff --git a/scripts/node-unit-tests.ts b/scripts/node-unit-tests.ts index b896be9c73f1..705a8370743f 100644 --- a/scripts/node-unit-tests.ts +++ b/scripts/node-unit-tests.ts @@ -30,7 +30,7 @@ const DEFAULT_SKIP_TESTS_PACKAGES = [ const SKIP_TEST_PACKAGES: Record = { '14': { - ignoredPackages: ['@sentry/sveltekit', '@sentry/vercel-edge', '@sentry/astro', '@sentry/nuxt'], + ignoredPackages: ['@sentry/sveltekit', '@sentry/vercel-edge', '@sentry/astro', '@sentry/nuxt', '@sentry/nestjs'], }, '16': { ignoredPackages: ['@sentry/vercel-edge', '@sentry/astro'],