Skip to content
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

Internal pbxProject.prototype.addTargetDependency function not properly tested #74

Closed
brody4hire opened this issue Oct 20, 2019 · 0 comments · Fixed by #81
Closed

Internal pbxProject.prototype.addTargetDependency function not properly tested #74

brody4hire opened this issue Oct 20, 2019 · 0 comments · Fixed by #81

Comments

@brody4hire
Copy link

As discovered through Stryker mutation testing (PR #61), the following changes to pbxProject.prototype.addTargetDependency do not seem to trigger a test failure:

diff --git a/lib/pbxProject.js b/lib/pbxProject.js
index be9f473..74b5f08 100644
--- a/lib/pbxProject.js
+++ b/lib/pbxProject.js
@@ -820,15 +820,6 @@ pbxProject.prototype.addTargetDependency = function(target, dependencyTargets) {
 
     var nativeTargets = this.pbxNativeTargetSection();
 
-    if (typeof nativeTargets[target] == "undefined")
-        throw new Error("Invalid target: " + target);
-
-    for (var index = 0; index < dependencyTargets.length; index++) {
-        var dependencyTarget = dependencyTargets[index];
-        if (typeof nativeTargets[dependencyTarget] == "undefined")
-            throw new Error("Invalid target: " + dependencyTarget);
-        }
-
     var pbxTargetDependency = 'PBXTargetDependency',
         pbxContainerItemProxy = 'PBXContainerItemProxy',
         pbxTargetDependencySection = this.hash.project.objects[pbxTargetDependency],
@@ -836,15 +827,15 @@ pbxProject.prototype.addTargetDependency = function(target, dependencyTargets) {
 
     for (var index = 0; index < dependencyTargets.length; index++) {
         var dependencyTargetUuid = dependencyTargets[index],
-            dependencyTargetCommentKey = f("%s_comment", dependencyTargetUuid),
+            dependencyTargetCommentKey = f("", dependencyTargetUuid),
             targetDependencyUuid = this.generateUuid(),
             targetDependencyCommentKey = f("%s_comment", targetDependencyUuid),
             itemProxyUuid = this.generateUuid(),
-            itemProxyCommentKey = f("%s_comment", itemProxyUuid),
+            itemProxyCommentKey = f("", itemProxyUuid),
             itemProxy = {
                 isa: pbxContainerItemProxy,
                 containerPortal: this.hash.project['rootObject'],
-                containerPortal_comment: this.hash.project['rootObject_comment'],
+                containerPortal_comment: this.hash.project[''],
                 proxyType: 1,
                 remoteGlobalIDString: dependencyTargetUuid,
                 remoteInfo: nativeTargets[dependencyTargetUuid].name
@@ -857,7 +848,7 @@ pbxProject.prototype.addTargetDependency = function(target, dependencyTargets) {
                 targetProxy_comment: pbxContainerItemProxy
             };
 
-        if (pbxContainerItemProxySection && pbxTargetDependencySection) {
+        {
             pbxContainerItemProxySection[itemProxyUuid] = itemProxy;
             pbxContainerItemProxySection[itemProxyCommentKey] = pbxContainerItemProxy;
             pbxTargetDependencySection[targetDependencyUuid] = targetDependency;

I discovered this while looking at the mutation testing results of PR #56 (watch2 support).

I think we should try to add the missing test coverage soon since this function is used to support the new watch2 functionality. However, I do not think this should block merge of PR #56.

This is also related to #73 (internal pbxProject.prototype.addTargetDependency call not properly tested).

/cc @l3ender

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant