@@ -16,6 +16,13 @@ function nextPort() {
1616nextPort . port = 12345 ;
1717
1818describe ( 'Robot Remote Library' , function ( ) {
19+
20+ var server ;
21+
22+ afterEach ( function ( ) {
23+ server && server . stopRemoteServer ( ) ;
24+ } ) ;
25+
1926 it ( 'client should fail to start if server is not running' , function ( done ) {
2027 robot . createClient ( { host : 'localhost' , port : nextPort ( ) } ) . done (
2128 function ( val ) {
@@ -28,7 +35,7 @@ describe('Robot Remote Library', function () {
2835 } ) ;
2936 it ( 'client should start and list all keywords when server is running' , function ( done ) {
3037 var serverPort = nextPort ( ) ;
31- var server = new robot . Server ( [ testLibrary ] , { host : 'localhost' , port : serverPort , allowStop : true } , function ( ) {
38+ server = new robot . Server ( [ testLibrary ] , { host : 'localhost' , port : serverPort , allowStop : true } , function ( ) {
3239 robot . createClient ( { host : 'localhost' , port : serverPort } ) . done (
3340 function ( val ) {
3441 keywordsEqual ( val , server . keywords ) ;
@@ -47,7 +54,7 @@ describe('Robot Remote Library', function () {
4754 var libraries = [
4855 { testKeyword : testKeyword }
4956 ] ;
50- var server = new robot . Server ( libraries , { host : 'localhost' , port : serverPort , allowStop : true } , function ( ) {
57+ server = new robot . Server ( libraries , { host : 'localhost' , port : serverPort , allowStop : true } , function ( ) {
5158 robot . createClient ( { host : 'localhost' , port : serverPort } ) . done (
5259 function ( clientKeywords ) {
5360 clientKeywords . testKeyword ( 'param' ) . done ( function ( val ) {
@@ -69,7 +76,7 @@ describe('Robot Remote Library', function () {
6976 return p1 ;
7077 }
7178 } ;
72- var server = new robot . Server ( [ lib ] , { host : 'localhost' , port : serverPort , allowStop : true } , function ( ) {
79+ server = new robot . Server ( [ lib ] , { host : 'localhost' , port : serverPort , allowStop : true } , function ( ) {
7380 robot . createClient ( { host : 'localhost' , port : serverPort } ) . done (
7481 function ( val ) {
7582 val . testKeyword ( 'param' ) . done ( function ( res ) {
@@ -93,7 +100,7 @@ describe('Robot Remote Library', function () {
93100 throw err ;
94101 }
95102 } ;
96- var server = new robot . Server ( [ lib ] , { host : 'localhost' , port : serverPort , allowStop : true } , function ( ) {
103+ server = new robot . Server ( [ lib ] , { host : 'localhost' , port : serverPort , allowStop : true } , function ( ) {
97104 robot . createClient ( { host : 'localhost' , port : serverPort } ) . done (
98105 function ( val ) {
99106 val . testKeyword ( ) . done ( done , function ( err ) {
@@ -117,7 +124,7 @@ describe('Robot Remote Library', function () {
117124 return true ;
118125 }
119126 } ;
120- var server = new robot . Server ( [ lib1 , lib2 ] , { host : 'localhost' , port : serverPort , allowStop : true } , function ( ) {
127+ server = new robot . Server ( [ lib1 , lib2 ] , { host : 'localhost' , port : serverPort , allowStop : true } , function ( ) {
121128 robot . createClient ( { host : 'localhost' , port : serverPort } ) . done (
122129 function ( val ) {
123130 val . testKeywordFromLib1 ( ) . done ( function ( ) {
0 commit comments