             }
         }
 
+        if options.shouldPrintCodeCovPath && !options.enableCodeCoverage {
+            throw StringError("'--show-codecov-path' option is only allowed with '--enable-code-coverage'")
+        }
+
         if options._deprecated_shouldGenerateLinuxMain {
             observabilityScope.emit(warning: "'--generate-linuxmain' option is deprecated; tests are automatically discovered on all platforms")
         }
 
         if options._deprecated_shouldListTests {
             observabilityScope.emit(warning: "'--list-tests' option is deprecated; use 'swift test list' instead")
-        }
-
-        if options._deprecated_shouldPrintCodeCovPath {
-            observabilityScope.emit(warning: "'--show-codecov-path' option is deprecated; use 'swift test show-codecov-path' instead")
         }
     }
 

            } else {
                return testProducts
            }
        }
    }
}

extension SwiftTestTool {
    struct PrintCodeCovPath: SwiftCommand {
        static let configuration = CommandConfiguration(
            commandName: "show-codecov-path",
            abstract: "Print the path of the exported code coverage JSON file"
        )

        @OptionGroup(_hiddenFromHelp: true)
        var globalOptions: GlobalOptions

        // for deprecated passthrough from SwiftTestTool (parse will fail otherwise)
        @Flag(name: .customLong("show-codecov-path"), help: .hidden)
        var _deprecated_passthrough: Bool = false

        func run(_ swiftTool: SwiftTool) throws {
            let workspace = try swiftTool.getActiveWorkspace()
            let root = try swiftTool.getWorkspaceRoot()
            let rootManifests = try temp_await {
                workspace.loadRootManifests(
                    packages: root.packages,
                    observabilityScope: swiftTool.observabilityScope,
                    completion: $0
                )
            }
            guard let rootManifest = rootManifests.values.first else {
                throw StringError("invalid manifests at \(root.packages)")
            }
            let buildParameters = try swiftTool.buildParametersForTest(enableCodeCoverage: true)
            print(buildParameters.codeCovAsJSONPath(packageName: rootManifest.displayName))
        }
    }
}

        if self.options._deprecated_shouldListTests {
            // backward compatibility 6/2022 for deprecation of flag into a subcommand
            let command = try List.parse()
            try command.run(swiftTool)
        } else if self.options._deprecated_shouldGenerateLinuxMain {
            // backward compatibility 6/2022 for deprecation of flag into a subcommand
