From 6a1d33e234d76f74eb7d97e22cfe1d8f552410cf Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Fri, 4 Jun 2021 17:29:51 +0200 Subject: [PATCH 1/2] fix: basePath is undefined when migrating app with unit-test-runner --- lib/controllers/migrate-controller.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/controllers/migrate-controller.ts b/lib/controllers/migrate-controller.ts index b2ba60aa97..825df4c5a6 100644 --- a/lib/controllers/migrate-controller.ts +++ b/lib/controllers/migrate-controller.ts @@ -1287,6 +1287,7 @@ export class MigrateController const karmaConf = _.template(karmaConfTemplate)({ frameworks, testFiles, + basePath: projectData.getAppDirectoryRelativePath(), }); this.$fs.writeFile( path.join(projectData.projectDir, constants.KARMA_CONFIG_NAME), From f07fb29610314f48d76c8689c6937ca6544d011e Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Fri, 4 Jun 2021 17:30:14 +0200 Subject: [PATCH 2/2] fix: migrate nativescript-unit-test-runner --- lib/controllers/migrate-controller.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/controllers/migrate-controller.ts b/lib/controllers/migrate-controller.ts index 825df4c5a6..6e1487208a 100644 --- a/lib/controllers/migrate-controller.ts +++ b/lib/controllers/migrate-controller.ts @@ -236,9 +236,20 @@ export class MigrateController }, migrateAction: this.migrateNativeScriptSvelte.bind(this), }, + { + packageName: "nativescript-unit-test-runner", + replaceWith: "@nativescript/unit-test-runner", + shouldRemove: true, + isDev: true, + async shouldMigrateAction() { + return true; + }, + migrateAction: this.migrateUnitTestRunner.bind(this), + }, { packageName: "@nativescript/unit-test-runner", - minVersion: "2.0.0", + minVersion: "1.0.0", + desiredVersion: "~2.0.0", async shouldMigrateAction( dependency: IMigrationDependency, projectData: IProjectData, @@ -1123,7 +1134,11 @@ export class MigrateController this.$errors.fail("Failed to find replacement dependency."); } - const version = dependency.desiredVersion ?? dependency.minVersion; + const version = + replacementDep.desiredVersion ?? + replacementDep.minVersion ?? + dependency.desiredVersion ?? + dependency.minVersion; // add replacement dependency this.$pluginsService.addToPackageJson(