1
1
var env = process . env ,
2
- fs = require ( 'fs' ) ,
3
- path = require ( 'path' ) ;
4
-
5
-
6
- var runningOnTravis = ( env . TRAVIS !== undefined ) ;
2
+ fs = require ( 'fs' ) ,
3
+ path = require ( 'path' ) ,
4
+ runningOnTravis = ( env . TRAVIS !== undefined ) ;
7
5
8
6
9
7
function getBaseUrl ( configWithEnvKey ) {
10
8
if ( env [ configWithEnvKey . envVar ] ) {
11
- return env [ configWithEnvKey . envVar ] ;
9
+ return env [ configWithEnvKey . envVar ] ;
12
10
} else if ( env . USER == 'chirayu' ) {
13
- return 'http://example.ngdart.localhost' ;
11
+ return 'http://example.ngdart.localhost' ;
14
12
} else {
15
- // Default host:port when you run "pub serve" from the example
16
- // subdirectory of the AngularDart repo.
17
- return 'http://localhost:8080' ;
13
+ // Default host:port when you run "pub serve" from the example
14
+ // subdirectory of the AngularDart repo.
15
+ return 'http://localhost:8080' ;
18
16
}
19
17
}
20
18
21
19
22
20
function getDartiumBinary ( ) {
23
- var ensure = function ( condition ) {
24
- if ( ! condition ) throw "Unable to locate Dartium. Please set the DARTIUM environment variable." ;
21
+ function ensure ( condition ) {
22
+ if ( ! condition ) throw "Unable to locate Dartium. Please set the DARTIUM environment variable." ;
25
23
} ;
26
24
27
25
if ( env . DARTIUM ) {
28
- return env . DARTIUM ;
26
+ return env . DARTIUM ;
29
27
}
30
28
var platform = require ( 'os' ) . platform ( ) ;
31
29
var DART_SDK = env . DART_SDK ;
32
30
if ( DART_SDK ) {
33
- // Locate the chromium directory as a sibling of the DART_SDK
34
- // directory. (It's there if you unpacked the full Dart distribution.)
35
- var chromiumRoot = path . join ( DART_SDK , "../chromium" ) ;
36
- ensure ( fs . existsSync ( chromiumRoot ) ) ;
37
- var binary = path . join ( chromiumRoot ,
38
- ( platform == 'darwin' ) ? 'Chromium.app/Contents/MacOS/Chromium' : 'chrome' ) ;
39
- ensure ( fs . existsSync ( binary ) ) ;
40
- return binary ;
31
+ // Locate the chromium directory as a sibling of the DART_SDK
32
+ // directory. (It's there if you unpacked the full Dart distribution.)
33
+ var chromiumRoot = path . join ( DART_SDK , "../chromium" ) ;
34
+ ensure ( fs . existsSync ( chromiumRoot ) ) ;
35
+ var binary = path . join ( chromiumRoot ,
36
+ ( platform == 'darwin' ) ? 'Chromium.app/Contents/MacOS/Chromium' : 'chrome' ) ;
37
+ ensure ( fs . existsSync ( binary ) ) ;
38
+ return binary ;
41
39
}
42
- // Last resort: Try the standard location on Macs for the AngularDart team.
40
+ // Last resort: Try the standard location on Macs for the AngularDart team.
43
41
var binary = '/Applications/dart/chromium/Chromium.app/Contents/MacOS/Chromium' ;
44
42
ensure ( platform == 'darwin' && fs . existsSync ( binary ) ) ;
45
43
return binary ;
@@ -48,21 +46,21 @@ function getDartiumBinary() {
48
46
49
47
function getChromeOptions ( ) {
50
48
if ( ! runningOnTravis ) {
51
- return { 'binary' : getDartiumBinary ( ) } ;
49
+ return { 'binary' : getDartiumBinary ( ) } ;
52
50
}
53
- // In Travis, the list of browsers to test is specified as a CSV in the
54
- // BROWSERS environment variable.
55
- // TODO(chirayu): Parse the BROWSERS csv so we also test on Firefox.
51
+ // In Travis, the list of browsers to test is specified as a CSV in the
52
+ // BROWSERS environment variable.
53
+ // TODO(chirayu): Parse the BROWSERS csv so we also test on Firefox.
56
54
if ( env . TESTS == "vm" ) {
57
- return { 'binary' : env . DARTIUM_BIN } ;
55
+ return { 'binary' : env . DARTIUM_BIN } ;
58
56
}
59
57
if ( env . TESTS == "dart2js" ) {
60
- return {
61
- 'binary' : env . CHROME_BIN ,
62
- // Ref: https://github.com/travis-ci/travis-ci/issues/938
63
- // https://sites.google.com/a/chromium.org/chromedriver/help/chrome-doesn-t-start
64
- 'args' : [ 'no-sandbox=true' ]
65
- } ;
58
+ return {
59
+ 'binary' : env . CHROME_BIN ,
60
+ // Ref: https://github.com/travis-ci/travis-ci/issues/938
61
+ // https://sites.google.com/a/chromium.org/chromedriver/help/chrome-doesn-t-start
62
+ 'args' : [ 'no-sandbox=true' ]
63
+ } ;
66
64
}
67
65
throw new Error ( "Unknown Travis configuration specified by TESTS variable" ) ;
68
66
}
0 commit comments