diff --git a/app-root.xml b/app-root.xml index 6fe834f..86f9ec0 100644 --- a/app-root.xml +++ b/app-root.xml @@ -1,2 +1,2 @@ - + diff --git a/main-view-model.ts b/main-view-model.ts index 68adfe2..6cfd49e 100644 --- a/main-view-model.ts +++ b/main-view-model.ts @@ -14,6 +14,7 @@ interface IHostConfiguration { options: { debugBrk?: boolean; debugTransport?: boolean; + appDirectoryRelativePath?: string; } } @@ -42,7 +43,10 @@ function enableSocketIoDebugging() { } var config: INetworkConfiguration = require('./config'); -config.options = config.options || {} +config.options = config.options || {}; +if (!config.options.appDirectoryRelativePath) { + config.options.appDirectoryRelativePath = "app"; +} export class TestBrokerViewModel extends observable.Observable { private startEmitted: boolean; @@ -189,13 +193,13 @@ export class TestBrokerViewModel extends observable.Observable { } public viewTestRunDetails() { - frameModule.topmost().navigate('run-details'); + frameModule.getFrameById('root-frame').navigate('run-details'); } public beginLocalRun() { this.config = this.config || { args: [] }; - frameModule.topmost().navigate('tns_modules/nativescript-unit-test-runner/test-run-page'); + frameModule.getFrameById('root-frame').navigate('tns_modules/nativescript-unit-test-runner/test-run-page'); } public onKarmaExecute(cfg) { @@ -225,7 +229,7 @@ export class TestBrokerViewModel extends observable.Observable { }) .then(scriptUrls => { return Promise.all(scriptUrls.map((url): Promise => { - var appPrefix = '/base/app/'; + var appPrefix = `/base/${config.options.appDirectoryRelativePath}/`; if (url.startsWith(appPrefix)) { var paramsStart = url.indexOf('?'); var relativePath = url.substring(appPrefix.length, paramsStart); @@ -279,7 +283,7 @@ export class TestBrokerViewModel extends observable.Observable { } private isTestScript(url: string): boolean { - return url.startsWith('/base/app/tests/') || !url.startsWith('/base/app/'); + return url.startsWith(`/base/${config.options.appDirectoryRelativePath}/tests/`) || !url.startsWith(`/base/${config.options.appDirectoryRelativePath}/`); } public updateBrowsersInfo(browsers) { diff --git a/package.json b/package.json index 33161ba..c951680 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-unit-test-runner", - "version": "0.3.4", + "version": "0.4.0", "description": "NativeScript unit test runner component.", "main": "app.js", "scripts": {