@@ -60,6 +60,52 @@ describe('PythonShell', function () {
6060 done ( ) ;
6161 } ) ;
6262 } ) ;
63+ it ( 'should run multiple scripts and fail with an extended stack trace for each of them' , function ( done ) {
64+ var numberOfTimesToRun = 20 ;
65+ for ( var i = 0 ; i < numberOfTimesToRun ; i ++ ) {
66+ runSingleErrorScript ( end ) ;
67+ }
68+ var count = 0 ;
69+ function end ( ) {
70+ count ++ ;
71+ if ( count === numberOfTimesToRun ) {
72+ done ( ) ;
73+ }
74+ }
75+ function runSingleErrorScript ( callback ) {
76+ PythonShell . run ( 'error.py' , function ( err , results ) {
77+ err . should . be . an . Error ;
78+ err . exitCode . should . be . exactly ( 1 ) ;
79+ err . stack . should . containEql ( '----- Python Traceback -----' ) ;
80+ callback ( ) ;
81+ } ) ;
82+ }
83+ } ) ;
84+
85+ it ( 'should run multiple scripts and return output data for each of them' , function ( done ) {
86+ var numberOfTimesToRun = 20 ;
87+ for ( var i = 0 ; i < numberOfTimesToRun ; i ++ ) {
88+ runSingleErrorScript ( end ) ;
89+ }
90+ var count = 0 ;
91+ function end ( ) {
92+ count ++ ;
93+ if ( count === numberOfTimesToRun ) {
94+ done ( ) ;
95+ }
96+ }
97+ function runSingleErrorScript ( callback ) {
98+ PythonShell . run ( 'echo_args.py' , {
99+ args : [ 'hello' , 'world' ]
100+ } , function ( err , results ) {
101+ if ( err ) return done ( err ) ;
102+ results . should . be . an . Array . and . have . lengthOf ( 2 ) ;
103+ results . should . eql ( [ 'hello' , 'world' ] ) ;
104+ callback ( ) ;
105+ } ) ;
106+ }
107+
108+ } ) ;
63109 } ) ;
64110
65111 describe ( '.send(message)' , function ( ) {
0 commit comments