From 402448a489918a3cc3856ffda3481a88d744c79f Mon Sep 17 00:00:00 2001 From: fatme Date: Mon, 21 Jan 2019 14:13:57 +0200 Subject: [PATCH 1/2] feat: respect nsconfig file from project and correctly navigate to run tests page Rel to: https://github.com/NativeScript/nativescript-angular/issues/1310 https://github.com/NativeScript/nativescript-cli/issues/4244 --- app-root.xml | 2 +- main-view-model.ts | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) 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) { From 86be2478e906f86f51314fd71483bc129fdbe300 Mon Sep 17 00:00:00 2001 From: fatme Date: Mon, 21 Jan 2019 14:20:13 +0200 Subject: [PATCH 2/2] fix: bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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": {