Simple project having executable product with different name fails to build with error "No such module"

Steps to reproduce:

  • Run
    mkdir SomeToolName
    cd SomeToolName
    swift package init --type executable
  • Open the SomeToolName/Package.swift file with Xcode
  • Add
    products: [
            name: "stn",
            targets: ["SomeToolName"]
    after the name parameter
  • Try to build the project

Current behaviour:

  • The line @testable import SomeToolName fails to build with the error
    /Users/revolt/SomeToolName/Tests/SomeToolNameTests/SomeToolNameTests.swift:2:18 No such module 'SomeToolName'

Expected behaviour:

  • The project should build.

Fixing attempts:

  • I noticed that stn gets autocompleted on that line, but in that case, it fails to build with the error
    Undefined symbol: _$s3stn12SomeToolNameVACycfC

Am I doing something wrong, or is this (executable name customization and testing) not supported (yet)?