Skip to content

Commit

Permalink
Only run type tests for node >= 12
Browse files Browse the repository at this point in the history
  • Loading branch information
timfish committed Oct 15, 2022
1 parent b332257 commit ed9e688
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion packages/nextjs/test/types/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
Expand Down
11 changes: 11 additions & 0 deletions packages/nextjs/test/types/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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' });
}

0 comments on commit ed9e688

Please sign in to comment.