Skip to content

Commit 634e409

Browse files
committed
exit with spawned processes exit code in prompt tests
1 parent b55eec0 commit 634e409

File tree

6 files changed

+37
-15
lines changed

6 files changed

+37
-15
lines changed

.github/workflows/ci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -756,9 +756,13 @@ jobs:
756756
sudo apt-get install expect
757757
758758
./tests/e2e_prompts.sh
759+
sleep 1
759760
./tests/e2e_prompts_git.sh
761+
sleep 1
760762
./tests/e2e_prompts_m.sh
763+
sleep 1
761764
./tests/e2e_prompts_ts.sh
765+
sleep 1
762766
./tests/e2e_prompts_overwrite.sh
763767
working-directory: ./packages/create-redwood-app
764768
env:

packages/create-redwood-app/tests/e2e_prompts.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ if {$projectPath eq ""} {
99

1010
cd $projectPath
1111

12+
set projectDirectory "redwood-app-prompt-test"
13+
1214
spawn yarn create-redwood-app
1315

1416
expect "Where would you like to create your Redwood app?"
15-
send "redwood-app\n"
17+
send "$projectDirectory\n"
1618

1719
expect "Select your preferred language"
1820
# TypeScript
@@ -31,8 +33,10 @@ set exitStatus [lindex $result 3]
3133

3234
if {$exitStatus == 0} {
3335
puts "Success"
36+
exec rm -rf $projectDirectory
37+
exit 0
3438
} else {
3539
puts "Error: The process failed with exit status $exitStatus"
40+
exec rm -rf $projectDirectory
41+
exit 1
3642
}
37-
38-
exec rm -rf ./redwood-app

packages/create-redwood-app/tests/e2e_prompts_git.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ if {$projectPath eq ""} {
99

1010
cd $projectPath
1111

12+
set projectDirectory "redwood-app-prompt-git-test"
13+
1214
spawn yarn create-redwood-app --git
1315

1416
expect "Where would you like to create your Redwood app?"
15-
send "redwood-app\n"
17+
send "$projectDirectory\n"
1618

1719
expect "Select your preferred language"
1820
# TypeScript
@@ -27,8 +29,10 @@ set exitStatus [lindex $result 3]
2729

2830
if {$exitStatus == 0} {
2931
puts "Success"
32+
exec rm -rf $projectDirectory
33+
exit 0
3034
} else {
3135
puts "Error: The process failed with exit status $exitStatus"
36+
exec rm -rf $projectDirectory
37+
exit 1
3238
}
33-
34-
exec rm -rf ./redwood-app

packages/create-redwood-app/tests/e2e_prompts_m.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ if {$projectPath eq ""} {
99

1010
cd $projectPath
1111

12+
set projectDirectory "redwood-app-prompt-m-test"
13+
1214
spawn yarn create-redwood-app -m "first"
1315

1416
expect "Where would you like to create your Redwood app?"
15-
send "redwood-app\n"
17+
send "$projectDirectory\n"
1618

1719
expect "Select your preferred language"
1820
# TypeScript
@@ -28,8 +30,10 @@ set exitStatus [lindex $result 3]
2830

2931
if {$exitStatus == 0} {
3032
puts "Success"
33+
exec rm -rf $projectDirectory
34+
exit 0
3135
} else {
3236
puts "Error: The process failed with exit status $exitStatus"
37+
exec rm -rf $projectDirectory
38+
exit 1
3339
}
34-
35-
exec rm -rf ./redwood-app

packages/create-redwood-app/tests/e2e_prompts_overwrite.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if {$projectPath eq ""} {
1010
cd $projectPath
1111

1212
# Make directory that needs to be overwritten.
13-
set projectDirectory "redwood-app"
13+
set projectDirectory "redwood-app-prompt-overwrite-test"
1414
exec mkdir $projectDirectory
1515
exec touch $projectDirectory/README.md
1616

@@ -40,8 +40,10 @@ set exitStatus [lindex $result 3]
4040

4141
if {$exitStatus == 1} {
4242
puts "Success"
43+
exec rm -rf $projectDirectory
44+
exit 0
4345
} else {
4446
puts "Error: The process failed with exit status $exitStatus"
47+
exec rm -rf $projectDirectory
48+
exit 1
4549
}
46-
47-
exec rm -rf ./redwood-app

packages/create-redwood-app/tests/e2e_prompts_ts.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ if {$projectPath eq ""} {
99

1010
cd $projectPath
1111

12+
set projectDirectory "redwood-app-prompt-ts-test"
13+
1214
spawn yarn create-redwood-app --ts
1315

1416
expect "Where would you like to create your Redwood app?"
15-
send "redwood-app\n"
17+
send "$projectDirectory\n"
1618

1719
expect "Do you want to initialize a git repo?"
1820
# Yes
@@ -28,8 +30,10 @@ set exitStatus [lindex $result 3]
2830

2931
if {$exitStatus == 0} {
3032
puts "Success"
33+
exec rm -rf $projectDirectory
34+
exit 0
3135
} else {
3236
puts "Error: The process failed with exit status $exitStatus"
37+
exec rm -rf $projectDirectory
38+
exit 1
3339
}
34-
35-
exec rm -rf ./redwood-app

0 commit comments

Comments
 (0)