File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5959 - name : create unity project
6060 shell : bash
6161 run : |
62+ unity-cli list-templates --unity-editor "${UNITY_EDITOR_PATH}" --json
6263 unity-cli create-project --name "Unity Project" --unity-editor "${UNITY_EDITOR_PATH}" --json
6364 - name : verify UNITY_PROJECT_PATH variable
6465 shell : bash
Original file line number Diff line number Diff line change @@ -117,8 +117,12 @@ program.command('hub-version')
117117 . description ( 'Print the version of the Unity Hub.' )
118118 . action ( async ( ) => {
119119 const unityHub = new UnityHub ( ) ;
120- const version = await unityHub . Version ( ) ;
121- process . stdout . write ( `${ version } \n` ) ;
120+ try {
121+ const version = await unityHub . Version ( ) ;
122+ process . stdout . write ( `${ version } \n` ) ;
123+ } catch ( error ) {
124+ process . stdout . write ( `${ error } \n` ) ;
125+ }
122126 } ) ;
123127
124128program . command ( 'hub-install' )
Original file line number Diff line number Diff line change @@ -432,7 +432,12 @@ chmod -R 777 "$hubPath"`]);
432432 }
433433 }
434434
435- await fs . promises . access ( asarPath , fs . constants . R_OK ) ;
435+ try {
436+ await fs . promises . access ( asarPath , fs . constants . R_OK ) ;
437+ } catch {
438+ throw new Error ( 'Unity Hub is not installed.' ) ;
439+ }
440+
436441 const fileBuffer = asar . extractFile ( asarPath , 'package.json' ) ;
437442 const packageJson = JSON . parse ( fileBuffer . toString ( ) ) ;
438443 const version = coerce ( packageJson . version ) ;
Original file line number Diff line number Diff line change @@ -3,6 +3,13 @@ import { UnityHub } from '../src/unity-hub';
33jest . setTimeout ( 30000 ) ; // UnityHub operations can be slow
44
55describe ( 'UnityHub' , ( ) => {
6+ it ( 'should get the Unity Hub version' , async ( ) => {
7+ const unityHub = new UnityHub ( ) ;
8+ const version = await unityHub . Version ( ) ;
9+ expect ( version ) . toBeDefined ( ) ;
10+ expect ( typeof version ) . toBe ( 'string' ) ;
11+ } ) ;
12+
613 it ( 'should list installed editors' , async ( ) => {
714 const unityHub = new UnityHub ( ) ;
815 const editors = await unityHub . ListInstalledEditors ( ) ;
You can’t perform that action at this time.
0 commit comments