Fix tests

This commit is contained in:
Pedro Piñera 2020-11-08 19:03:00 +01:00
parent fb5b980be1
commit 9514ba5652
10 changed files with 20 additions and 28 deletions

View File

@ -88,7 +88,6 @@ jobs:
'test',
'precompiled',
'env',
'doc',
]
steps:
- uses: actions/checkout@v1

View File

@ -10,6 +10,11 @@ Please, check out guidelines: https://keepachangelog.com/en/1.0.0/
- Add support for `StencilSwiftKit`'s additional filters. [#1994](https://github.com/tuist/tuist/pull/1994) by [@svastven](https://github.com/svastven).
- Add `migration list-targets` command to show all targets sorted by number of dependencies [#1732](https://github.com/tuist/tuist/pull/1732) of a given project by [@andreacipriani](https://github.com/andreacipriani).
### Fixed
- Re-enable tests acceptance tests that were not running on CI [#1999](https://github.com/tuist/tuist/pull/1999) by [@pepibumur](https://github.com/pepibumur).
- Block the process while editing the project and remove the project after the edition finishes [#1999](https://github.com/tuist/tuist/pull/1999) by [@pepibumur](https://github.com/pepibumur).
## 1.23.0
### Added

View File

@ -13,6 +13,7 @@ class BuildCopier: BuildCopying {
static let files: [String] = [
"tuist",
Constants.templatesDirectoryName,
Constants.vendorDirectoryName,
// Project description
"ProjectDescription.swiftmodule",
"ProjectDescription.swiftdoc",

View File

@ -39,7 +39,7 @@ final class EditService {
let path = self.path(path)
if !permanent {
try withTemporaryDirectory { generationDirectory in
try withTemporaryDirectory(removeTreeOnDeinit: true) { generationDirectory in
EditService.temporaryDirectory = generationDirectory
Signals.trap(signals: [.int, .abrt]) { _ in
@ -53,7 +53,7 @@ final class EditService {
}
let xcodeprojPath = try projectEditor.edit(at: path, in: generationDirectory)
logger.pretty("Opening Xcode to edit the project. Press \(.keystroke("CTRL + C")) once you are done editing")
try opener.open(path: xcodeprojPath, application: selectedXcode.path)
try opener.open(path: xcodeprojPath, application: selectedXcode.path, wait: true)
}
} else {
let xcodeprojPath = try projectEditor.edit(at: path, in: path)

View File

@ -16,6 +16,7 @@ public struct Constants {
public static let masterKey = "master.key"
public static let encryptedExtension = "encrypted"
public static let templatesDirectoryName: String = "Templates"
public static let vendorDirectoryName: String = "vendor"
public static let twitterHandle: String = "tuistio"
public static let joinSlackURL: String = "https://slack.tuist.io/"
public static let tuistGeneratedFileName = ".tuist-generated"

View File

@ -30,6 +30,7 @@ public protocol Opening: AnyObject {
func open(path: AbsolutePath, wait: Bool) throws
func open(path: AbsolutePath) throws
func open(path: AbsolutePath, application: AbsolutePath) throws
func open(path: AbsolutePath, application: AbsolutePath, wait: Bool) throws
func open(url: URL) throws
func open(target: String, wait: Bool) throws
}
@ -64,10 +65,15 @@ public class Opener: Opening {
}
public func open(path: AbsolutePath, application: AbsolutePath) throws {
try open(path: path, application: application, wait: true)
}
public func open(path: AbsolutePath, application: AbsolutePath, wait: Bool) throws {
var arguments: [String] = []
arguments.append(contentsOf: ["/usr/bin/open"])
arguments.append(path.pathString)
arguments.append(contentsOf: ["-a", application.pathString])
if wait { arguments.append("-W") }
try System.shared.run(arguments)
}
}

View File

@ -28,6 +28,10 @@ public final class MockOpener: Opening {
}
public func open(path: AbsolutePath, application: AbsolutePath) throws {
try open(path: path, application: application, wait: true)
}
public func open(path: AbsolutePath, application: AbsolutePath, wait _: Bool) throws {
openCallCount += 1
openArgs.append((path.pathString, false, application))
if let openStub = openStub { throw openStub }

View File

@ -26,6 +26,7 @@ final class BuildCopierTests: XCTestCase {
XCTAssertEqual(BuildCopier.files, [
"tuist",
Constants.templatesDirectoryName,
Constants.vendorDirectoryName,
"ProjectDescription.swiftmodule",
"ProjectDescription.swiftdoc",
"ProjectDescription.swiftinterface",

View File

@ -1,7 +0,0 @@
Feature: Generate documentation for a specific target using Tuist
Scenario: The project is an application with frameworks (ios_app_with_frameworks)
Given that tuist is available
And I have a working directory
Then I copy the fixture ios_app_with_frameworks into the working directory
Then I should be able to access the documentation of target 'Framework1'

View File

@ -1,18 +0,0 @@
# frozen_string_literal: true
Then("I should be able to access the documentation of target {string}") do |target|
cmd = "swift run tuist doc --path #{@dir}/#{target}/ #{target}"
io = IO.popen(cmd, :mode=>"r+") # merge standard output and standard error
sleep 10 # This is important. If the request is done before the server is ready, it fails
uri = URI.parse("http://localhost:4040/index.html")
request = Net::HTTP::Get.new(uri)
response = Net::HTTP.start(uri.hostname, uri.port) do |http|
http.request(request)
end
flunk("The request to #{uri.to_s} returned status code #{response.code}") if response.code != "200"
Process.kill("INT", io.pid)
end