Skip to content

fix(migrate): nativescript-unit-test-runner & missing basePath #5537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions lib/controllers/migrate-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -1287,6 +1302,7 @@ export class MigrateController
const karmaConf = _.template(karmaConfTemplate)({
frameworks,
testFiles,
basePath: projectData.getAppDirectoryRelativePath(),
});
this.$fs.writeFile(
path.join(projectData.projectDir, constants.KARMA_CONFIG_NAME),
Expand Down