diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index c244f8b95465..e60aeddf7efc 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 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..5ff6045952fb --- /dev/null +++ b/packages/nextjs/test/types/test.ts @@ -0,0 +1,12 @@ +/* eslint-disable no-console */ +import { parseSemver } from '@sentry/utils'; +import { execSync } from 'child_process'; + +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' }); +}