carton
carton copied to clipboard
Tests do not run on fresh init project
I created a new project with carton init
, then ran carton test
and I get this result:
carton test result log
Entrypoint integrity verified: /Users/benjaminkindle/.carton/static/test.js
- checking Swift compiler path: /Users/benjaminkindle/.carton/sdk/wasm-5.3.1-RELEASE/usr/bin/swift
- checking Swift compiler path: /Users/benjaminkindle/.swiftenv/versions/wasm-5.3.1-RELEASE/usr/bin/swift
- checking Swift compiler path: /Users/benjaminkindle/Library/Developer/Toolchains/swift-wasm-5.3.1-RELEASE.xctoolchain/usr/bin/swift
Inferring basic settings...
- swift executable: /Users/benjaminkindle/Library/Developer/Toolchains/swift-wasm-5.3.1-RELEASE.xctoolchain/usr/bin/swift
SwiftWasm Swift version 5.3 (swiftlang-5.3.1)
Target: x86_64-apple-darwin20.2.0
Parsing package manifest: /Users/benjaminkindle/Library/Developer/Toolchains/swift-wasm-5.3.1-RELEASE.xctoolchain/usr/bin/swift package dump-package
- test bundle to run: /Users/benjaminkindle/Desktop/carton-test/.build/wasm32-unknown-wasi/debug/carton-testPackageTests.wasm
Building the test bundle before running the test suite...
Compiling...
/Users/benjaminkindle/Library/Developer/Toolchains/swift-wasm-5.3.1-RELEASE.xctoolchain/usr/bin/swift build -c debug --product carton-testPackageTests --enable-test-discovery --triple wasm32-unknown-wasi -Xswiftc -color-diagnostics
Compilation failed.
[1/8] Merging module JavaScriptKit
[2/8] Merging module carton-test
[3/7] Linking carton-test.wasm
[4/9] Compiling carton-testTests carton_testTests.swift
/Users/benjaminkindle/Desktop/carton-test/Tests/carton-testTests/carton_testTests.swift:17:23: error: cannot find 'Process' in scope
let process = Process()
^~~~~~~
/Users/benjaminkindle/Desktop/carton-test/Tests/carton-testTests/carton_testTests.swift:20:20: error: cannot find 'Pipe' in scope
let pipe = Pipe()
^~~~
/Users/benjaminkindle/Desktop/carton-test/Tests/carton-testTests/carton_testTests.swift:40:28: error: value of type 'Bundle' has no member 'bundleURL'
return Bundle.main.bundleURL
~~~~~~~~~~~ ^~~~~~~~~
[5/9] Compiling carton-testTests XCTestManifests.swift
I am on carton 0.9.1 on a 2013 MacBook Pro running Big Sur. All other carton commands seem to work as expected for me. I am able to run swift test
without an issue.
Thanks, this is a known issue. We need to update our basic
template to be fetched from https://github.com/swiftwasm/browser-basic-template, which does have working tests. Refactoring template downloads is tracked in https://github.com/swiftwasm/carton/issues/91. I'll keep this one open though until that is fixed.
swift package init
is now WebAssembly compatible by default.