1
1
import * as childProcess from 'child_process' ;
2
2
import * as fs from 'fs' ;
3
3
4
- const CURRENT_NODE_VERSION = process . version . replace ( 'v' , '' ) . split ( '.' ) [ 0 ] ;
4
+ type NodeVersion = '8' | '10' | '12' | '14' | '16' ;
5
5
6
- type NodeVersions = '8' | '10' | '12' | '14' | '16' ;
6
+ interface VersionConfig {
7
+ ignoredPackages : Array < `@${'sentry' | 'sentry-internal' } /${string } `> ;
8
+ legacyDeps : Array < `${string } @${string } `> ;
9
+ shouldES6Utils : boolean ;
10
+ }
11
+
12
+ const CURRENT_NODE_VERSION = process . version . replace ( 'v' , '' ) . split ( '.' ) [ 0 ] as NodeVersion ;
7
13
8
14
const DEFAULT_SKIP_TESTS_PACKAGES = [
9
15
'@sentry-internal/eslint-plugin-sdk' ,
@@ -18,14 +24,7 @@ const DEFAULT_SKIP_TESTS_PACKAGES = [
18
24
'@sentry/bun' ,
19
25
] ;
20
26
21
- const SKIP_TEST_PACKAGES : Record <
22
- NodeVersions ,
23
- {
24
- ignoredPackages : Array < `@${'sentry' | 'sentry-internal' } /${string } `> ;
25
- legacyDeps : Array < `${string } @${string } `> ;
26
- shouldES6Utils : boolean ;
27
- }
28
- > = {
27
+ const SKIP_TEST_PACKAGES : Record < NodeVersion , VersionConfig > = {
29
28
'8' : {
30
29
ignoredPackages : [
31
30
'@sentry/gatsby' ,
@@ -159,14 +158,12 @@ function runTests(): void {
159
158
skipNodeV8Tests ( ) ;
160
159
}
161
160
162
- const versionConfig = SKIP_TEST_PACKAGES [ CURRENT_NODE_VERSION as NodeVersions ] ;
161
+ const versionConfig = SKIP_TEST_PACKAGES [ CURRENT_NODE_VERSION ] ;
163
162
if ( versionConfig ) {
164
163
versionConfig . ignoredPackages . forEach ( dep => ignores . add ( dep ) ) ;
165
-
166
164
if ( versionConfig . legacyDeps . length > 0 ) {
167
165
installLegacyDeps ( versionConfig . legacyDeps ) ;
168
166
}
169
-
170
167
if ( versionConfig . shouldES6Utils ) {
171
168
es6ifyTestTSConfig ( 'utils' ) ;
172
169
}
0 commit comments