@@ -24,8 +24,9 @@ let sdkFolderPath: string;
24
24
let sdkPackagePath : string ;
25
25
const execAppOptions = getDefaultExecSyncOptions ( ) ;
26
26
const packageManager = getPackageManager ( ) ;
27
+ const describeSkipYarn1 = isYarn1Enforced ? describe . skip : describe ;
27
28
28
- describe ( 'Create new sdk command' , ( ) => {
29
+ describeSkipYarn1 ( 'Create new sdk command' , ( ) => {
29
30
beforeEach ( ( ) => {
30
31
const isYarnTest = o3rEnvironment . testEnvironment . isYarnTest ;
31
32
sdkFolderPath = o3rEnvironment . testEnvironment . workspacePath ;
@@ -40,7 +41,7 @@ describe('Create new sdk command', () => {
40
41
41
42
// copy yarnrc config to generated SDK
42
43
mkdirSync ( sdkPackagePath , { recursive : true } ) ;
43
- const yarnConfigFile = isYarn1Enforced ( ) ? '.yarnrc' : '.yarnrc.yml' ;
44
+ const yarnConfigFile = '.yarnrc.yml' ;
44
45
cpSync ( path . join ( sdkFolderPath , yarnConfigFile ) , path . join ( sdkPackagePath , yarnConfigFile ) ) ;
45
46
cpSync ( path . join ( sdkFolderPath , '.yarn' ) , path . join ( sdkPackagePath , '.yarn' ) , { recursive : true } ) ;
46
47
fs . writeFileSync ( path . join ( sdkPackagePath , 'yarn.lock' ) , '' ) ;
@@ -61,7 +62,7 @@ describe('Create new sdk command', () => {
61
62
packageManagerCreate ( {
62
63
script : '@ama-sdk' ,
63
64
args : [ 'typescript' , sdkPackageName , '--package-manager' , packageManager , '--spec-path' , path . join ( sdkFolderPath , 'swagger-spec.yml' ) ]
64
- } , execAppOptions , ! isYarn1Enforced ( ) ? 'npm' : undefined )
65
+ } , execAppOptions , 'npm' )
65
66
) . not . toThrow ( ) ;
66
67
expect ( ( ) => packageManagerRun ( { script : 'build' } , { ...execAppOptions , cwd : sdkPackagePath } ) ) . not . toThrow ( ) ;
67
68
expect ( existsSync ( path . join ( sdkPackagePath , 'src' , 'models' , 'base' , 'pet' , 'pet.reviver.ts' ) ) ) . toBeFalsy ( ) ;
@@ -116,7 +117,7 @@ describe('Create new sdk command', () => {
116
117
expect ( ( ) => packageManagerCreate ( {
117
118
script : '@ama-sdk' ,
118
119
args : [ 'typescript' , sdkPackageName , '--package-manager' , packageManager ]
119
- } , execAppOptions , ! isYarn1Enforced ( ) ? 'npm' : undefined ) ) . not . toThrow ( ) ;
120
+ } , execAppOptions , 'npm' ) ) . not . toThrow ( ) ;
120
121
expect ( ( ) => packageManagerRun ( { script : 'build' } , { ...execAppOptions , cwd : sdkPackagePath } ) ) . not . toThrow ( ) ;
121
122
expect ( ( ) =>
122
123
packageManagerExec ( {
@@ -133,7 +134,7 @@ describe('Create new sdk command', () => {
133
134
packageManagerCreate ( {
134
135
script : '@ama-sdk' ,
135
136
args : [ 'typescript' , sdkPackageName , '--package-manager' , packageManager , '--spec-path' , './missing-file.yml' ]
136
- } , execAppOptions , ! isYarn1Enforced ( ) ? 'npm' : undefined )
137
+ } , execAppOptions , 'npm' )
137
138
) . toThrow ( ) ;
138
139
} ) ;
139
140
@@ -142,7 +143,7 @@ describe('Create new sdk command', () => {
142
143
packageManagerCreate ( {
143
144
script : `@ama-sdk@${ o3rEnvironment . testEnvironment . o3rExactVersion } ` ,
144
145
args : [ 'typescript' , sdkPackageName , '--exact-o3r-version' , '--package-manager' , packageManager , '--spec-path' , path . join ( sdkFolderPath , 'swagger-spec.yml' ) ]
145
- } , execAppOptions , ! isYarn1Enforced ( ) ? 'npm' : undefined )
146
+ } , execAppOptions , 'npm' )
146
147
) . not . toThrow ( ) ;
147
148
expect ( ( ) => packageManagerRun ( { script : 'build' } , { ...execAppOptions , cwd : sdkPackagePath } ) ) . not . toThrow ( ) ;
148
149
const packageJson = JSON . parse ( fs . readFileSync ( path . join ( sdkPackagePath , 'package.json' ) , 'utf-8' ) ) ;
0 commit comments