@@ -62,7 +62,10 @@ describe('nx-flutter e2e', () => {
6262
6363 const sep = process . platform === 'win32' ? '\\' : '/' ;
6464 await runNxCommandAsync (
65- `generate @nxrocks/nx-flutter:create ${ appName } --no-interactive`
65+ `generate @nxrocks/nx-flutter:create ${ appName } --no-interactive` ,
66+ {
67+ cwd : projectDirectory ,
68+ }
6669 ) ;
6770
6871 const executors = [
@@ -105,15 +108,22 @@ describe('nx-flutter e2e', () => {
105108 let totalExecutorsTime = 0 ;
106109 for ( const executor of executors ) {
107110 const start = new Date ( ) . getTime ( ) ;
108- const result = await runNxCommandAsync ( `run ${ appName } :${ executor . name } ` ) ;
111+ const result = await runNxCommandAsync (
112+ `run ${ appName } :${ executor . name } ` ,
113+ {
114+ cwd : projectDirectory ,
115+ }
116+ ) ;
109117 const end = new Date ( ) . getTime ( ) ;
110118 console . log ( `${ executor . name } took ${ end - start } ms` ) ;
111119 totalExecutorsTime += end - start ;
112120 expect ( result . stdout ) . toContain ( executor . output ) ;
113121 }
114122 console . log ( `Total executors time: ${ totalExecutorsTime } ms` ) ;
115123
116- expect ( ( ) => checkFilesExist ( `${ appName } /pubspec.yaml` ) ) . not . toThrow ( ) ;
124+ expect ( ( ) =>
125+ checkFilesExist ( `${ projectDirectory } /${ appName } /pubspec.yaml` )
126+ ) . not . toThrow ( ) ;
117127 } , 400000 ) ;
118128
119129 it ( 'should create nx-flutter project with given options' , async ( ) => {
@@ -128,7 +138,10 @@ describe('nx-flutter e2e', () => {
128138 const offline = true ;
129139
130140 await runNxCommandAsync (
131- `generate @nxrocks/nx-flutter:create ${ appName } --org=${ org } --description="${ description } " --androidLanguage=${ androidLanguage } --iosLanguage=${ iosLanguage } --template=${ template } --platforms="${ platforms } " --pub=${ pub } --offline=${ offline } --no-interactive`
141+ `generate @nxrocks/nx-flutter:create ${ appName } --org=${ org } --description="${ description } " --androidLanguage=${ androidLanguage } --iosLanguage=${ iosLanguage } --template=${ template } --platforms="${ platforms } " --pub=${ pub } --offline=${ offline } --no-interactive` ,
142+ {
143+ cwd : projectDirectory ,
144+ }
132145 ) ;
133146
134147 const executors = [
@@ -138,16 +151,21 @@ describe('nx-flutter e2e', () => {
138151 ] ;
139152
140153 for ( const executor of executors ) {
141- const result = await runNxCommandAsync ( `run ${ appName } :${ executor . name } ` ) ;
154+ const result = await runNxCommandAsync (
155+ `run ${ appName } :${ executor . name } ` ,
156+ {
157+ cwd : projectDirectory ,
158+ }
159+ ) ;
142160 expect ( result . stdout ) . toContain ( executor . output ) ;
143161 }
144162
145163 expect ( ( ) =>
146164 checkFilesExist (
147- `${ appName } /pubspec.yaml` ,
148- `${ appName } /android/build.gradle` ,
149- `${ appName } /ios/Runner.xcodeproj` ,
150- `${ appName } /android/app/src/main/java/com/tinesoft/${ appName . replaceAll (
165+ `${ projectDirectory } / ${ appName } /pubspec.yaml` ,
166+ `${ projectDirectory } / ${ appName } /android/build.gradle` ,
167+ `${ projectDirectory } / ${ appName } /ios/Runner.xcodeproj` ,
168+ `${ projectDirectory } / ${ appName } /android/app/src/main/java/com/tinesoft/${ appName . replaceAll (
151169 '-' ,
152170 '_'
153171 ) } /MainActivity.java`
@@ -160,10 +178,13 @@ describe('nx-flutter e2e', () => {
160178 const appName = uniq ( 'nx-flutter-' ) ;
161179
162180 await runNxCommandAsync (
163- `generate @nxrocks/nx-flutter:new --directory subdir/${ appName } --no-interactive`
181+ `generate @nxrocks/nx-flutter:new --directory subdir/${ appName } --no-interactive` ,
182+ {
183+ cwd : projectDirectory ,
184+ }
164185 ) ;
165186 expect ( ( ) =>
166- checkFilesExist ( `subdir/${ appName } /pubspec.yaml` )
187+ checkFilesExist ( `${ projectDirectory } / subdir/${ appName } /pubspec.yaml` )
167188 ) . not . toThrow ( ) ;
168189 } , 200000 ) ;
169190 } ) ;
@@ -173,9 +194,12 @@ describe('nx-flutter e2e', () => {
173194 const appName = uniq ( 'nx-flutter-' ) ;
174195
175196 await runNxCommandAsync (
176- `generate @nxrocks/nx-flutter:create ${ appName } --tags e2etag,e2ePackage --no-interactive`
197+ `generate @nxrocks/nx-flutter:create ${ appName } --tags e2etag,e2ePackage --no-interactive` ,
198+ {
199+ cwd : projectDirectory ,
200+ }
177201 ) ;
178- const project = readJson ( `${ appName } /project.json` ) ;
202+ const project = readJson ( `${ projectDirectory } / ${ appName } /project.json` ) ;
179203 expect ( project . tags ) . toEqual ( [ 'e2etag' , 'e2ePackage' ] ) ;
180204 } , 200000 ) ;
181205 } ) ;
0 commit comments