11/// <reference path="../declarations.d.ts"/>
2- import { Observable , ObservableArray , Http , Device , Frame } from "@nativescript/core" ;
2+ import { Observable , ObservableArray , Http , Device , Frame , isAndroid } from "@nativescript/core" ;
33import { KarmaHostResolver } from './services/karma-host-resolver' ;
44import { KarmaFilesService } from './services/karma-files-service' ;
55import { TestExecutionService } from './services/test-execution-service' ;
@@ -20,6 +20,17 @@ function enableSocketIoDebugging() {
2020
2121var config : INetworkConfiguration = require ( '../config' ) ;
2222config . options = config . options || { } ;
23+ // For whatever reason, Android emulators sometime struggle to find a
24+ // reachable host ip and make a successful call for the `context.json` file.
25+ // This happens in the test runner, even though mobile browsers can make successful calls to the
26+ // already discovered ips. According to
27+ // https://developer.android.com/studio/run/emulator-networking#networkaddresses
28+ // ip addr: `10.0.2.2` is a special alias to your host loopback interface
29+ // (i.e., 127.0.0.1 on your development machine)
30+ // adding this ipaddr eases the struggle. (no effect on actual devices)
31+ if ( isAndroid )
32+ config . ips = ( config . ips || [ ] ) . concat ( [ '10.0.2.2' ] )
33+
2334if ( ! config . options . appDirectoryRelativePath ) {
2435 config . options . appDirectoryRelativePath = "app" ;
2536}
0 commit comments