diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index c244f8b95465..14e0841c4b1d 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -67,7 +67,7 @@ "test:all": "run-s test:unit test:integration", "test:unit": "jest", "test:integration": "test/run-integration-tests.sh && yarn test:types", - "test:types": "cd test/types/ && yarn && tsc", + "test:types": "cd test/types && yarn && yarn test", "test:watch": "jest --watch", "vercel:branch": "source vercel/set-up-branch-for-test-app-use.sh", "vercel:project": "source vercel/make-project-use-current-branch.sh" diff --git a/packages/nextjs/test/types/package.json b/packages/nextjs/test/types/package.json index 37352bf558e4..b73620071d6c 100644 --- a/packages/nextjs/test/types/package.json +++ b/packages/nextjs/test/types/package.json @@ -1,5 +1,8 @@ { - "description": "This is only used to install the nextjs v12 package so we can test against those types", + "description": "This is used to install the nextjs v12 so we can test against those types", + "scripts": { + "test": "ts-node test.ts" + }, "dependencies": { "next": "12.3.1" } diff --git a/packages/nextjs/test/types/test.ts b/packages/nextjs/test/types/test.ts new file mode 100644 index 000000000000..f2ab055b16d8 --- /dev/null +++ b/packages/nextjs/test/types/test.ts @@ -0,0 +1,8 @@ +import { execSync } from 'child_process'; +import { parseSemver } from '@sentry/utils'; + +const NODE_VERSION = parseSemver(process.versions.node); + +if (NODE_VERSION.major && NODE_VERSION.major >= 12) { + execSync('tsc --noEmit --project tsconfig.json', { stdio: 'inherit' }); +}