@@ -92,23 +92,25 @@ exports.Server = function Server(bsClient, workers) {
92
92
pathMatches = ( filePath == config . test_path ) ;
93
93
}
94
94
if ( pathMatches && mimeType === 'text/html' ) {
95
- var matcher = / ( .* ) < \/ h e a d > / ;
95
+ var framework = config [ 'test_framework' ] ;
96
+ var tag_name = ( framework === "mocha" ) ? "head" : "body" ;
97
+ var matcher = new RegExp ( "(.*)<\/" + tag_name + ">" ) ; ///(.*)<\/body>/;
96
98
var patch = "$1" ;
97
99
scripts . forEach ( function ( script ) {
98
100
patch += "<script type='text/javascript' src='/_patch/" + script + "'></script>\n" ;
99
101
} ) ;
100
102
101
103
// adding framework scripts
102
- if ( config [ 'test_framework' ] && config [ 'test_framework' ] == "jasmine" ) {
104
+ if ( framework = == "jasmine" ) {
103
105
framework_scripts [ 'jasmine' ] . forEach ( function ( script ) {
104
106
patch += "<script type='text/javascript' src='/_patch/" + script + "'></script>\n" ;
105
107
} ) ;
106
108
patch += "<script type='text/javascript'>jasmine.getEnv().addReporter(new jasmine.JSReporter());</script>\n" ;
107
- } else if ( config [ 'test_framework' ] && config [ 'test_framework' ] == "jasmine2" ) {
109
+ } else if ( framework = == "jasmine2" ) {
108
110
framework_scripts [ 'jasmine2' ] . forEach ( function ( script ) {
109
111
patch += "<script type='text/javascript' src='/_patch/" + script + "'></script>\n" ;
110
112
} ) ;
111
- } else if ( config [ 'test_framework' ] && config [ 'test_framework' ] == "mocha" ) {
113
+ } else if ( framework = == "mocha" ) {
112
114
framework_scripts [ 'mocha' ] . forEach ( function ( script ) {
113
115
patch += "<script type='text/javascript' src='/_patch/" + script + "'></script>\n" ;
114
116
} ) ;
@@ -118,7 +120,7 @@ exports.Server = function Server(bsClient, workers) {
118
120
patch += "<script type='text/javascript' src='/_patch/" + script + "'></script>\n" ;
119
121
} ) ;
120
122
}
121
- patch += "</head >" ;
123
+ patch += "</" + tag_name + " >";
122
124
123
125
file = file . replace ( matcher , patch ) ;
124
126
}
0 commit comments