@@ -78,29 +78,31 @@ export function runTest(rootDirectory: string, tests: Tests, args: string[], tes
7878function buildTestArgs ( args : string [ ] ) : string [ ] {
7979 let startDirectory = '.' ;
8080 let pattern = 'test*.py' ;
81- const indexOfStartDir = args . findIndex ( arg => arg . indexOf ( '-s' ) === 0 ) ;
82- if ( indexOfStartDir > 0 ) {
81+ const indexOfStartDir = args . findIndex ( arg => arg . indexOf ( '-s' ) === 0 || arg . indexOf ( '--start-directory' ) === 0 ) ;
82+ if ( indexOfStartDir >= 0 ) {
8383 const startDir = args [ indexOfStartDir ] . trim ( ) ;
84- if ( startDir . trim ( ) === '-s' && args . length >= indexOfStartDir ) {
84+ if ( ( startDir . trim ( ) === '-s' || startDir . trim ( ) === '--start-directory' ) && args . length >= indexOfStartDir ) {
8585 // Assume the next items is the directory
8686 startDirectory = args [ indexOfStartDir + 1 ] ;
8787 }
8888 else {
89- startDirectory = startDir . substring ( 2 ) . trim ( ) ;
89+ const lenToStartFrom = startDir . startsWith ( '-s' ) ? '-s' . length : '--start-directory' . length ;
90+ startDirectory = startDir . substring ( lenToStartFrom ) . trim ( ) ;
9091 if ( startDirectory . startsWith ( '=' ) ) {
9192 startDirectory = startDirectory . substring ( 1 ) ;
9293 }
9394 }
9495 }
95- const indexOfPattern = args . findIndex ( arg => arg . indexOf ( '-p' ) === 0 ) ;
96- if ( indexOfPattern > 0 ) {
96+ const indexOfPattern = args . findIndex ( arg => arg . indexOf ( '-p' ) === 0 || arg . indexOf ( '--pattern' ) === 0 ) ;
97+ if ( indexOfPattern >= 0 ) {
9798 const patternValue = args [ indexOfPattern ] . trim ( ) ;
98- if ( patternValue . trim ( ) === '-s' && args . length >= indexOfPattern ) {
99+ if ( ( patternValue . trim ( ) === '-p' || patternValue . trim ( ) === '--pattern' ) && args . length >= indexOfPattern ) {
99100 // Assume the next items is the directory
100101 pattern = args [ indexOfPattern + 1 ] ;
101102 }
102103 else {
103- pattern = patternValue . substring ( 2 ) . trim ( ) ;
104+ const lenToStartFrom = patternValue . startsWith ( '-p' ) ? '-p' . length : '--pattern' . length ;
105+ pattern = patternValue . substring ( lenToStartFrom ) . trim ( ) ;
104106 if ( pattern . startsWith ( '=' ) ) {
105107 pattern = pattern . substring ( 1 ) ;
106108 }
0 commit comments