Skip to content

Commit 355bf74

Browse files
committed
Only run type tests for node >= 12
1 parent b332257 commit 355bf74

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

packages/nextjs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"test:all": "run-s test:unit test:integration",
6868
"test:unit": "jest",
6969
"test:integration": "test/run-integration-tests.sh && yarn test:types",
70-
"test:types": "cd test/types/ && yarn && tsc",
70+
"test:types": "cd test/types && yarn test",
7171
"test:watch": "jest --watch",
7272
"vercel:branch": "source vercel/set-up-branch-for-test-app-use.sh",
7373
"vercel:project": "source vercel/make-project-use-current-branch.sh"

packages/nextjs/test/types/package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
2-
"description": "This is only used to install the nextjs v12 package so we can test against those types",
2+
"description": "This is used to install the nextjs v12 so we can test against those types",
3+
"scripts": {
4+
"test": "ts-node test.ts"
5+
},
36
"dependencies": {
47
"next": "12.3.1"
58
}

packages/nextjs/test/types/test.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable no-console */
2+
import { parseSemver } from '@sentry/utils';
3+
import { execSync } from 'child_process';
4+
5+
const NODE_VERSION = parseSemver(process.versions.node);
6+
7+
if (NODE_VERSION.major && NODE_VERSION.major >= 12) {
8+
console.log('Installing next@v12...');
9+
execSync('yarn install', { stdio: 'inherit' });
10+
console.log('Testing some types...');
11+
execSync('tsc --noEmit --project tsconfig.json', { stdio: 'inherit' });
12+
}

0 commit comments

Comments
 (0)