@@ -11,38 +11,57 @@ import { DebuggerLauncherScriptProvider, NoDebugLauncherScriptProvider, RemoteDe
1111
1212const expectedPath = path . join ( EXTENSION_ROOT_DIR , 'pythonFiles' , 'ptvsd_launcher.py' ) ;
1313
14+ // tslint:disable-next-line:max-func-body-length
1415suite ( 'Debugger - Launcher Script Provider' , ( ) => {
1516 test ( 'Ensure launcher script exists' , async ( ) => {
1617 expect ( await fs . pathExists ( expectedPath ) ) . to . be . deep . equal ( true , 'Debugger launcher script does not exist' ) ;
1718 } ) ;
18- test ( 'Test debug launcher args' , async ( ) => {
19- const args = new DebuggerLauncherScriptProvider ( ) . getLauncherArgs ( { host : 'something' , port : 1234 } ) ;
20- const expectedArgs = [ expectedPath , '--default' , '--client' , '--host' , 'something' , '--port' , '1234' ] ;
21- expect ( args ) . to . be . deep . equal ( expectedArgs ) ;
22- } ) ;
23- test ( 'Test non-debug launcher args' , async ( ) => {
24- const args = new NoDebugLauncherScriptProvider ( ) . getLauncherArgs ( { host : 'something' , port : 1234 } ) ;
25- const expectedArgs = [ expectedPath , '--default' , '--nodebug' , '--client' , '--host' , 'something' , '--port' , '1234' ] ;
26- expect ( args ) . to . be . deep . equal ( expectedArgs ) ;
27- } ) ;
28- test ( 'Test debug launcher args and custom ptvsd' , async ( ) => {
29- const args = new DebuggerLauncherScriptProvider ( ) . getLauncherArgs ( { host : 'something' , port : 1234 , customDebugger : true } ) ;
30- const expectedArgs = [ expectedPath , '--custom' , '--client' , '--host' , 'something' , '--port' , '1234' ] ;
31- expect ( args ) . to . be . deep . equal ( expectedArgs ) ;
32- } ) ;
33- test ( 'Test non-debug launcher args and custom ptvsd' , async ( ) => {
34- const args = new NoDebugLauncherScriptProvider ( ) . getLauncherArgs ( { host : 'something' , port : 1234 , customDebugger : true } ) ;
35- const expectedArgs = [ expectedPath , '--custom' , '--nodebug' , '--client' , '--host' , 'something' , '--port' , '1234' ] ;
36- expect ( args ) . to . be . deep . equal ( expectedArgs ) ;
37- } ) ;
38- test ( 'Test remote debug launcher args (and do not wait for debugger to attach)' , async ( ) => {
39- const args = new RemoteDebuggerLauncherScriptProvider ( ) . getLauncherArgs ( { host : 'something' , port : 1234 , waitUntilDebuggerAttaches : false } ) ;
40- const expectedArgs = [ expectedPath , '--default' , '--host' , 'something' , '--port' , '1234' ] ;
41- expect ( args ) . to . be . deep . equal ( expectedArgs ) ;
42- } ) ;
43- test ( 'Test remote debug launcher args (and wait for debugger to attach)' , async ( ) => {
44- const args = new RemoteDebuggerLauncherScriptProvider ( ) . getLauncherArgs ( { host : 'something' , port : 1234 , waitUntilDebuggerAttaches : true } ) ;
45- const expectedArgs = [ expectedPath , '--default' , '--host' , 'something' , '--port' , '1234' , '--wait' ] ;
46- expect ( args ) . to . be . deep . equal ( expectedArgs ) ;
19+ const testsForLaunchProvider =
20+ [
21+ {
22+ testName : 'When path to ptvsd launcher does not contains spaces' ,
23+ path : path . join ( 'path' , 'to' , 'ptvsd_launcher' ) ,
24+ expectedPath : 'path/to/ptvsd_launcher'
25+ } ,
26+ {
27+ testName : 'When path to ptvsd launcher contains spaces' ,
28+ path : path . join ( 'path' , 'to' , 'ptvsd_launcher' , 'with spaces' ) ,
29+ expectedPath : '"path/to/ptvsd_launcher/with spaces"'
30+ }
31+ ] ;
32+
33+ testsForLaunchProvider . forEach ( testParams => {
34+ suite ( testParams . testName , async ( ) => {
35+ test ( 'Test debug launcher args' , async ( ) => {
36+ const args = new DebuggerLauncherScriptProvider ( testParams . path ) . getLauncherArgs ( { host : 'something' , port : 1234 } ) ;
37+ const expectedArgs = [ testParams . expectedPath , '--default' , '--client' , '--host' , 'something' , '--port' , '1234' ] ;
38+ expect ( args ) . to . be . deep . equal ( expectedArgs ) ;
39+ } ) ;
40+ test ( 'Test non-debug launcher args' , async ( ) => {
41+ const args = new NoDebugLauncherScriptProvider ( testParams . path ) . getLauncherArgs ( { host : 'something' , port : 1234 } ) ;
42+ const expectedArgs = [ testParams . expectedPath , '--default' , '--nodebug' , '--client' , '--host' , 'something' , '--port' , '1234' ] ;
43+ expect ( args ) . to . be . deep . equal ( expectedArgs ) ;
44+ } ) ;
45+ test ( 'Test debug launcher args and custom ptvsd' , async ( ) => {
46+ const args = new DebuggerLauncherScriptProvider ( testParams . path ) . getLauncherArgs ( { host : 'something' , port : 1234 , customDebugger : true } ) ;
47+ const expectedArgs = [ testParams . expectedPath , '--custom' , '--client' , '--host' , 'something' , '--port' , '1234' ] ;
48+ expect ( args ) . to . be . deep . equal ( expectedArgs ) ;
49+ } ) ;
50+ test ( 'Test non-debug launcher args and custom ptvsd' , async ( ) => {
51+ const args = new NoDebugLauncherScriptProvider ( testParams . path ) . getLauncherArgs ( { host : 'something' , port : 1234 , customDebugger : true } ) ;
52+ const expectedArgs = [ testParams . expectedPath , '--custom' , '--nodebug' , '--client' , '--host' , 'something' , '--port' , '1234' ] ;
53+ expect ( args ) . to . be . deep . equal ( expectedArgs ) ;
54+ } ) ;
55+ test ( 'Test remote debug launcher args (and do not wait for debugger to attach)' , async ( ) => {
56+ const args = new RemoteDebuggerLauncherScriptProvider ( testParams . path ) . getLauncherArgs ( { host : 'something' , port : 1234 , waitUntilDebuggerAttaches : false } ) ;
57+ const expectedArgs = [ testParams . expectedPath , '--default' , '--host' , 'something' , '--port' , '1234' ] ;
58+ expect ( args ) . to . be . deep . equal ( expectedArgs ) ;
59+ } ) ;
60+ test ( 'Test remote debug launcher args (and wait for debugger to attach)' , async ( ) => {
61+ const args = new RemoteDebuggerLauncherScriptProvider ( testParams . path ) . getLauncherArgs ( { host : 'something' , port : 1234 , waitUntilDebuggerAttaches : true } ) ;
62+ const expectedArgs = [ testParams . expectedPath , '--default' , '--host' , 'something' , '--port' , '1234' , '--wait' ] ;
63+ expect ( args ) . to . be . deep . equal ( expectedArgs ) ;
64+ } ) ;
65+ } ) ;
4766 } ) ;
4867} ) ;
0 commit comments