12
12
* will only run the tests in axes_test.js
13
13
*
14
14
*/
15
- var testFileGlob = process . argv [ 4 ] ? process . argv [ 4 ] : 'tests/*_test.js' ;
15
+
16
+ var arg = process . argv [ 4 ] ;
17
+
18
+ var testFileGlob = arg ? arg : 'tests/*_test.js' ;
19
+ var isSingleSuiteRun = ( arg && arg . indexOf ( 'bundle_tests/' ) === - 1 ) ;
20
+
21
+ var pathToMain = '../../lib/index.js' ;
22
+ var pathToJQuery = 'assets/jquery-1.8.3.min.js' ;
16
23
17
24
18
25
function func ( config ) {
@@ -34,10 +41,9 @@ func.defaultConfig = {
34
41
frameworks : [ 'jasmine' , 'browserify' ] ,
35
42
36
43
// list of files / patterns to load in the browser
37
- files : [
38
- 'assets/jquery-1.8.3.min.js' ,
39
- testFileGlob
40
- ] ,
44
+ //
45
+ // N.B. this field is filled below
46
+ files : [ ] ,
41
47
42
48
exclude : [ ] ,
43
49
@@ -77,7 +83,27 @@ func.defaultConfig = {
77
83
}
78
84
} ;
79
85
80
- // browserify the test files
81
- func . defaultConfig . preprocessors [ testFileGlob ] = [ 'browserify' ] ;
86
+
87
+ // Add lib/index.js to single-suite runs,
88
+ // to avoid import conflicts due to plotly.js
89
+ // circular dependencies.
90
+ if ( isSingleSuiteRun ) {
91
+ func . defaultConfig . files = [
92
+ pathToJQuery ,
93
+ pathToMain ,
94
+ testFileGlob
95
+ ] ;
96
+
97
+ func . defaultConfig . preprocessors [ pathToMain ] = [ 'browserify' ] ;
98
+ func . defaultConfig . preprocessors [ testFileGlob ] = [ 'browserify' ] ;
99
+ }
100
+ else {
101
+ func . defaultConfig . files = [
102
+ pathToJQuery ,
103
+ testFileGlob
104
+ ] ;
105
+
106
+ func . defaultConfig . preprocessors [ testFileGlob ] = [ 'browserify' ] ;
107
+ }
82
108
83
109
module . exports = func ;
0 commit comments