File tree Expand file tree Collapse file tree 1 file changed +32
-5
lines changed
plotly/tests/test_core/test_jupyter/lib Expand file tree Collapse file tree 1 file changed +32
-5
lines changed Original file line number Diff line number Diff line change @@ -18,11 +18,27 @@ var PATH_TEST_BUNDLE = path.join(PATH_ROOT, 'test.tmp.js');
18
18
var URL = 'http://localhost:' + PORT + '/fixtures/test.tmp.html' ;
19
19
var EXIT_CODE = 0 ;
20
20
21
- // main
22
- stubIndex ( )
23
- . then ( bundleTests )
24
- . then ( startServer )
25
- . then ( launch )
21
+
22
+ main ( ) ;
23
+
24
+ function main ( ) {
25
+ scanDependencies ( ) ;
26
+
27
+ stubIndex ( )
28
+ . then ( bundleTests )
29
+ . then ( startServer )
30
+ . then ( launch ) ;
31
+ }
32
+
33
+ function scanDependencies ( ) {
34
+ var reqFiles = [ PATH_INDEX , PATH_TEST_FILE ] ;
35
+
36
+ reqFiles . forEach ( function ( filePath ) {
37
+ if ( ! doesFileExist ( filePath ) ) {
38
+ throw new Error ( filePath + ' does not exist' ) ;
39
+ }
40
+ } ) ;
41
+ }
26
42
27
43
function stubIndex ( ) {
28
44
return new Promise ( function ( resolve , reject ) {
@@ -87,6 +103,17 @@ function launch() {
87
103
chrome ( URL ) ;
88
104
}
89
105
106
+ function doesFileExist ( filePath ) {
107
+ try {
108
+ if ( fs . statSync ( filePath ) . isFile ( ) ) return true ;
109
+ }
110
+ catch ( e ) {
111
+ return false ;
112
+ }
113
+
114
+ return false ;
115
+ }
116
+
90
117
function removeBuildFiles ( ) {
91
118
fs . unlinkSync ( PATH_INDEX_STUB ) ;
92
119
fs . unlinkSync ( PATH_TEST_BUNDLE ) ;
You can’t perform that action at this time.
0 commit comments