@@ -66,7 +66,17 @@ describe('data-code-extension init commands', () => {
6666 // If Python 3.11+ is not installed, pip package is missing, binary is not found, or init fails, verify the error is handled correctly
6767 expect ( error ) . to . have . property ( 'name' ) ;
6868 if ( error instanceof Error ) {
69- expect ( error . name ) . to . be . oneOf ( [ 'PythonNotFound' , 'PythonVersionMismatch' , 'PipNotFound' , 'PackageNotInstalled' , 'BinaryNotFound' , 'BinaryNotExecutable' , 'InitPermissionDenied' , 'InitDirectoryExists' , 'InitExecutionFailed' ] ) ;
69+ expect ( error . name ) . to . be . oneOf ( [
70+ 'PythonNotFound' ,
71+ 'PythonVersionMismatch' ,
72+ 'PipNotFound' ,
73+ 'PackageNotInstalled' ,
74+ 'BinaryNotFound' ,
75+ 'BinaryNotExecutable' ,
76+ 'InitPermissionDenied' ,
77+ 'InitDirectoryExists' ,
78+ 'InitExecutionFailed' ,
79+ ] ) ;
7080 expect ( error . message ) . to . be . a ( 'string' ) ;
7181 if ( 'actions' in error && error . actions ) {
7282 expect ( error . actions ) . to . be . an ( 'array' ) ;
@@ -75,9 +85,9 @@ describe('data-code-extension init commands', () => {
7585 }
7686 } ) ;
7787
78- it ( 'returns JSON result when --json flag is used for script init' , async ( ) => {
88+ it ( 'returns structured result for script init' , async ( ) => {
7989 try {
80- const result = await ScriptInit . run ( [ '--json' , '-- package-dir', './test-json' ] ) ;
90+ const result = await ScriptInit . run ( [ '--package-dir' , './test-json' ] ) ;
8191
8292 // Should return a structured result
8393 expect ( result ) . to . be . an ( 'object' ) ;
@@ -86,7 +96,6 @@ describe('data-code-extension init commands', () => {
8696 expect ( result ) . to . have . property ( 'message' ) ;
8797 // packageInfo may or may not be present depending on whether package is installed
8898 } catch ( error ) {
89- // Even errors should be structured when using --json
9099 expect ( error ) . to . have . property ( 'name' ) ;
91100 if ( error instanceof Error ) {
92101 expect ( error . name ) . to . be . a ( 'string' ) ;
@@ -104,7 +113,17 @@ describe('data-code-extension init commands', () => {
104113 } catch ( error ) {
105114 // Handle case where Python is not installed
106115 if ( error instanceof Error ) {
107- expect ( error . name ) . to . be . oneOf ( [ 'PythonNotFound' , 'PythonVersionMismatch' , 'PipNotFound' , 'PackageNotInstalled' , 'BinaryNotFound' , 'BinaryNotExecutable' , 'InitPermissionDenied' , 'InitDirectoryExists' , 'InitExecutionFailed' ] ) ;
116+ expect ( error . name ) . to . be . oneOf ( [
117+ 'PythonNotFound' ,
118+ 'PythonVersionMismatch' ,
119+ 'PipNotFound' ,
120+ 'PackageNotInstalled' ,
121+ 'BinaryNotFound' ,
122+ 'BinaryNotExecutable' ,
123+ 'InitPermissionDenied' ,
124+ 'InitDirectoryExists' ,
125+ 'InitExecutionFailed' ,
126+ ] ) ;
108127 }
109128 }
110129 } ) ;
@@ -117,7 +136,17 @@ describe('data-code-extension init commands', () => {
117136 } catch ( error ) {
118137 // Handle case where Python is not installed
119138 if ( error instanceof Error ) {
120- expect ( error . name ) . to . be . oneOf ( [ 'PythonNotFound' , 'PythonVersionMismatch' , 'PipNotFound' , 'PackageNotInstalled' , 'BinaryNotFound' , 'BinaryNotExecutable' , 'InitPermissionDenied' , 'InitDirectoryExists' , 'InitExecutionFailed' ] ) ;
139+ expect ( error . name ) . to . be . oneOf ( [
140+ 'PythonNotFound' ,
141+ 'PythonVersionMismatch' ,
142+ 'PipNotFound' ,
143+ 'PackageNotInstalled' ,
144+ 'BinaryNotFound' ,
145+ 'BinaryNotExecutable' ,
146+ 'InitPermissionDenied' ,
147+ 'InitDirectoryExists' ,
148+ 'InitExecutionFailed' ,
149+ ] ) ;
121150 }
122151 }
123152 } ) ;
@@ -130,7 +159,17 @@ describe('data-code-extension init commands', () => {
130159 } catch ( error ) {
131160 // Handle case where Python is not installed
132161 if ( error instanceof Error ) {
133- expect ( error . name ) . to . be . oneOf ( [ 'PythonNotFound' , 'PythonVersionMismatch' , 'PipNotFound' , 'PackageNotInstalled' , 'BinaryNotFound' , 'BinaryNotExecutable' , 'InitPermissionDenied' , 'InitDirectoryExists' , 'InitExecutionFailed' ] ) ;
162+ expect ( error . name ) . to . be . oneOf ( [
163+ 'PythonNotFound' ,
164+ 'PythonVersionMismatch' ,
165+ 'PipNotFound' ,
166+ 'PackageNotInstalled' ,
167+ 'BinaryNotFound' ,
168+ 'BinaryNotExecutable' ,
169+ 'InitPermissionDenied' ,
170+ 'InitDirectoryExists' ,
171+ 'InitExecutionFailed' ,
172+ ] ) ;
134173 }
135174 }
136175 } ) ;
0 commit comments